From: Quentin Schulz <quentin.schulz@cherry.de>
To: Jonas Karlman <jonas@kwiboo.se>, Peng Fan <peng.fan@oss.nxp.com>
Cc: Tom Rini <trini@konsulko.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Peng Fan <peng.fan@nxp.com>, Ye Li <ye.li@nxp.com>,
Fabio Estevam <festevam@gmail.com>,
Dang Huynh <danct12@riseup.net>,
u-boot@lists.denx.de
Subject: Re: [PATCH] Revert "power: regulator: Add vin-supply for GPIO and Fixed regulators"
Date: Mon, 3 Nov 2025 12:03:40 +0100 [thread overview]
Message-ID: <cf561be1-08e8-4a89-8a04-90a1dfead19e@cherry.de> (raw)
In-Reply-To: <9039b700-16cf-44c9-8e32-dfdbe73f29b8@kwiboo.se>
On 11/3/25 11:36 AM, Jonas Karlman wrote:
> Hi Peng,
>
> On 11/3/2025 9:51 AM, Peng Fan wrote:
>> On Sat, Nov 01, 2025 at 08:34:26PM +0000, Jonas Karlman wrote:
>>> Rockchip boards may depend on a working MMC regulator in SPL to
>>> successfully load FIT payload from MMC. Typically, these boards only
>>> include the vmmc-supply regulator and not its vin-supply in SPL control
>>> FDT.
>>>
>>> The commit f98d812e5353 ("power: regulator: Add vin-supply for GPIO and
>>> Fixed regulators") breaks loading FIT from MMC in SPL on some of these
>>> boards due to now requiring the vin-supply to be included in the SPL
>>> control FDT.
>>>
>>> The commit also strangely enables any found vin-supply in
>>> regulator_common_of_to_plat() and not when a regulator is enabled or as
>>> part of regulator_autoset().
>>>
>>> Revert the commit to fix FIT loading in SPL on broken boards.
>>>
>>> If a board needs to have its vin-supply enabled, two options come to
>>> mind:
>>>
>>> - Add regulator-always-on prop to the regulator in the -u-boot.dtsi for
>>> any board.
>>>
>>> - Implement full support for reference counting of regulators and then
>>> update the regulator-uclass to enable any found vin-supply when a
>>> regulator is enabled.
>>>
>>> This reverts commit f98d812e5353408ef77a46bad1f1cdc793ff8a03.
>>>
>>> Reported-by: Dang Huynh <danct12@riseup.net>
>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>> ---
>>> drivers/power/regulator/regulator_common.c | 10 ----------
>>> drivers/power/regulator/regulator_common.h | 1 -
>>> 2 files changed, 11 deletions(-)
>>>
>>> diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
>>> index 3ed713ce5019..685d8735fa5c 100644
>>> --- a/drivers/power/regulator/regulator_common.c
>>> +++ b/drivers/power/regulator/regulator_common.c
>>> @@ -44,16 +44,6 @@ int regulator_common_of_to_plat(struct udevice *dev,
>>> dev_read_u32_default(dev, "u-boot,off-on-delay-us", 0);
>>> }
>>>
>>> - ret = device_get_supply_regulator(dev, "vin-supply", &plat->vin_supply);
>>> - if (ret) {
>>> - debug("Regulator vin regulator not defined: %d\n", ret);
>>> - if (ret != -ENOENT)
>>
>> I understand it might be not proper to enable vin-supply in
>> function regulator_common_of_to_plat().
>> But I have a question, there is -ENOENT check in the original patch. If the
>> board does not have vin-supply, there should be no issue. Or I miss something?
>
> As mentioned in the commit message the SPL control FDT does not contain
> the regulator references as a vin-supply, this result in -ENODEV to be
> returned. I.e. following where the vcc_io is not included in SPL control
> FDT.
>
> vcc_io: regulator@ {
> }
> vcc_sd: regulator@ {
> bootph-pre-ram;
> vin-supply = <&vcc_io>;
> }
> sdmmc: mmc@ {
> bootph-pre-ram;
> vmmc-supply = <&vcc_sd>;
> }
>
This needs to be fixed for SPL FDT for all impacted boards then
(Whenever the patch adding the enabling of vin-supply is resent). We
need the same bootph props for the node pointed at by vin-supply.
> With the change introduced in this commit the core gpio/fixed regulator
> behavior changed and this now result in unbootable boards.
>
> Other reasons why I prefer a full revert instead of a workaround:
> - The implementation changed core gpio/fixed regulator function without
> any review-by or acked-by.
> - The patch was quickly merged after only being on the list for 1 week,
> the imx pull-request that included this did not even mention regulator
> changes.
> - The implementation is not optimal, looking up vin-supply could be okay
> but not failing because it is missing, and enabling it during probe
If the property is missing, then we shouldn't fail of course, since the
property isn't required. If the property is there but it points to an
empty node, it should fail? Since the vin-supply could be one that needs
to do something (e.g. a gpio-regulator whose default state is off). If
it's there but cannot be probed (e.g. gpio-regulator but the gpio
controller of the enable GPIO isn't available in the stage), we should
fail as well.
> when we already have working enable count and regulator autoset to
> handle any needed auto-enable.
> - The commit message does not give any insights on why this is needed.
>
> My suggestion is that this is reverted and if needed it should can be
> submitted as a separated patch/series with a proper implementation.
>
Agreed.
1) vin-supply isn't a regulator property. It is a fixed-regulator and
gpio-regulator property so it should be handled in those drivers and not
in the function common to all regulator drivers,
2) Parsing the property and mapping in *_of_to_plat is fine, but
enabling should be done when enabling the regulator, not when parsing
the FDT,
Cheers,
Quentin
next prev parent reply other threads:[~2025-11-03 11:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-01 20:34 [PATCH] Revert "power: regulator: Add vin-supply for GPIO and Fixed regulators" Jonas Karlman
2025-11-01 21:15 ` Dragan Simic
2025-11-01 21:17 ` Mark Kettenis
2025-11-01 21:23 ` Dragan Simic
2025-11-02 2:00 ` Jonas Karlman
2025-11-02 7:54 ` Dragan Simic
2025-11-02 11:31 ` [PATCH] rockchip: remove regulator enable from device probe Brian Sune
2025-11-03 11:42 ` Sune Brian
2025-11-03 8:51 ` [PATCH] Revert "power: regulator: Add vin-supply for GPIO and Fixed regulators" Peng Fan
2025-11-03 10:36 ` Jonas Karlman
2025-11-03 11:03 ` Quentin Schulz [this message]
2025-11-07 7:31 ` Ye Li
2025-11-07 14:25 ` Jonas Karlman
2025-11-06 16:59 ` Tom Rini
-- strict thread matches above, loose matches on Subject: below --
2025-11-02 11:06 Sune Brian
2025-11-02 11:13 Sune Brian
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=cf561be1-08e8-4a89-8a04-90a1dfead19e@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=danct12@riseup.net \
--cc=festevam@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=jonas@kwiboo.se \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=ye.li@nxp.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