From: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
To: Haixu Cui <quic_haixcui@quicinc.com>, <broonie@kernel.org>,
<virtio-dev@lists.linux.dev>, <viresh.kumar@linaro.org>,
<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<hdanton@sina.com>, <qiang4.zhang@linux.intel.com>,
<alex.bennee@linaro.org>
Cc: <quic_ztu@quicinc.com>
Subject: Re: [RFC PATCH v5 3/3] SPI: Add virtio SPI driver.
Date: Mon, 30 Jun 2025 12:24:51 +0530 [thread overview]
Message-ID: <be751d7b-9216-4564-ad21-2df6a19477fa@quicinc.com> (raw)
In-Reply-To: <20250620041230.731504-4-quic_haixcui@quicinc.com>
Hi, Haixu, Thanks !
On 6/20/2025 9:42 AM, Haixu Cui wrote:
> This is the virtio SPI Linux kernel driver.
>
> Signed-off-by: Haixu Cui <quic_haixcui@quicinc.com>
> ---
> MAINTAINERS | 6 +
> drivers/spi/Kconfig | 11 +
> drivers/spi/Makefile | 1 +
> drivers/spi/spi-virtio.c | 444 +++++++++++++++++++++++++++++++++++++++
> 4 files changed, 462 insertions(+)
> create mode 100644 drivers/spi/spi-virtio.c
>
[...]
> + * So the corresponding relationship:
> + * A <===> cs_setup_ns (after CS asserted)
And "before clock start" ? to be added in bracket as comment.
> + * B <===> word_delay_ns (delay between adjacent words within a transfer)
> + * C+D <===> cs_delay_hold_ns (before CS deasserted)
> + * E+F <===> cs_change_delay_inactive_ns (after CS deasserted, these two
> + * values are also recommended in the Linux driver to be added up)
> + */
> +
> +static int virtio_spi_transfer_one(struct spi_controller *ctrl,
> + struct spi_device *spi,
> + struct spi_transfer *xfer)
> +{
[...]
> + wait_for_completion(&priv->spi_req.completion);
> +
I see init_completion(spi_req.completion) is called during probe() but
successive transfer doent have reinit_completion(spi_req.completion).
wondering how is this working for back to back transfers.
> + /* Read result from message and translate return code */
> + switch (priv->spi_req.result.result) {
> + case VIRTIO_SPI_TRANS_OK:
> + /* ret is 0 */
> + break;
> + case VIRTIO_SPI_PARAM_ERR:
> + ret = -EINVAL;
> + break;
> + case VIRTIO_SPI_TRANS_ERR:
> + ret = -EIO;
> + break;
> + default: /* Protocol violation */
Comment in new line ? following same method across.
> + ret = -EIO;
> + break;
> + }
[...]
> +static void virtio_spi_remove(struct virtio_device *vdev)
> +{
> + struct spi_controller *ctrl = dev_get_drvdata(&vdev->dev);
> +
> + /* Order: 1.) unregister controller, 2.) remove virtqueue */
Is this a specific flow for virtio OR generic ? if its generic, we can
remove the comments.
> + spi_unregister_controller(ctrl);
> + virtio_spi_del_vq(vdev);
> +}
> +
next prev parent reply other threads:[~2025-06-30 6:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 4:12 [RFC PATCH v5 0/3] Virtio SPI Linux driver Haixu Cui
2025-06-20 4:12 ` [RFC PATCH v5 1/3] virtio: Add ID for virtio SPI Haixu Cui
2025-06-20 4:12 ` [RFC PATCH v5 2/3] virtio-spi: Add virtio-spi.h Haixu Cui
2025-06-30 6:59 ` Mukesh Kumar Savaliya
2025-07-04 6:54 ` Haixu Cui
2025-06-20 4:12 ` [RFC PATCH v5 3/3] SPI: Add virtio SPI driver Haixu Cui
2025-06-30 6:54 ` Mukesh Kumar Savaliya [this message]
2025-07-04 7:46 ` Haixu Cui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be751d7b-9216-4564-ad21-2df6a19477fa@quicinc.com \
--to=quic_msavaliy@quicinc.com \
--cc=alex.bennee@linaro.org \
--cc=broonie@kernel.org \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=qiang4.zhang@linux.intel.com \
--cc=quic_haixcui@quicinc.com \
--cc=quic_ztu@quicinc.com \
--cc=viresh.kumar@linaro.org \
--cc=virtio-dev@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®