Re: [virtio-dev] Re: [RFC PATCH v2 3/3] SPI: Add virtio SPI driver (V10 draft specification).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/6171c1c3-55ba-4f74-ae60-764820cf1caf@xxxxxxxxxxx/

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)





[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux