diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 04d7322170c4a..69580f134b440 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -662,8 +662,12 @@ static int __spi_add_device(struct spi_device *spi) } if (ctlr->cs_gpiods) { - for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) - spi_set_csgpiod(spi, idx, ctlr->cs_gpiods[spi_get_chipselect(spi, idx)]); + for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) { + if (!(idx != 0 && !spi_get_chipselect(spi, idx))) { + printk("%s( ) [%d] cs[%d] = [%d]\n", __func__, __LINE__, idx, spi_get_chipselect(spi, idx)); + spi_set_csgpiod(spi, idx, ctlr->cs_gpiods[spi_get_chipselect(spi, idx)]); + } + } } /* @@ -988,6 +992,9 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force) u32 cs_num = __ffs(spi->cs_index_mask); int idx; + printk("%s( ) [%d] spi->cs_index_mask == [%d]\n", __func__, __LINE__, spi->cs_index_mask); + printk("%s( ) [%d] cs_num == [%d]\n", __func__, __LINE__, cs_num); + /* * In parallel mode all the chip selects are asserted/de-asserted * at once