diff options
| author | Andy Shevchenko <[email protected]> | 2021-04-20 16:44:24 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2021-04-21 14:49:53 +0000 |
| commit | dbaca8e56ea3f23fa215f48c2d46dd03ede06e02 (patch) | |
| tree | a640bb87b67a533803cb5f7dcea16b0d1c3471dc /drivers/spi/spi.c | |
| parent | spi: Make of_register_spi_device also set the fwnode (diff) | |
| download | kernel-dbaca8e56ea3f23fa215f48c2d46dd03ede06e02.tar.gz kernel-dbaca8e56ea3f23fa215f48c2d46dd03ede06e02.zip | |
spi: Allow to have all native CSs in use along with GPIOs
The commit 7d93aecdb58d ("spi: Add generic support for unused native cs
with cs-gpios") excludes the valid case for the controllers that doesn't
need to switch native CS in order to perform the transfer, i.e. when
0 native
... ...
<n> - 1 native
<n> GPIO
<n> + 1 GPIO
... ...
where <n> defines maximum of native CSs supported by the controller.
To allow this, bail out from spi_get_gpio_descs() conditionally for
the controllers which explicitly marked with SPI_MASTER_GPIO_SS.
Fixes: 7d93aecdb58d ("spi: Add generic support for unused native cs with cs-gpios")
Signed-off-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/spi.c')
| -rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 862a9bb69129..2e5dca20c8d0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2612,8 +2612,9 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr) } ctlr->unused_native_cs = ffz(native_cs_mask); - if (num_cs_gpios && ctlr->max_native_cs && - ctlr->unused_native_cs >= ctlr->max_native_cs) { + + if ((ctlr->flags & SPI_MASTER_GPIO_SS) && num_cs_gpios && + ctlr->max_native_cs && ctlr->unused_native_cs >= ctlr->max_native_cs) { dev_err(dev, "No unused native chip select available\n"); return -EINVAL; } |
