Skip to contentSkip to conversation

watchdog: apple: Increase reset delay to 150ms

PATCH RESEND In review Nick Chan 2 participants 4 messages Oct 29, 2024 – Nov 1, 2024

Subsystems (2)
lore
Share & tools
lore

Nick Chan

author
#0 lore raw

v2 cover watchdog: apple: Increase reset delay to 150ms

Increase the reset delay to 150ms as the Apple A8X SoC can take up to 125ms to actually reset.

Since the code is being modified anyways, also fix a bug where watchdog writes were not actually getting flushed after requesting reset, depsite what the code comments said.

Changes since v1:
- Fix an existing bug where watchdog writes are not flushed

v1: https://lore.kernel.org/asahi/[email protected]

Nick Chan
---

Nick Chan (2):
watchdog: apple: Actually flush writes after requesting watchdog
restart
watchdog: apple: Increase reset delay to 150ms

 drivers/watchdog/apple_wdt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

base-commit: dec9255a128e19c5fcc3bdb18175d78094cc624d

Signature · 1 line
2.47.0
author
#1 lore raw

PATCH RESEND v2 1/2 watchdog: apple: Actually flush writes after requesting watchdog restart

Although there is an existing code comment about flushing the writes, writes were not actually being flushed.

Actually flush the writes by changing readl_relaxed() to readl().

Fixes 4ed224aeaf661 ("watchdog: Add Apple SoC watchdog driver")
---
 drivers/watchdog/apple_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/apple_wdt.c +1 -1
index d4f739932f0b..62dabf223d90 100644
@@ -130,7 +130,7 @@ static int apple_wdt_restart(struct watchdog_device *wdd, unsigned long mode,
 	 * can take up to ~20-25ms until the SoC is actually reset. Just wait
 	 * 50ms here to be safe.
 	 */
-	(void)readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME);
+	(void)readl(wdt->regs + APPLE_WDT_WD1_CUR_TIME);
 	mdelay(50);
 
 	return 0;
Signature · 1 line
2.47.0
author
#2 lore raw

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

In reply to 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 +3 -3
index 62dabf223d90..95d9e37df41c 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(wdt->regs + APPLE_WDT_WD1_CUR_TIME);
-	mdelay(50);
+	mdelay(150);
 
 	return 0;
 }
Signature · 1 line
2.47.0
Acked-by on the v2 series
#3 lore raw
In reply to Nick Chan
Quoted 20 lines · Nick Chan

Increase the reset delay to 150ms as the Apple A8X SoC can take up to 125ms to actually reset.

Since the code is being modified anyways, also fix a bug where watchdog writes were not actually getting flushed after requesting reset, depsite what the code comments said.

Changes since v1:
- Fix an existing bug where watchdog writes are not flushed

v1: https://lore.kernel.org/asahi/[email protected]

Nick Chan
---

Nick Chan (2):
watchdog: apple: Actually flush writes after requesting watchdog
restart
watchdog: apple: Increase reset delay to 150ms

Quoted 5 lines
 drivers/watchdog/apple_wdt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

base-commit: dec9255a128e19c5fcc3bdb18175d78094cc624d

- Hector