[PATCH 3/3] arm: apple: Use watchdog timer for system reset

Stefan Roese sr at denx.de
Tue Jan 11 10:00:51 CET 2022


On 11/14/21 12:19, Mark Kettenis wrote:
> 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 at openbsd.org>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

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

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list