From patchwork Fri Nov 11 11:25:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 1702591 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N7xGs1cRxz20KC for ; Fri, 11 Nov 2022 22:26:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 735B484BE3; Fri, 11 Nov 2022 12:26:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=0leil.net 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 0DD5A850E1; Fri, 11 Nov 2022 12:26:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A55F680FB5 for ; Fri, 11 Nov 2022 12:26:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=0leil.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=foss+uboot@0leil.net Received: (Authenticated sender: foss@0leil.net) by mail.gandi.net (Postfix) with ESMTPSA id 18E4020002; Fri, 11 Nov 2022 11:25:59 +0000 (UTC) From: Quentin Schulz To: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com Cc: Quentin Schulz , Quentin Schulz , u-boot@lists.denx.de Subject: [PATCH v2] rockchip: px30: make watchdog and tsadc trigger a first global reset Date: Fri, 11 Nov 2022 12:25:48 +0100 Message-Id: <20221111-px30-wdt-1-glb-rst-v2-0-a7db24644a98@theobroma-systems.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean From: Quentin Schulz By default, the PX30 is configured for watchdog and tsadc to trigger a second global reset which is a more permissive reset than first global reset. From TRM part 1 "2.3 System Reset Solution": glb_srstn_1 will reset the all logic, and glb_srstn_2 will reset the all logic except GRF, SGRF and all GPIOs. This enforces that the watchdog and tsadc trigger glb_srstn_1 as similarly done for RK3399 in U-Boot (in SDRAM driver for some reason?), TF-A and Coreboot. Cc: Quentin Schulz Signed-off-by: Quentin Schulz Reviewed-by: Kever Yang --- rockchip: px30: make watchdog and tsadc trigger a first global reset Our devkits have a HW switch which electrically cuts the power and clock lines to the on-board eMMC so that the module is forced to boot from SD card (or enter USB flashing mode if none is present). This HW switch is electrically bypassed in SW by a GPIO in U-Boot SPL to allow for eMMC to be used in U-Boot and Linux. In a second global reset, the GPIO do not get reset and is therefore still bypassing the HW switch, meaning the eMMC will be operational even though it is not desired (because the HW switch is supposed to enforce booting from SD card/USB when in that position). This also mimics what's seen on RK3399. To: Simon Glass To: Philipp Tomsich To: Kever Yang Cc: u-boot@lists.denx.de --- Changes in v2: - add missing cru struct --- arch/arm/mach-rockchip/px30/px30.c | 4 ++++ 1 file changed, 4 insertions(+) --- base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3 change-id: 20221111-px30-wdt-1-glb-rst-0ce41249727d Best regards, diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c index 0641e6af0f..ded03ffa51 100644 --- a/arch/arm/mach-rockchip/px30/px30.c +++ b/arch/arm/mach-rockchip/px30/px30.c @@ -234,6 +234,7 @@ enum { int arch_cpu_init(void) { static struct px30_grf * const grf = (void *)GRF_BASE; + static struct px30_cru * const cru = (void *)CRU_BASE; u32 __maybe_unused val; #ifdef CONFIG_SPL_BUILD @@ -285,6 +286,9 @@ int arch_cpu_init(void) /* Clear the force_jtag */ rk_clrreg(&grf->cpu_con[1], 1 << 7); + /* Make TSADC and WDT trigger a first global reset */ + clrsetbits_le32(&cru->glb_rst_con, 0x3, 0x3); + return 0; }