From patchwork Fri Nov 11 11:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 1702589 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N7x6W5PQNz23lT for ; Fri, 11 Nov 2022 22:18:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DC838505B; Fri, 11 Nov 2022 12:18:54 +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 89B42850E1; Fri, 11 Nov 2022 12:18:52 +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 [217.70.183.200]) (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 0939284E45 for ; Fri, 11 Nov 2022 12:18:50 +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 1D61320002; Fri, 11 Nov 2022 11:18:47 +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] rockchip: px30: make watchdog and tsadc trigger a first global reset Date: Fri, 11 Nov 2022 12:18:25 +0100 Message-Id: <20221111-px30-wdt-1-glb-rst-v1-0-0bc8946435f3@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 --- 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 --- arch/arm/mach-rockchip/px30/px30.c | 3 +++ 1 file changed, 3 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..5a3049086d 100644 --- a/arch/arm/mach-rockchip/px30/px30.c +++ b/arch/arm/mach-rockchip/px30/px30.c @@ -285,6 +285,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; }