Skip to content

Commit dbaca8e

Browse files
andy-shevbroonie
authored andcommitted
spi: Allow to have all native CSs in use along with GPIOs
The commit 7d93aec ("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: 7d93aec ("spi: Add generic support for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210420164425.40287-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0e793ba commit dbaca8e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/spi/spi.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,8 +2612,9 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr)
26122612
}
26132613

26142614
ctlr->unused_native_cs = ffz(native_cs_mask);
2615-
if (num_cs_gpios && ctlr->max_native_cs &&
2616-
ctlr->unused_native_cs >= ctlr->max_native_cs) {
2615+
2616+
if ((ctlr->flags & SPI_MASTER_GPIO_SS) && num_cs_gpios &&
2617+
ctlr->max_native_cs && ctlr->unused_native_cs >= ctlr->max_native_cs) {
26172618
dev_err(dev, "No unused native chip select available\n");
26182619
return -EINVAL;
26192620
}

0 commit comments

Comments
 (0)