summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-01-16 03:21:08 -0500
committerMark Brown <broonie@kernel.org>2019-01-24 14:02:58 -0500
commit6e0a32d6f376ea22a34ae3a8df60adafbcdb0c86 (patch)
tree97abe4357d91d81169d11709a97bdc7834eb3c82
parent2df201e0067d84db5955d07cc0d7ccc3b7295aef (diff)
spi: dw: Fix default polarity of native chipselect
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 <jank@cadence.com> Reported-by: Jan Kotas <jank@cadence.com> Tested-by: Jan Kotas <jank@cadence.com> Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-dw.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 7092e58add2c..8abb94248d97 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -137,11 +137,10 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable)
137 struct dw_spi *dws = spi_controller_get_devdata(spi->controller); 137 struct dw_spi *dws = spi_controller_get_devdata(spi->controller);
138 struct chip_data *chip = spi_get_ctldata(spi); 138 struct chip_data *chip = spi_get_ctldata(spi);
139 139
140 /* Chip select logic is inverted from spi_set_cs() */
141 if (chip && chip->cs_control) 140 if (chip && chip->cs_control)
142 chip->cs_control(!enable); 141 chip->cs_control(enable);
143 142
144 if (!enable) 143 if (enable)
145 dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); 144 dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select));
146 else if (dws->cs_override) 145 else if (dws->cs_override)
147 dw_writel(dws, DW_SPI_SER, 0); 146 dw_writel(dws, DW_SPI_SER, 0);