[PATCH 2/2] imx: power-domain: Enable refcounting on imx8mp
Neha Malcom Francis
n-francis at ti.com
Tue Jul 22 06:43:13 CEST 2025
Hi Frieder
On 21/07/25 21:31, Frieder Schrempf wrote:
> Hi Miquel,
>
> Am 25.04.25 um 08:49 schrieb Miquel Raynal:
>> Prevent enabling/disabling multiple times the same power domain to avoid
>> breakages due to the same power domains being referenced several times
>> by different device nodes.
>>
>> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
>
> I've stumbled upon some issue that seems to be related to this patch. I
> saw you already had to bother with other breakages of existing
> boards/platforms in the previous implementation. Unfortunately it looks
> like this still causes some kind of regression in my case.
>
> I'm working with an i.MX8MM board (kontron-sl-mx8mm_defconfig) and I see
> a crash as soon as I do "usb start" and then "usb stop" (log for the
> latter see below).
>
> As soon as I revert this patch everything starts to work fine again. Do
> you have any suggestions? The power-domains involved here are pgc_otg1
> and pgc_hsiomix defined in imx8mm.dtsi.
>
> Thanks
> Frieder
>
>
> => usb stop
> stopping USB..
> Sending event 6/(unknown) to spy 'efi_disk del'
> Sending event 6/(unknown) to spy 'efi_disk del'
> Looking for power-domain at 0
> Looking for power-domain at 0
> - checking gpc at 303a0000
> - checking power-domain at 0
> - result for power-domain at 0: power-domain at 0 (ret=0)
> - result for power-domain at 0: power-domain at 0 (ret=0)
> "Synchronous Abort" handler, esr 0x96000005, far 0x4ebacdc50
> elr: 0000000040249c94 lr : 0000000040249c6c (reloc)
> elr: 00000000fff4ec94 lr : 00000000fff4ec6c
> x0 : 0000000000000001 x1 : 00000000fbf22750
> x2 : 00000003efbab500 x3 : 00000000fffcdfb0
> x4 : 0000000000000020 x5 : 0000000000000020
> x6 : 00000000fbeea10f x7 : 00000000fbeea3d7
> x8 : 00000000fffffffe x9 : 00000000fbeea1ec
> x10: 00000000fbeea280 x11: 00000000ffffffd8
> x12: 00000000fbeeb1b0 x13: 00000000fbeeb1b0
> x14: 0000000000000002 x15: 0000000000000000
> x16: 00000000fff4edc4 x17: 0000000000000000
> x18: 00000000fbef4db0 x19: 00000004ebacdc50
> x20: 00000000fbeeace8 x21: 00000000fbf21ad0
> x22: 0000000000000000 x23: 0000000000000001
> x24: 0000000000000000 x25: 00000000fbf28f10
> x26: 0000000000000000 x27: 00000000fbf2ad40
> x28: 00000000fbf2ada0 x29: 00000000fbeeac70
>
> Code: f9400693 d37ef662 ab130833 54000140 (b8626820)
> Resetting CPU ...
>
>
>> ---
>> drivers/power/domain/imx8m-power-domain.c | 4 ++++
>> drivers/power/domain/imx8mp-hsiomix.c | 4 ++++
>> drivers/power/domain/imx8mp-mediamix.c | 4 ++++
>> 3 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c
>> index e54ba5d9a5476f678fb48fb16e7217b031acd78a..b44aae78e6de9733e1e53bbec80f54562487a76b 100644
>> --- a/drivers/power/domain/imx8m-power-domain.c
>> +++ b/drivers/power/domain/imx8m-power-domain.c
>> @@ -506,8 +506,12 @@ static int imx8m_power_domain_bind(struct udevice *dev)
>> static int imx8m_power_domain_probe(struct udevice *dev)
>> {
>> struct imx8m_power_domain_plat *pdata = dev_get_plat(dev);
>> + struct power_domain_plat *plat = dev_get_uclass_plat(dev);
>> int ret;
>>
>> + /* Every subdomain has its own device node */
>> + plat->subdomains = 1;
>> +
>> /* Nothing to do for non-"power-domain" driver instances. */
>> if (!strstr(dev->name, "power-domain"))
>> return 0;
>> diff --git a/drivers/power/domain/imx8mp-hsiomix.c b/drivers/power/domain/imx8mp-hsiomix.c
>> index 455ad53ef525e18ae45068fa5d8c2be8a1b79335..1ca43880ef56a03ae10e70f7e260022acc447dbb 100644
>> --- a/drivers/power/domain/imx8mp-hsiomix.c
>> +++ b/drivers/power/domain/imx8mp-hsiomix.c
>> @@ -201,8 +201,12 @@ int imx8mp_hsiomix_bind(struct udevice *dev)
>> static int imx8mp_hsiomix_probe(struct udevice *dev)
>> {
>> struct imx8mp_hsiomix_priv *priv = dev_get_priv(dev);
>> + struct power_domain_plat *plat = dev_get_uclass_plat(dev);
>> int ret;
>>
>> + /* Definitions are in imx8mp-power.h */
>> + plat->subdomains = 5;
Enabling LOG_DEBUG on drivers/power/domain/power-domain-uclass.c may
help further
Looks like setting of plat->subdomains needs updation? PD of HSIOMIX is
17 (plat->subdomains is 5?)
Looking at the numerous imx* devicetrees; plat->subdomains looks to be
very different across each platform so hardcoding it in the probe of the
power driver may not be a good idea I think?
>> +
>> priv->base = dev_read_addr_ptr(dev);
>>
>> ret = clk_get_by_name(dev, "usb", &priv->clk_usb);
>> diff --git a/drivers/power/domain/imx8mp-mediamix.c b/drivers/power/domain/imx8mp-mediamix.c
>> index 78c32ca3d3a87febdefd5d128d39d817674b8d32..504c22f7d3631363d76eb21e43afd854258d4ea5 100644
>> --- a/drivers/power/domain/imx8mp-mediamix.c
>> +++ b/drivers/power/domain/imx8mp-mediamix.c
>> @@ -143,9 +143,13 @@ static int imx8mp_mediamix_bind(struct udevice *dev)
>>
>> static int imx8mp_mediamix_probe(struct udevice *dev)
>> {
>> + struct power_domain_plat *plat = dev_get_uclass_plat(dev);
>> struct imx8mp_mediamix_priv *priv = dev_get_priv(dev);
>> int ret;
>>
>> + /* Definitions are in imx8mp-power.h */
>> + plat->subdomains = 9;
>> +
>> priv->base = dev_read_addr_ptr(dev);
>>
>> ret = clk_get_by_name(dev, "apb", &priv->clk_apb);
>>
>
--
Thanking You
Neha Malcom Francis
More information about the U-Boot
mailing list