On Wed, Nov 27, 2019 at 11:39 AM Christophe Leroy <christophe.leroy@xxxxxx> wrote: > Le 27/11/2019 à 11:02, Linus Walleij a écrit : > > On Wed, Nov 27, 2019 at 10:34 AM Christophe Leroy > > <christophe.leroy@xxxxxx> wrote: > > > >> In the meantime, I have tried changing "gpios" by "cs-gpios" in the > >> device tree, and I get the following warning: > > (...) > >> [ 3.156654] WARNING: CPU: 0 PID: 1 at drivers/spi/spi-fsl-spi.c:716 > >> fsl_spi_cs_control+0x64/0x7c > > > > That should be this one: > > > > if (WARN_ON_ONCE(!pinfo->immr_spi_cs)) > > return; > > > > That happens when spi->cs_gpiod is NULL so the > > chipselect isn't found and assigned, and the code > > goes on to check the native CS and find that this isn't > > available either and issues the warning. > > That's in spi_add_device(), it is spi->cs_gpio and not spi->cs_gpiod > which is assigned, so spi->cs_gpiod remains NULL. That's weird, because when ->use_gpio_descriptors is set (as for this driver) the core only attempts to look up spi->cs_gpiods and not spi->cs_gpios, and consequently can only assign spi->cd_gpiod and not spi->cs_gpio: if (ctlr->use_gpio_descriptors) { status = spi_get_gpio_descs(ctlr); (...) } else { (....) status = of_spi_get_gpio_numbers(ctlr); } (...) /* Descriptors take precedence */ if (ctlr->cs_gpiods) spi->cs_gpiod = ctlr->cs_gpiods[spi->chip_select]; else if (ctlr->cs_gpios) spi->cs_gpio = ctlr->cs_gpios[spi->chip_select]; So I'm a bit confused... Yours, Linus Walleij