]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: apple: Use watchdog timer for system reset
authorMark Kettenis <kettenis@openbsd.org>
Wed, 12 Jan 2022 18:55:17 +0000 (19:55 +0100)
committerStefan Roese <sr@denx.de>
Thu, 13 Jan 2022 05:55:46 +0000 (06:55 +0100)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-on: Apple M1 Macbook
Tested-by: Simon Glass <sjg@chromium.org>
arch/arm/Kconfig
arch/arm/mach-apple/board.c

index 7264d72bde99b8c45ec4e3ca27d02103194c0d05..78c6b2e92dce93f8a23a4dbbaf5920f6d894de64 100644 (file)
@@ -942,6 +942,9 @@ config ARCH_APPLE
        select OF_CONTROL
        select PINCTRL
        select POSITION_INDEPENDENT
+       select SYSRESET
+       select SYSRESET_WATCHDOG
+       select SYSRESET_WATCHDOG_AUTO
        select USB
        imply CMD_DM
        imply CMD_GPT
index 0bfbc473ec1d6693bca7b56cc346acf7a153d8c0..b7e8d212f1a57003ec5d72aeff0318e55d5e3ac8 100644 (file)
@@ -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)