Skip to content

Commit

Permalink
spi: dw: Fix default polarity of native chipselect
Browse files Browse the repository at this point in the history
The DW controller also supports platforms specifying
native chipselects. When I enforce the use of high CS
for drivers opting in for using GPIO descriptors, I
inadvertedly switched the driver to also use active
high chip select for native chip selects.

As it turns out, the DW hardware driving chip selects
also thinks it is weird with active low chip selects
so all we need to do is remove an inversion in the
driver.

Cc: Jan Kotas <[email protected]>
Reported-by: Jan Kotas <[email protected]>
Tested-by: Jan Kotas <[email protected]>
Fixes: 9400c41 ("spi: dw: Convert to use CS GPIO descriptors")
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
linusw authored and broonie committed Jan 24, 2019
1 parent 2df201e commit 6e0a32d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/spi/spi-dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable)
struct dw_spi *dws = spi_controller_get_devdata(spi->controller);
struct chip_data *chip = spi_get_ctldata(spi);

/* Chip select logic is inverted from spi_set_cs() */
if (chip && chip->cs_control)
chip->cs_control(!enable);
chip->cs_control(enable);

if (!enable)
if (enable)
dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select));
else if (dws->cs_override)
dw_writel(dws, DW_SPI_SER, 0);
Expand Down

0 comments on commit 6e0a32d

Please sign in to comment.