[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [virtio-dev] Re: [RFC PATCH v2 3/3] SPI: Add virtio SPI driver (V10 draft specification).
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@quicinc.com/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)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]