Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83DBDC433F5 for ; Sun, 14 Nov 2021 11:20:34 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE15361073 for ; Sun, 14 Nov 2021 11:20:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DE15361073 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5196B834A3; Sun, 14 Nov 2021 12:20:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D9F3783459; Sun, 14 Nov 2021 12:19:58 +0100 (CET) Received: from lb2-smtp-cloud8.xs4all.net (lb2-smtp-cloud8.xs4all.net [194.109.24.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1854383450 for ; Sun, 14 Nov 2021 12:19:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=kettenis@openbsd.org Received: from cust-df1d398c ([IPv6:fc0c:c1f5:9ac0:c45f:1583:5c5b:91fa:2436]) by smtp-cloud8.xs4all.net with ESMTPA id mDY4mB4VX8wPvmDY7mjMf4; Sun, 14 Nov 2021 12:19:51 +0100 From: Mark Kettenis To: u-boot@lists.denx.de Cc: sjg@chromium.org, sven@svenpeter.dev, Mark Kettenis Subject: [PATCH 3/3] arm: apple: Use watchdog timer for system reset Date: Sun, 14 Nov 2021 12:19:42 +0100 Message-Id: <20211114111942.96151-4-kettenis@openbsd.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211114111942.96151-1-kettenis@openbsd.org> References: <20211114111942.96151-1-kettenis@openbsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfKqcmaGzlsldV4KRj2wFySf+GcVW0+Dq0lXe4HhpJ92wEWHbV/E57TVZNbpsePD/4OVBvxwgIzubk74mAP5uz+CElV4tB/b6Mcx7exIymKde8W3edysI B6TTOoDxloT5MOsYFj/+LSIWMCTF9/+oP8ElKbcz6ss7hQ5W/KiO3S9HXCFZ0s7IlIqJgq5kQsrJesiJJ1Dg81nMFp7NosJF9FApBqH7w2k/O4e+BFIpX30V IDkgHUdI2v5hq1vlJ2eiOiVzqHBf6rfVeQDkXW5uctCg+Vad2bKNqL3r/BeLhYch X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 --- 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