From: Marek Vasut via U-Boot <u-boot@lists.u-boot-project.org>
To: Ralph Siemsen <ralph.siemsen@linaro.org>
Cc: u-boot@lists.u-boot-project.org, Tom Rini <trini@konsulko.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: Re: [PATCH v2] gpio: dwapb_gpio: Enable all clocks
Date: Sun, 16 Aug 2026 13:32:36 +0200 [thread overview]
Message-ID: <6c19074c-3372-4631-8985-a45f33cbbebc@mailbox.org> (raw)
In-Reply-To: <aoByMCnVSX_GyuU5@maple.netwinder.org>
On 8/15/26 4:05 PM, Ralph Siemsen wrote:
> On Sat, Aug 15, 2026 at 12:05:55AM +0200, Marek Vasut wrote:
>> On 8/14/26 8:29 PM, Ralph Siemsen wrote:
>>
>> [...]
>>
>>> @@ -132,12 +134,34 @@ static int gpio_dwapb_reset(struct udevice *dev)
>>> return 0;
>>> }
>>> +static int gpio_dwapb_enable_optional_clocks(struct udevice *dev)
>>> +{
>>> + struct gpio_dwapb_priv *priv = dev_get_priv(dev);
>>> + int ret;
>>> +
>>> + ret = clk_get_bulk(dev, &priv->clks);
>>> + if (ret) {
>>> + /* Clocks are optional */
>>> + if (ret != -ENOENT)
>>> + dev_err(dev, "Failed to get clocks: %d\n", ret);
>>> + return ret;
>>> + }
>>> +
>>> + ret = clk_enable_bulk(&priv->clks);
>>> + if (ret)
>>> + dev_err(dev, "Failed to enable clocks: %d\n", ret);
>>> +
>>> + return ret;
>>> +}
>>> +
>>> static int gpio_dwapb_probe(struct udevice *dev)
>>> {
>>> struct gpio_dev_priv *priv = dev_get_uclass_priv(dev);
>>> struct gpio_dwapb_plat *plat = dev_get_plat(dev);
>>> if (!plat) {
>>> + gpio_dwapb_enable_optional_clocks(dev);
>
>> Error is not propagated from this call.
>
> This was intentional. All existing users work without explicitly
> enabling the clock. They probably do it in board specific code, or in a
> previous boot stage.
ENOENT (clock not found) is fine to convert to 0 and return that 0 to
cover such cases. Other errors (e.g. ENOMEM?) should be propagated.
> While adding clk_enable() should be harmless, what if it fails on some
> of the existing boards? I would rather not break them, this can be quite
> hard to debug.
If the users care and test, the error will get found and fixed. Else,
apply best effort, sigh.
>> Fail path that would disable the clock is missing in this function.
>
> Okay, I can add this.
Thank you
prev parent reply other threads:[~2026-08-16 23:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 18:29 [PATCH v2] gpio: dwapb_gpio: Enable all clocks Ralph Siemsen
2026-08-14 22:05 ` Marek Vasut via U-Boot
2026-08-15 14:05 ` Ralph Siemsen
2026-08-16 11:32 ` Marek Vasut via U-Boot [this message]
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=6c19074c-3372-4631-8985-a45f33cbbebc@mailbox.org \
--to=u-boot@lists.u-boot-project.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marek.vasut@mailbox.org \
--cc=ralph.siemsen@linaro.org \
--cc=trini@konsulko.com \
/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