Re: [PATCH v3 REBASED] spi: Add capability to perform some transfer with chipselect off

From: Andy Shevchenko
Date: Tue May 07 2024 - 12:25:10 EST


On Wed, Sep 07, 2022 at 04:13:44PM +0200, Christophe Leroy wrote:
> Some components require a few clock cycles with chipselect off before
> or/and after the data transfer done with CS on.
>
> Typically IDT 801034 QUAD PCM CODEC datasheet states "Note *: CCLK
> should have one cycle before CS goes low, and two cycles after
> CS goes high".
>
> The cycles "before" are implicitely provided by all previous activity
> on the SPI bus. But the cycles "after" must be provided in order to
> terminate the SPI transfer.
>
> In order to use that kind of component, add a cs_off flag to
> spi_transfer struct. When this flag is set, the transfer is performed
> with chipselect off. This allows consummer to add a dummy transfer
> at the end of the transfer list which is performed with chipselect
> OFF, providing the required additional clock cycles.

Interesting. Wondering if this helps to improve mmc-spi.c case, which
abuses SPI protocol on the initialisation phase.

P.S> just noticed this change in the Git history of spi.c changes :-)

--
With Best Regards,
Andy Shevchenko