Skip to contentSkip to conversation

watchdog: apple: Increase reset delay to 150ms

PATCH RESEND Superseded Nick Chan 2 participants 2 messages Sep 30, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nick Chan

author
#0 lore raw

PATCH RESEND 1/1 watchdog: apple: Increase reset delay to 150ms

The Apple A8X SoC seems to be slowest at resetting, taking up to around 125ms to reset. Wait 150ms to be safe here.

---
 drivers/watchdog/apple_wdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/watchdog/apple_wdt.c +3 -3
index d4f739932f0b..353ecf0b04dc 100644
@@ -127,11 +127,11 @@ static int apple_wdt_restart(struct watchdog_device *wdd, unsigned long mode,
 	/*
 	 * Flush writes and then wait for the SoC to reset. Even though the
 	 * reset is queued almost immediately experiments have shown that it
-	 * can take up to ~20-25ms until the SoC is actually reset. Just wait
-	 * 50ms here to be safe.
+	 * can take up to ~120-125ms until the SoC is actually reset. Just
+	 * wait 150ms here to be safe.
 	 */
 	(void)readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME);
-	mdelay(50);
+	mdelay(150);
 
 	return 0;
 }

base-commit: cea5425829f77e476b03702426f6b3701299b925

Signature · 1 line
2.46.0
#1 lore raw
Quoted 17 lines · Nick Chan

The Apple A8X SoC seems to be slowest at resetting, taking up to around 125ms to reset. Wait 150ms to be safe here.

---
 drivers/watchdog/apple_wdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/watchdog/apple_wdt.c +0 -0
index d4f739932f0b..353ecf0b04dc 100644
@@ -127,11 +127,11 @@ static int apple_wdt_restart(struct 
 watchdog_device *wdd, unsigned long mode,
 	/*

drivers/watchdog/apple_wdt.c static int apple_wdt_restart(struct · line 135

Quoted 10 lines
drivers/watchdog/apple_wdt.c +3 -3
 	 * Flush writes and then wait for the SoC to reset. Even though the
 	 * reset is queued almost immediately experiments have shown that it
-	 * can take up to ~20-25ms until the SoC is actually reset. Just wait
-	 * 50ms here to be safe.
+	 * can take up to ~120-125ms until the SoC is actually reset. Just
+	 * wait 150ms here to be safe.
 	 */
 	(void)readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME);
-	mdelay(50);
+	mdelay(150);

I think you also need to insert a barrier before the mdelay(), or turn the readl_relaxed() into a readl(), it will otherwise be bypassed by the delay.

The comment is a bit confusing here as it suggests that the MMIO read is meant to serialize between the restart and the mdelay(), but the _relaxed() annotation on the readl() explicitly skips that serialization, so one of the two is wrong here.

Arnd