spi: dw: Fix default polarity of native chipselect

Message ID 20190110212110.11395-1-linus.walleij@linaro.org
State New
Headers show
Series
  • spi: dw: Fix default polarity of native chipselect
Related show

Commit Message

Linus Walleij Jan. 10, 2019, 9:21 p.m.
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.

There are no in-kernel users of this native chip select
callback so the breakage only affected out-of-tree
code, but let's fix it.

Cc: Janek Kotas <jank@cadence.com>
Reported-by: Janek Kotas <jank@cadence.com>
Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Janek can you confirm if this solves your problem?
---
 drivers/spi/spi-dw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index f54b498001a9..bf4dfdd056f9 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -137,9 +137,8 @@  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)
 		dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select));