All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Jan Kiszka <jan.kiszka@web.de>, Linus Walleij <linus.walleij@linaro.org>
Cc: Phil Elwell <phil@raspberrypi.com>,
	devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	linux-gpio@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	Thierry Reding <treding@nvidia.com>
Subject: Re: [PATCH v2 1/2] pinctrl: bcm2835: Change init order for gpio hogs
Date: Sun, 2 Jan 2022 13:33:28 +0100	[thread overview]
Message-ID: <ec60b52b-7a59-266d-9608-11c0da9053a6@i2se.com> (raw)
In-Reply-To: <ec8090b6-6c91-e9ae-fd02-955c8c10ee3e@web.de>

Hi Jan,

Am 02.01.22 um 12:02 schrieb Jan Kiszka:
> On 02.01.22 07:54, Linus Walleij wrote:
>> On Wed, Dec 29, 2021 at 8:07 PM Stefan Wahren <stefan.wahren@i2se.com> wrote:
>>> Am 10.12.21 um 00:24 schrieb Linus Walleij:
>>>> On Mon, Dec 6, 2021 at 10:22 AM Phil Elwell <phil@raspberrypi.com> wrote:
>>>>
>>>>> ...and gpio-ranges
>>>>>
>>>>> pinctrl-bcm2835 is a combined pinctrl/gpio driver. Currently the gpio
>>>>> side is registered first, but this breaks gpio hogs (which are
>>>>> configured during gpiochip_add_data). Part of the hog initialisation
>>>>> is a call to pinctrl_gpio_request, and since the pinctrl driver hasn't
>>>>> yet been registered this results in an -EPROBE_DEFER from which it can
>>>>> never recover.
>>>>>
>>>>> Change the initialisation sequence to register the pinctrl driver
>>>>> first.
>>>>>
>>>>> This also solves a similar problem with the gpio-ranges property, which
>>>>> is required in order for released pins to be returned to inputs.
>>>>>
>>>>> Fixes: 73345a18d464b ("pinctrl: bcm2835: Pass irqchip when adding gpiochip")
>>>>> Signed-off-by: Phil Elwell <phil@raspberrypi.com>
>>>> This patch (1/2) applied for fixes.
>>> Unfortunately this change breaks all GPIO LEDs at least on the Raspberry
>>> Pi 3 Plus (Linux 5.16-rc7, multi_v7_defconfig). The ACT LED for instance
>>> stays in the last state instead of the configured heartbeat behavior.
>>> Also there are no GPIO LEDs in /sys/class/leds/ directory.
>>>
>>> After reverting this change everything is back to normal.
>> Oh what a mess. OK I reverted the fix.
>>
> I happened to debug this regression as well: The issue of the patch
> seems to be that it initializes gpio_range.base with -1, because
> gpio_chip.base is not yet set at this point. Maybe that can be achieved
> differently, to please all cases.

thanks for the hint.

I tried to reproduce the original issue with the gpio hog by adding one
to the RPi Zero W. Here are my test results of this series based on
Linux 5.16:

1. - Patch 1 & 2 not applied: boot hangs caused by gpio hog
2. - Patch 1 applied, Patch 2 not applied: boot hangs caused by gpio hog
3. - Patch 1 not applied, Patch 2 applied: boot hangs caused by gpio hog
4. - Patch 1 & 2 applied: boot ok, LEDs okay, hog okay

So both patches must be applied at the same time. In general this is
done via immutable branch. But this requires caution while backporting.

Best regards

>
> Jan


  reply	other threads:[~2022-01-02 12:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  9:22 [PATCH v2 0/2] pinctrl: bcm2835: Fix gpio hogs and pin reinitialisation Phil Elwell
2021-12-06  9:22 ` [PATCH v2 1/2] pinctrl: bcm2835: Change init order for gpio hogs Phil Elwell
2021-12-07 18:32   ` Florian Fainelli
2021-12-09 23:24   ` Linus Walleij
2021-12-29 19:07     ` Stefan Wahren
2021-12-29 21:11       ` Florian Fainelli
2022-01-02  6:54       ` Linus Walleij
2022-01-02 11:02         ` Jan Kiszka
2022-01-02 12:33           ` Stefan Wahren [this message]
2022-01-02 15:12             ` Jan Kiszka
2022-01-02 15:16               ` Jan Kiszka
2022-01-04 17:04                 ` Linus Walleij
2021-12-06  9:22 ` [PATCH v2 2/2] ARM: dts: gpio-ranges property is now required Phil Elwell
2021-12-06 10:33   ` Linus Walleij
2021-12-06 17:24     ` Florian Fainelli
2021-12-07 15:29       ` Linus Walleij
2021-12-10 11:12     ` nicolas saenz julienne
     [not found]   ` <CGME20211214142139eucas1p1c100b7fd4b8c8ce85bc03e1ce6b783db@eucas1p1.samsung.com>
2021-12-14 14:21     ` Marek Szyprowski
2021-12-14 14:32       ` Phil Elwell
2021-12-14 17:12         ` Florian Fainelli
2021-12-15  9:02           ` nicolas saenz julienne
2021-12-15 17:14             ` Florian Fainelli
2021-12-16  3:27               ` Linus Walleij
2021-12-16  3:28                 ` Florian Fainelli
2021-12-16  3:31                   ` Linus Walleij
2021-12-16  8:28                     ` nicolas saenz julienne
2021-12-15 17:15   ` Florian Fainelli

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=ec60b52b-7a59-266d-9608-11c0da9053a6@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jan.kiszka@web.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=robh+dt@kernel.org \
    --cc=treding@nvidia.com \
    --subject='Re: [PATCH v2 1/2] pinctrl: bcm2835: Change init order for gpio hogs' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.