Skip to content

Commit 6e0a32d

Browse files
Linus Walleijbroonie
authored andcommitted
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: 9400c41 ("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>
1 parent 2df201e commit 6e0a32d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/spi/spi-dw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable)
137137
struct dw_spi *dws = spi_controller_get_devdata(spi->controller);
138138
struct chip_data *chip = spi_get_ctldata(spi);
139139

140-
/* Chip select logic is inverted from spi_set_cs() */
141140
if (chip && chip->cs_control)
142-
chip->cs_control(!enable);
141+
chip->cs_control(enable);
143142

144-
if (!enable)
143+
if (enable)
145144
dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select));
146145
else if (dws->cs_override)
147146
dw_writel(dws, DW_SPI_SER, 0);

0 commit comments

Comments
 (0)