linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms
@ 2024-10-29  1:29 Nick Chan
  2024-10-29  1:29 ` [PATCH v2 RESEND 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart Nick Chan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nick Chan @ 2024-10-29  1:29 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Wim Van Sebroeck,
	Guenter Roeck, asahi, linux-arm-kernel, linux-watchdog,
	linux-kernel
  Cc: 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/20240930060653.4024-1-towinchenmi@gmail.com

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
-- 
2.47.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 RESEND 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart
  2024-10-29  1:29 [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
@ 2024-10-29  1:29 ` Nick Chan
  2024-10-29  1:29 ` [PATCH v2 RESEND 2/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
  2024-11-01 13:02 ` [PATCH v2 RESEND 0/2] " Hector Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Chan @ 2024-10-29  1:29 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Wim Van Sebroeck,
	Guenter Roeck, asahi, linux-arm-kernel, linux-watchdog,
	linux-kernel
  Cc: Nick Chan, Arnd Bergmann

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")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Guenter Roeck  <linux@roeck-us.net>
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
---
 drivers/watchdog/apple_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c
index d4f739932f0b..62dabf223d90 100644
--- a/drivers/watchdog/apple_wdt.c
+++ b/drivers/watchdog/apple_wdt.c
@@ -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;
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 RESEND 2/2] watchdog: apple: Increase reset delay to 150ms
  2024-10-29  1:29 [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
  2024-10-29  1:29 ` [PATCH v2 RESEND 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart Nick Chan
@ 2024-10-29  1:29 ` Nick Chan
  2024-11-01 13:02 ` [PATCH v2 RESEND 0/2] " Hector Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Chan @ 2024-10-29  1:29 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Wim Van Sebroeck,
	Guenter Roeck, asahi, linux-arm-kernel, linux-watchdog,
	linux-kernel
  Cc: 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.

Reviewed-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
---
 drivers/watchdog/apple_wdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c
index 62dabf223d90..95d9e37df41c 100644
--- a/drivers/watchdog/apple_wdt.c
+++ b/drivers/watchdog/apple_wdt.c
@@ -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;
 }
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms
  2024-10-29  1:29 [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
  2024-10-29  1:29 ` [PATCH v2 RESEND 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart Nick Chan
  2024-10-29  1:29 ` [PATCH v2 RESEND 2/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
@ 2024-11-01 13:02 ` Hector Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Hector Martin @ 2024-11-01 13:02 UTC (permalink / raw)
  To: Nick Chan, Sven Peter, Alyssa Rosenzweig, Wim Van Sebroeck,
	Guenter Roeck, asahi, linux-arm-kernel, linux-watchdog,
	linux-kernel



On 2024/10/29 10:29, Nick Chan wrote:
> 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/20240930060653.4024-1-towinchenmi@gmail.com
> 
> 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

Acked-by: Hector Martin <marcan@marcan.st>

- Hector



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-01 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  1:29 [PATCH v2 RESEND 0/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
2024-10-29  1:29 ` [PATCH v2 RESEND 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart Nick Chan
2024-10-29  1:29 ` [PATCH v2 RESEND 2/2] watchdog: apple: Increase reset delay to 150ms Nick Chan
2024-11-01 13:02 ` [PATCH v2 RESEND 0/2] " Hector Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).