power: domain: ti: fix ti_pd_get() to return after verifying transition
PATCH v2 1/1 power: domain: ti: fix ti_pd_get() to return after verifying transition
The helper function "ti_pd_get()" is responsible for powering on a domain if it is powered off. In the current implementation, if a power domain is determined to be powered off - no prior users and the PDCTL register indicates that the user desired state is OFF, then powering on the domain constitutes setting 'PDCTL_STATE_ON' field of the PDCTL register.
While the current implementation indeed requests the power domain to be transition to the ON state, the helper function "ti_pd_get()" doesn't verify that the power domain has 'transitioned' to the ON state before returning to its caller. As a result, it is possible that the device(s) belonging to the power domain may be accessed before it is truly powered on, leading to a bus abort.
Fix this by waiting for the power domain to transition to the ON state by using "ti_pd_wait()" before returning from "ti_pd_get()".
---
Hello,
This patch is based on commit6c2f2d9aa63 Merge branch 'master' of git://source.denx.de/u-boot-usb
of the master branch of Mainline U-Boot.
v1 of this patch is at:
https://lore.kernel.org/r/[email protected]/
Changes since v1:
- Replaced the following:
+ ret = ti_pd_wait(psc_pd); + if (ret) + return ret; + return 0;
with:
return ti_pd_wait(psc_pd);
- Updated the last paragraph of commit message by mentioning "ti_pd_wait()".
Regards,
Siddharth.
drivers/power/domain/ti-power-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/domain/ti-power-domain.c +1 -1
@@ -227,7 +227,7 @@ static int ti_pd_get(struct ti_pd *pd)pd_write (pdctl, pd,PSC_PDCTL ); -return 0 ; +return ti_pd_wait (psc_pd); }static int ti_pd_put (struct ti_pd *pd)
Signature · 1 line
2.51.1
On Fri, 2025-11-14 at 20:32 +0530, Siddharth Vadapalli wrote:
Kindly ignore this patch. I will post the v3 patch including the test logs on the platforms implementing PCIe Boot (this patch is required for such platforms to avoid waiting for 1 millisecond after a power-on request).
Regards,
Siddharth.
Quoted 60 lines
The helper function "
ti_pd_get()" is responsible for powering on a domain if it is powered off. In the current implementation, if a power domain is determined to be powered off - no prior users and the PDCTL register indicates that the user desired state is OFF, then powering on the domain constitutes setting 'PDCTL_STATE_ON' field of the PDCTL register.While the current implementation indeed requests the power domain to be transition to the ON state, the helper function "
ti_pd_get()" doesn't verify that the power domain has 'transitioned' to the ON state before returning to its caller. As a result, it is possible that the device(s) belonging to the power domain may be accessed before it is truly powered on, leading to a bus abort.Fix this by waiting for the power domain to transition to the ON state by using "
ti_pd_wait()" before returning from "ti_pd_get()".Fixes 144464bd2c67 ("power: domain: Introduce driver for raw TI K3 PDs")Signed-off-by Siddharth Vadapalli <[email protected]>---
Hello,
This patch is based on commit
6c2f2d9aa63Merge branch 'master' ofgit://source.denx.de/u-boot-usb
of the master branch of Mainline U-Boot.v1 of this patch is at:
https://lore.kernel.org/r/[email protected]/
Changes since v1:
- Replaced the following:+ ret = ti_pd_wait(psc_pd); + if (ret) + return ret; + return 0;with:
returnti_pd_wait(psc_pd);
- Updated the last paragraph of commit message by mentioning "ti_pd_wait()".Regards,
Siddharth.drivers/power/domain/ti-power-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/domain/ti-power-domain.c +1
-1@@ -227,7 +227,7 @@ static int ti_pd_get(struct ti_pd *pd)pd_write (pdctl, pd,PSC_PDCTL ); -return 0 ; +return ti_pd_wait (psc_pd); }static int ti_pd_put (struct ti_pd *pd)