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@xxxxxxxxxxx>
---
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:And "before clock start" ? to be added in bracket as comment.
+ * A <===> cs_setup_ns (after CS asserted)
+
+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 */Comment in new line ? following same method across.
+ 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 */
+static void virtio_spi_remove(struct virtio_device *vdev)Is this a specific flow for virtio OR generic ? if its generic, we can remove the comments.
+{
+ struct spi_controller *ctrl = dev_get_drvdata(&vdev->dev);
+
+ /* Order: 1.) unregister controller, 2.) remove virtqueue */
+ spi_unregister_controller(ctrl);
+ virtio_spi_del_vq(vdev);
+}
+