summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-cadence.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-01-16 03:21:09 -0500
committerMark Brown <broonie@kernel.org>2019-01-24 14:03:11 -0500
commit6046f5407ff031b7852ada18141238ce2fe70011 (patch)
tree9ee089b805a9ac4da95b91799454796a45cdc9d5 /drivers/spi/spi-cadence.c
parent6e0a32d6f376ea22a34ae3a8df60adafbcdb0c86 (diff)
spi: cadence: Fix default polarity of native chipselect
The Cadence 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. Fix this by inverting the logic in the callback for the native chip select. Rename the parameter from "is_high" (which is interpreted as being high when 0, which is confusing, I will not make any drug-related jokes here) to "enabled" which is more intuitive, especially now that it is true when CS is supposed to be enabled. Cc: Wei Yongjun <weiyongjun1@huawei.com> Fixes: cfeefa79dc37 ("spi: cadence: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-cadence.c')
-rw-r--r--drivers/spi/spi-cadence.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index 5036d89f46bb..43d0e79842ac 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -172,16 +172,16 @@ static void cdns_spi_init_hw(struct cdns_spi *xspi)
172/** 172/**
173 * cdns_spi_chipselect - Select or deselect the chip select line 173 * cdns_spi_chipselect - Select or deselect the chip select line
174 * @spi: Pointer to the spi_device structure 174 * @spi: Pointer to the spi_device structure
175 * @is_high: Select(0) or deselect (1) the chip select line 175 * @enable: Select (1) or deselect (0) the chip select line
176 */ 176 */
177static void cdns_spi_chipselect(struct spi_device *spi, bool is_high) 177static void cdns_spi_chipselect(struct spi_device *spi, bool enable)
178{ 178{
179 struct cdns_spi *xspi = spi_master_get_devdata(spi->master); 179 struct cdns_spi *xspi = spi_master_get_devdata(spi->master);
180 u32 ctrl_reg; 180 u32 ctrl_reg;
181 181
182 ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); 182 ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR);
183 183
184 if (is_high) { 184 if (!enable) {
185 /* Deselect the slave */ 185 /* Deselect the slave */
186 ctrl_reg |= CDNS_SPI_CR_SSCTRL; 186 ctrl_reg |= CDNS_SPI_CR_SSCTRL;
187 } else { 187 } else {