Skip to content
/ linux Public

Commit 18605b1

Browse files
mairacanalgregkh
authored andcommitted
pmdomain: bcm: bcm2835-power: Increase ASB control timeout
commit b826d2c upstream. The bcm2835_asb_control() function uses a tight polling loop to wait for the ASB bridge to acknowledge a request. During intensive workloads, this handshake intermittently fails for V3D's master ASB on BCM2711, resulting in "Failed to disable ASB master for v3d" errors during runtime PM suspend. As a consequence, the failed power-off leaves V3D in a broken state, leading to bus faults or system hangs on later accesses. As the timeout is insufficient in some scenarios, increase the polling timeout from 1us to 5us, which is still negligible in the context of a power domain transition. Also, replace the open-coded ktime_get_ns()/ cpu_relax() polling loop with readl_poll_timeout_atomic(). Cc: stable@vger.kernel.org Fixes: 670c672 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.") Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5ed633b commit 18605b1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/pmdomain/bcm/bcm2835-power.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/clk.h>
1010
#include <linux/delay.h>
1111
#include <linux/io.h>
12+
#include <linux/iopoll.h>
1213
#include <linux/mfd/bcm2835-pm.h>
1314
#include <linux/module.h>
1415
#include <linux/platform_device.h>
@@ -152,7 +153,6 @@ struct bcm2835_power {
152153
static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable)
153154
{
154155
void __iomem *base = power->asb;
155-
u64 start;
156156
u32 val;
157157

158158
switch (reg) {
@@ -165,8 +165,6 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
165165
break;
166166
}
167167

168-
start = ktime_get_ns();
169-
170168
/* Enable the module's async AXI bridges. */
171169
if (enable) {
172170
val = readl(base + reg) & ~ASB_REQ_STOP;
@@ -175,11 +173,9 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
175173
}
176174
writel(PM_PASSWORD | val, base + reg);
177175

178-
while (!!(readl(base + reg) & ASB_ACK) == enable) {
179-
cpu_relax();
180-
if (ktime_get_ns() - start >= 1000)
181-
return -ETIMEDOUT;
182-
}
176+
if (readl_poll_timeout_atomic(base + reg, val,
177+
!!(val & ASB_ACK) != enable, 0, 5))
178+
return -ETIMEDOUT;
183179

184180
return 0;
185181
}

0 commit comments

Comments
 (0)