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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 06F3FC433F5 for ; Wed, 12 Jan 2022 18:55:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C41EB83311; Wed, 12 Jan 2022 19:55:34 +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 Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=kpnmail.nl header.i=@kpnmail.nl header.b="hsFJEk86"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15B31832D1; Wed, 12 Jan 2022 19:55:32 +0100 (CET) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.168]) (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 AC00D831EF for ; Wed, 12 Jan 2022 19:55:26 +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 X-KPN-MessageId: 1c0af3ff-73d9-11ec-8862-005056aba152 Received: from smtp.kpnmail.nl (unknown [10.31.155.38]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id 1c0af3ff-73d9-11ec-8862-005056aba152; Wed, 12 Jan 2022 19:54:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kpnmail.nl; s=kpnmail01; h=mime-version:message-id:date:subject:to:from; bh=zW1mqiHZ0AIsx5fqF+/bVcc4oAlbsoFqcKRPgCFxzQc=; b=hsFJEk86wO1hO1DhZuan3l1ABvME5/HZK7U/X6o2N6Yg9KiVkW3E7bbqe8jk/ldoKYR46o31/ULvR PWL+8Cp7UjqgrkVq7+SgzO8eh9oVfiaElrezFsy+5zJsLS/hvQKDU6cHncEqoa9M+NYqGr+julGqkv 33sxxMsLroNYPsRU= X-KPN-VerifiedSender: No X-CMASSUN: 33|9QRm6h3rtF3huVDQ87zFFy5n9XeitAWD3VMFyq0WKXJnEicCXzutLH94+Rob6DJ Be/lZAVS56ILYZ8J+P+mZtA== X-Originating-IP: 83.163.83.176 Received: from copland.sibelius.xs4all.nl (sibelius.xs4all.nl [83.163.83.176]) by smtp.xs4all.nl (Halon) with ESMTPSA id 342bcf50-73d9-11ec-94d2-005056abf0db; Wed, 12 Jan 2022 19:55:26 +0100 (CET) From: Mark Kettenis To: u-boot@lists.denx.de Cc: sjg@chromium.org, sven@svenpeter.dev, sr@denx.de, Mark Kettenis Subject: [PATCH v2 3/3] arm: apple: Use watchdog timer for system reset Date: Wed, 12 Jan 2022 19:55:17 +0100 Message-Id: <20220112185517.38799-4-kettenis@openbsd.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112185517.38799-1-kettenis@openbsd.org> References: <20220112185517.38799-1-kettenis@openbsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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 Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Tested-on: Apple M1 Macbook Tested-by: Simon Glass --- 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 7264d72bde..78c6b2e92d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 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.34.1