OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [virtio-comment] [PATCH] [PATCH v5] virtio-spi: add the device specification


On 28-11-23, 20:58, Haixu Cui wrote:
> On 11/27/2023 6:17 PM, Viresh Kumar wrote:
> > On 24-11-23, 15:20, Haixu Cui wrote:
> > > +For half-duplex read transfer, \field{rx_buf} is filled by Virtio SPI device and consumed
> > > +by Virtio SPI driver. For half-duplex write transfer, \field{tx_buf} is filled by Virtio
> > > +SPI driver and consumed by Virtio SPI device. And for full-duplex read and write transfer,
> > > +both \field{tx_buf} and \field{rx_buf} are used.
> > 
> > Should the length of both the buffers in full-duplex mode be same ? If yes, then
> > this should be mentioned (in case it is not).
> > 
> 
> No, there is no such limitation. Write and read buffers may be different is
> size.

Hmm, I worked with a SPI controller over a decade ago, and I must be forgetting
something here I guess. But from whatever little I remember, with full-duplex
transfer, data flows on both MOSI and MISO lines as soon as clock signal is
applied.  And so amount of data sent is always be equal to amount of data
received by both sides.

Also if I see Linux's implementation of the `struct spi_transfer` [1], I see
`tx_buf`, `rx_buf` and a single `len` field, which applies to both the buffers.
Which I guess is indicating that both buffers are supposed to be of same length.

What am I missing ?

> > > +Virtio SPI device MUST NOT change the data in \field{tx_buf} if transfer type is half-duplex write
> > > +or full-duplex read and write.
> > 
> > The device MUST NOT change the contents of the tx_buf ever, i.e. for every mode
> > there is. In half-duplex read mode, there is no tx_buf, but just rx_buf.
> > 
> 
> Sorry I don'y understand here. In this statement, the transfer type is
> either half-duplex write or full-duplex read and write. half-duplex read
> type has no tx_buf, so I didn't mention it.

Sorry for not being clear earlier. I was suggesting you to just write this
instead:

The Virtio SPI device MUST NOT change the data in the \field{tx_buf} field.

You don't really need to specify the modes here, as we are talking about tx_buf,
which isn't available in the half-duplex read mode but all others.

--
Viresh

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/spi/spi.h#n1031


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]