All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@openbsd.org>
To: u-boot@lists.denx.de
Cc: sjg@chromium.org, sven@svenpeter.dev,
	Mark Kettenis <kettenis@openbsd.org>
Subject: [PATCH 3/3] arm: apple: Use watchdog timer for system reset
Date: Sun, 14 Nov 2021 12:19:42 +0100	[thread overview]
Message-ID: <20211114111942.96151-4-kettenis@openbsd.org> (raw)
In-Reply-To: <20211114111942.96151-1-kettenis@openbsd.org>

Rely on the new watchdog timer driver and the sysreset uclass to
reset the system.  This gets rid of hard-coded addresses and
should work on systems based on the new M1 Pro and M1 Max SoCs
as well.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
---
 arch/arm/Kconfig            |  3 +++
 arch/arm/mach-apple/board.c | 24 ------------------------
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f7f03837fe..4c58af45da 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -936,6 +936,9 @@ config ARCH_APPLE
 	select OF_CONTROL
 	select OF_BOARD
 	select POSITION_INDEPENDENT
+	select SYSRESET
+	select SYSRESET_WATCHDOG
+	select SYSRESET_WATCHDOG_AUTO
 	select USB
 	imply CMD_DM
 	imply CMD_GPT
diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
index 0bfbc473ec..b7e8d212f1 100644
--- a/arch/arm/mach-apple/board.c
+++ b/arch/arm/mach-apple/board.c
@@ -119,30 +119,6 @@ int dram_init_banksize(void)
 	return fdtdec_setup_memory_banksize();
 }
 
-#define APPLE_WDT_BASE		0x23d2b0000ULL
-
-#define APPLE_WDT_SYS_CTL_ENABLE	BIT(2)
-
-typedef struct apple_wdt {
-	u32	reserved0[3];
-	u32	chip_ctl;
-	u32	sys_tmr;
-	u32	sys_cmp;
-	u32	reserved1;
-	u32	sys_ctl;
-} apple_wdt_t;
-
-void reset_cpu(void)
-{
-	apple_wdt_t *wdt = (apple_wdt_t *)APPLE_WDT_BASE;
-
-	writel(0, &wdt->sys_cmp);
-	writel(APPLE_WDT_SYS_CTL_ENABLE, &wdt->sys_ctl);
-
-	while(1)
-		wfi();
-}
-
 extern long fw_dtb_pointer;
 
 void *board_fdt_blob_setup(int *err)
-- 
2.33.1


  parent reply	other threads:[~2021-11-14 11:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 11:19 [PATCH 0/4] Apple M1 watchdog timer Mark Kettenis
2021-11-14 11:19 ` [PATCH 1/3] watchdog: Add a driver for the Apple watchdog Mark Kettenis
2021-11-14 12:36   ` Sven Peter
2021-11-25  0:12   ` Simon Glass
2022-01-11  8:57   ` Stefan Roese
2022-01-12 18:49     ` Mark Kettenis
2021-11-14 11:19 ` [PATCH 2/3] arm: dts: apple: Add watchdog timer node Mark Kettenis
2021-11-25  0:12   ` Simon Glass
2022-01-11  8:59   ` Stefan Roese
2021-11-14 11:19 ` Mark Kettenis [this message]
2021-11-25  0:12   ` [PATCH 3/3] arm: apple: Use watchdog timer for system reset Simon Glass
2022-01-11  9:00   ` Stefan Roese
2022-01-10 20:25 ` [PATCH 0/4] Apple M1 watchdog timer Mark Kettenis
2022-01-11  6:08   ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211114111942.96151-4-kettenis@openbsd.org \
    --to=kettenis@openbsd.org \
    --cc=sjg@chromium.org \
    --cc=sven@svenpeter.dev \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.