summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-01-16 09:21:07 +0100
committerMark Brown <broonie@kernel.org>2019-01-24 19:01:05 +0000
commit2df201e0067d84db5955d07cc0d7ccc3b7295aef (patch)
treeec7b2f507f4207795f644f607acf55dbe8ef80ca /drivers/spi
parentf0125f1a559be1033055f44e511174aaa75b60cc (diff)
downloadlwn-2df201e0067d84db5955d07cc0d7ccc3b7295aef.tar.gz
lwn-2df201e0067d84db5955d07cc0d7ccc3b7295aef.zip
spi: Support high CS when using descriptors
All controllers using GPIO descriptors can by definition support high CS connections, so just enforce this when registering an SPI controller. This fixes a regression where controllers were missing SPI_CS_HIGH, the drivers would fail like this: spi spi0.0: setup: unsupported mode bits 4 cdns-spi fd0b0000.spi: can't setup spi0.0, status -22 This is because as using descriptors moves the CS inversion logic over to gpiolib, all such controllers are registered with CS active high. Cc: Jan Kotas <jank@cadence.com> Reported-by: Jan Kotas <jank@cadence.com> Tested-by: Jan Kotas <jank@cadence.com> Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 13f447a67d67..0e0f2c62973c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2279,6 +2279,11 @@ int spi_register_controller(struct spi_controller *ctlr)
status = spi_get_gpio_descs(ctlr);
if (status)
return status;
+ /*
+ * A controller using GPIO descriptors always
+ * supports SPI_CS_HIGH if need be.
+ */
+ ctlr->mode_bits |= SPI_CS_HIGH;
} else {
/* Legacy code path for GPIOs from DT */
status = of_spi_register_master(ctlr);