Messages in this thread | | | From | Andy Shevchenko <> | Date | Tue, 10 Nov 2020 18:31:28 +0200 | Subject | Re: [PATCH net v2] net: phy: spi_ks8995: Do not overwrite SPI mode flags |
| |
On Tue, Nov 10, 2020 at 4:20 PM Sven Van Asbroeck <thesven73@gmail.com> wrote: > > From: Sven Van Asbroeck <thesven73@gmail.com> > > This driver makes sure the underlying SPI bus is set to "mode 0" > by assigning SPI_MODE_0 to spi->mode. Which overwrites all other > SPI mode flags. > > In some circumstances, this can break the underlying SPI bus driver. > For example, if SPI_CS_HIGH is set on the SPI bus, the driver > will clear that flag, which results in a chip-select polarity issue. > > Fix by changing only the SPI_MODE_N bits, i.e. SPI_CPHA and SPI_CPOL.
I see that this is a fix for backporing, but maybe you can send a patches on top of this to: 1) introduce #define SPI_MODE_MASK (SPI_CPHA | SPI_CPOL)
> + /* use SPI_MODE_0 without changing any other mode flags */ > + spi->mode &= ~(SPI_CPHA | SPI_CPOL);
2) spi->mode &= ~SPI_MODE_MASK;
> + spi->mode |= SPI_MODE_0;
?
-- With Best Regards, Andy Shevchenko
| |