On 06/30, Jonathan Cameron wrote: > On Sat, 29 Jun 2024 16:04:40 -0300 > Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> wrote: > > > The behavior of an SPI controller data output line (SDO or MOSI or COPI > > (Controller Output Peripheral Input) for disambiguation) is usually not > > specified when the controller is not clocking out data on SCLK edges. > > However, there do exist SPI peripherals that require specific MOSI line > > state when data is not being clocked out of the controller. > > > > Conventional SPI controllers may set the MOSI line on SCLK edges then bring > > it low when no data is going out or leave the line the state of the last > > transfer bit. More elaborated controllers are capable to set the MOSI idle > > state according to different configurable levels and thus are more suitable > > for interfacing with demanding peripherals. > > > > Add SPI mode bits to allow peripherals to request explicit MOSI idle state > > when needed. > > > > When supporting a particular MOSI idle configuration, the data output line > > state is expected to remain at the configured level when the controller is > > not clocking out data. When a device that needs a specific MOSI idle state > > is identified, its driver should request the MOSI idle configuration by > > setting the proper SPI mode bit. > > > > Acked-by: Nuno Sa <nuno.sa@xxxxxxxxxx> > > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> > > I always like to see some nice ascii art. Very nice documentation. > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c > > index 93f59ebb5b79..c8ba5e490850 100644 > > --- a/drivers/spi/spi.c > > +++ b/drivers/spi/spi.c > > > @@ -3950,6 +3956,7 @@ int spi_setup(struct spi_device *spi) > > */ > > bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD | > > SPI_NO_TX | SPI_NO_RX); > > + > > Trivial grumpy comment. Don't touch white space in unrelated code! Ouf, must have slipped through after messing around with spi_setup(). Didn't intend to add that. Fine if that can be removed when applying the patch. > > > ugly_bits = bad_bits & > > (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL | > > SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);