From 4095b88c0655a3160a5129212882b6072048fa24 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 16 Jan 2019 09:21:08 +0100 Subject: [PATCH] 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 Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij Signed-off-by: Mark Brown Signed-off-by: Zou Cao Reviewed-by: Baoyou Xie --- drivers/spi/spi-dw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index c854278e3b3e..1c9f36050588 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -137,12 +137,11 @@ 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)); + if (enable) + dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); } EXPORT_SYMBOL_GPL(dw_spi_set_cs); -- GitLab