From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-spi <linux-spi@vger.kernel.org>,
Mark Brown <broonie@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: Boot failure with 5.4-rc5, bisected to 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
Date: Wed, 27 Nov 2019 13:04:54 +0100 [thread overview]
Message-ID: <748eb503-b692-6d30-bc5e-94539a939b06@c-s.fr> (raw)
In-Reply-To: <CACRpkdaKg45uHMZ9mz6OGkAUqYX7GzhTrjrAc1feVhn68ZXrqg@mail.gmail.com>
Le 27/11/2019 à 11:55, Linus Walleij a écrit :
> On Wed, Nov 27, 2019 at 11:39 AM Christophe Leroy
> <christophe.leroy@c-s.fr> wrote:
>> Le 27/11/2019 à 11:02, Linus Walleij a écrit :
>>> On Wed, Nov 27, 2019 at 10:34 AM Christophe Leroy
>>> <christophe.leroy@c-s.fr> 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:
That's it. ->use_gpio_descriptors isn't set for the FSL driver:
[root@po16098vm linux-powerpc]# git grep use_gpio_descriptors drivers/spi/
drivers/spi/spi-ath79.c: master->use_gpio_descriptors = true;
drivers/spi/spi-atmel.c: master->use_gpio_descriptors = true;
drivers/spi/spi-bcm2835.c: * as the flag use_gpio_descriptors enforces
SPI_CS_HIGH.
drivers/spi/spi-bcm2835.c: ctlr->use_gpio_descriptors = true;
drivers/spi/spi-cadence.c: master->use_gpio_descriptors = true;
drivers/spi/spi-clps711x.c: master->use_gpio_descriptors = true;
drivers/spi/spi-davinci.c: master->use_gpio_descriptors = true;
drivers/spi/spi-dw.c: master->use_gpio_descriptors = true;
drivers/spi/spi-ep93xx.c: master->use_gpio_descriptors = true;
drivers/spi/spi-gpio.c: master->use_gpio_descriptors = true;
drivers/spi/spi-sh-msiof.c: ctlr->use_gpio_descriptors = true;
drivers/spi/spi-tegra114.c: master->use_gpio_descriptors = true;
drivers/spi/spi.c: if (ctlr->use_gpio_descriptors)
drivers/spi/spi.c: if (ctlr->use_gpio_descriptors) {
I have now added it, together with the DTS cs-gpios name change (without
your counting patch with crashes), and I get something which is almost
working: I get temperature back into sensors, but temperature is 0°C !!!
root@vgoip:~# sensors
lm74-spi-0-5
Adapter: SPI adapter
Temperature processeur: +0.0 C
lm74-spi-0-1
Adapter: SPI adapter
Temperature MIAE: +0.0 C
Looking into dmesg, I see:
[ 3.153521] lm74@1 GPIO handle specifies active low - ignored
[ 3.178093] lm74@5 GPIO handle specifies active low - ignored
Any link with the problem ?
Christophe
>
> 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
>
next prev parent reply other threads:[~2019-11-27 12:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 12:33 Boot failure with 5.4-rc5, bisected to 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") Christophe Leroy
2019-11-08 13:09 ` Linus Walleij
2019-11-08 13:34 ` Christophe Leroy
2019-11-26 15:01 ` Christophe Leroy
2019-11-26 15:35 ` Fabio Estevam
2019-11-26 16:16 ` Christophe Leroy
2019-11-26 16:23 ` Mark Brown
2019-11-26 15:48 ` Linus Walleij
2019-11-26 19:08 ` Christophe Leroy
2019-11-26 19:14 ` Christophe Leroy
2019-11-27 8:26 ` Linus Walleij
2019-11-27 8:57 ` Christophe Leroy
2019-11-27 9:07 ` Christophe Leroy
2019-11-27 9:11 ` Linus Walleij
2019-11-27 9:34 ` Christophe Leroy
2019-11-27 10:02 ` Linus Walleij
2019-11-27 10:39 ` Christophe Leroy
2019-11-27 10:55 ` Linus Walleij
2019-11-27 12:04 ` Christophe Leroy [this message]
2019-11-27 13:00 ` Linus Walleij
2019-11-27 13:44 ` Christophe Leroy
2019-11-27 13:52 ` Linus Walleij
2019-11-27 13:54 ` Christophe Leroy
2019-11-27 13:56 ` Linus Walleij
2019-11-27 14:29 ` Christophe Leroy
2019-11-28 8:42 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=748eb503-b692-6d30-bc5e-94539a939b06@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).