Re: [PATCH v3 1/6] spi: Add SPI mode bit for MOSI idle state configuration
From: Marcelo Schmitt
Date: Fri Jun 07 2024 - 11:00:37 EST
On 06/07, Mark Brown wrote:
> On Thu, Jun 06, 2024 at 04:57:52PM -0300, Marcelo Schmitt wrote:
>
> > As far as I searched, the definitions for SPI protocol usually don't specify any
> > behavior for the MOSI line when the controller is not clocking out data.
> > So, I think SPI controllers that are not capable of implementing any type
> > of MOSI idle configuration are anyway compliant to what is usual SPI.
> > For those that can implement such feature, I thought peripherals could request
> > it by setting SPI mode bits.
>
> The issue here is the one that Richard highlighted with it not being
> clear exactly what the intended behaviour is.
>
> > But yeah, it's not that evident what this patch set is all about and why this is
> > wanted so I made a wiki page to explain the reasoning for this set.
> > https://wiki.analog.com/software/linux/docs/spi/spi_copi_idle?rev=1717699755
> > Hopefully the figures with timing diagrams and transfer captures there will
> > provide quicker understanding of this rather than I try to explain it with
> > only text.
>
> It needs to be apparent to someone looking at the kernel what the code
> is intended to do.
Ack
>
> > If you still think we need feature detection for MOSI idle capability just let
> > me know, I'll implement what be needed.
>
> If the devices actually require this mode then we can't just randomly
> ignore them when they request it.
Ok. Yes, when connected in that datasheet "3-wire" mode the MOSI idle high
feature is pretty much required otherwise users won't be able to sample the ADC.
Will document the behavior for the MOSI idle feature and make spi_setup() fail
with better message if the controller can't support a device requesting it.
Thanks,
Marcelo