Re: [virtio-dev] Re: [RFC PATCH v2 3/3] SPI: Add virtio SPI driver (V10 draft specification).
Harald Mommer <[email protected]> Thu, 1 Feb 2024 18:26:32 +0100
| Newsgroups | dev.linux.lists.virtio-dev,org.kernel.vger.linux-kernel,org.kernel.vger.linux-spi |
|---|---|
| Message-ID | <[email protected]> |
Hello Haixu, Thanks. This was a hard one. I knew that I did the delay settingsmost probably somewhat wrong but I had no idea that I did it so wrong. Reworked, made a new function for this, currently testing. Added the link to the place where your E-Mail is stored https://lore.kernel.org/all/[email protected]/ as a comment to the source code and hope this will survive the reviews. Another option would be to add the diagram + the explanations below as quoted here as comment to the code. Whether 30+ lines of comments would survive the reviews I don't know. Just to say nothing in the code making live hard for people trying to understand the code is something I would like to avoid. Regards Harald On 30.01.24 04:21, Haixu Cui wrote: > . . . . . . . . . . > Delay + A + + B + + C + D + E + F + A + > . . . . . . . . . . > ___. . . . . . .___.___. . > CS# |___.______.____.____.___.___| . |___._____________ > . . . . . . . . . . > . . . . . . . . . . > SCLK__.___.___NNN_____NNN__.___.___.___.___.___.___NNN_______ > > > NOTE: 1st transfer has two words, the delay betweent these two words > are 'B' in the diagram. > > A => struct spi_device -> cs_setup > B => max{struct spi_transfer -> word_delay, > struct spi_device -> word_delay} > Note: spi_device and spi_transfer both have word_delay, Linux > choose the bigger one, refer to _spi_xfer_word_delay_update > function > C => struct spi_transfer -> delay > D => struct spi_device -> cs_hold > E => struct spi_device -> cs_inactive > F => struct spi_transfer -> cs_change_delay > > So the corresponding relationship: > A <===> cs_setup_ns (after CS asserted) > B <===> word_delay_ns (no matter with CS) > C+D <===> cs_delay_hold_ns (before CS deasserted) > E+F <===> cs_change_delay_inactive_ns (after CS deasserted, these two > values also recommend in Linux driver to be added up) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]