Skip to content

Commit

Permalink
pmdomain: bcm: bcm2835-power: check if the ASB register is equal to e…
Browse files Browse the repository at this point in the history
…nable

commit 2e75396 upstream.

The commit c494a44 ("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.

Fixes: c494a44 ("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]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mairacanal authored and gregkh committed Nov 28, 2023
1 parent bf5dd54 commit fc6e70a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pmdomain/bcm/bcm2835-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fc6e70a

Please sign in to comment.