pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable
Subsystems (3)
PATCH v3 1/1 pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable
The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control") refactored the ASB control by using a general function to handle both the enable and disable. But this patch introduced a subtle regression:
we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just check if (readl(base + reg) & ASB_ACK) == true.
Currently, this is causing an invalid register state in V3D when unloading and loading the driver, because bcm2835_asb_disable() will return -ETIMEDOUT and bcm2835_asb_power_off() will fail to disable the ASB slave for V3D.
[v2]:
* Use the !! operator to assure the correct assertion (Stefan Wahren)
[v3]:
* Include a changelog (Stefan Wahren)
* Include Florian's and Stefan's Reviewed-by
--- drivers/pmdomain/bcm/bcm2835-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pmdomain/bcm/bcm2835-power.c +1 -1
@@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable }writel (PM_PASSWORD | val, base + reg); -while (readl (base + reg) &ASB_ACK ) { +while (!!(readl (base + reg) &ASB_ACK ) == enable) {cpu_relax ();if (ktime_get_ns () - start >=1000 )return -ETIMEDOUT ;
--
2.41.0
Quoted 12 lines · Maíra Canal
The commit
c494a447c14e("soc: bcm: bcm2835-power: Refactor ASB control") refactored the ASB control by using a general function to handle both the enable and disable. But this patch introduced a subtle regression:
we need to check if !!(readl(base + reg) &ASB_ACK) == enable, not just check if (readl(base + reg) &ASB_ACK) == true.Currently, this is causing an invalid register state in V3D when unloading and loading the driver, because
bcm2835_asb_disable()will return-ETIMEDOUTandbcm2835_asb_power_off()will fail to disable the ASB slave for V3D.
Quoted 6 lines
[v2]:
* Use the !! operator to assure the correct assertion (Stefan Wahren)[v3]:
* Include a changelog (Stefan Wahren)
* Include Florian's and Stefan's Reviewed-by
The version information belongs a few lines below.
Quoted 5 lines
Fixes c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")Signed-off-by Maíra Canal <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Reviewed-by Stefan Wahren <[email protected]>
No need to resend this time. I have amended the patch to remove the version information from the commit message, applied it for fixes and added a stable tag!
Kind regards
Uffe
Quoted 1 line
---
This is where you manually need to edit the format patch-file to add the version information.
End the section with three dashes and a newline, like below:
---
Quoted 19 lines
drivers/pmdomain/bcm/bcm2835-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pmdomain/bcm/bcm2835-power.c +1
-2@@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable }writel (PM_PASSWORD | val, base + reg); -while (readl (base + reg) &ASB_ACK ) { +while (!!(readl (base + reg) &ASB_ACK ) == enable) {cpu_relax ();if (ktime_get_ns () - start >=1000 )return -ETIMEDOUT ; --2.41.0