[PATCH] imx: power-domain: enable parent power domain

Marek Vasut marex at denx.de
Sun Jan 29 02:46:36 CET 2023


On 1/28/23 23:14, Patrick Wildt wrote:
> The PCIe power domains are dependant on each other, which is why
> the device tree makes both PCIe controllers reference the PCIe1
> power domain, which then depends on the PCIe2 power domain.
> 
> Enabling the parent power domain used to be part of the driver,
> but got partially lost in the rewrite.  Add the enable call back
> to be able to power up PCIe2.
> 
> Signed-off-by: Patrick Wildt <patrick at blueri.se>
> ---
>   drivers/power/domain/imx8m-power-domain.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c
> index 145f6ec0cd..d8e9ce3291 100644
> --- a/drivers/power/domain/imx8m-power-domain.c
> +++ b/drivers/power/domain/imx8m-power-domain.c
> @@ -330,6 +330,9 @@ static int imx8m_power_domain_on(struct power_domain *power_domain)
>   	u32 pgc;
>   	int ret;
>   
> +	if (pdata->has_pd)
> +		power_domain_on(&pdata->pd);
> +
>   	if (pdata->clk.count) {
>   		ret = clk_enable_bulk(&pdata->clk);
>   		if (ret) {

One problem with this patch is that it does not turn the power domain 
back OFF in imx8m_power_domain_off().

However, the driver should not have to care about that. It is the uclass 
job to turn on any prerequisite power domains, which I believe happens in:

drivers/power/domain/power-domain-uclass.c
dev_power_domain_ctrl()

However, I suspect the code fails to recurse through more than one level 
of power domains and therefore doesn't enable the power domains all the 
way up the power domain tree. I also think this would be the fix -- 
recurse in dev_power_domain_ctrl() if there are upstream domains to 
enable, enable them in that recursive call, and then enable the current 
power domain using power_domain_on() .

Can you take a closer look at the uclass and the way it enables (or fail 
to) the upstream domains instead ?


More information about the U-Boot mailing list