Le 27/11/2019 à 09:26, Linus Walleij a écrit :
On Tue, Nov 26, 2019 at 8:14 PM Christophe Leroy
<christophe.leroy@xxxxxx> wrote:
Digging a bit further, I see that devm_spi_register_master() fails in
spi_register_controler() because ctlr->num_chipselect is 0
Aha, I see what the problem is I think. The old code for mpc8xxx had this:
ngpios = of_gpio_count(np);
ngpios = max(ngpios, 0);
if (ngpios == 0 && !spisel_boot) {
/*
* SPI w/o chip-select line. One SPI device is still permitted
* though.
*/
pdata->max_chipselect = 1;
return 0;
}
(...)
master->num_chipselect = pdata->max_chipselect;
I confirm it can't be that .... here I get ngpios = 9
But the new code in the core has this:
nb = gpiod_count(dev, "cs");
However the above is likely the issue. The property in the DTS is
'gpios' and not 'cs-gpios'. According to commit e3023bf80639 ("gpio: of:
Handle the Freescale SPI CS"), it shouldn't be needed to rename it, and
that's also what I understand from commit log of 0f0581b24bd0 ("spi:
fsl: Convert to use CS GPIO descriptors")
ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect);
So it relied on inspecting the device tree and set this to 1
if it didn't find anything.
But it should find something.
Christophe
I will send a patch to test!
Is it worth testing your new patch ?
Christophe