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 98E13C001DB for ; Thu, 3 Aug 2023 21:02:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2FEBB867DD; Thu, 3 Aug 2023 23:02:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="mfyzROrh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D468867FB; Thu, 3 Aug 2023 23:02:46 +0200 (CEST) Received: from wfbtzhsw.outbound-mail.sendgrid.net (wfbtzhsw.outbound-mail.sendgrid.net [159.183.224.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A13EA867D2 for ; Thu, 3 Aug 2023 23:02:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type:cc:content-type:from:subject:to; s=s1; bh=39r3qDKuNvrmyn1kHeq0PSDmHQ61huA60sbW2zNP5P4=; b=mfyzROrhd1CZDHyLu1C0R3WAt15myCm6+5kH73zYrvLb+EGZ0L0dG2Md7j2sUaVw75Sf 8B5yPFE+XY86Km3Q7cY0lRegjECt126YqoCoyJ9r+Fc5jbhVldTsxAps6ej7kWQLJIc/m/ yu4Ju3qaK3gSHCs/xmu8fDmC+NhV6pigcBJnScD30Dd6gUelRqvo4oAmuEahVmgpMtZzsI iqipHqjJA98064wPvza9cLFG5e81NpvH6NZK+XmnnLLljGbHpXKGznG8l5nRYXHTyAhWrR NhhMAg810GtrBsspY7sUHpoITTAVooKBWVL7Eco6Ph772jiceu1fYQC6EG8ha5tg== Received: by filterdrecv-d7bbbc8bf-7m5fp with SMTP id filterdrecv-d7bbbc8bf-7m5fp-1-64CC15F2-C 2023-08-03 21:02:42.243903189 +0000 UTC m=+7334585.392873077 Received: from bionic.localdomain (unknown) by geopod-ismtpd-2 (SG) with ESMTP id nQXoc3hAQ8W3XLVMsnI8Ew Thu, 03 Aug 2023 21:02:41.939 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 1/2] power: pmic: rk8xx: Fix power-on source check in SPL Date: Thu, 03 Aug 2023 21:02:42 +0000 (UTC) Message-ID: <20230803210239.3998777-1-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0hw5kZb4AZE1ZqAJgW?= =?us-ascii?Q?+lrMCVhcclpVvq+SLeLnGZjDmLeIhkbuVjyiOrX?= =?us-ascii?Q?vbMJ1nfn16TwHjwCEA8uk7XUADSZZdmE1nwvmdw?= =?us-ascii?Q?hsYBSK16QTNOWWTQ9pBoBOqp5aB19SGpTs+qUUi?= =?us-ascii?Q?xWkXskYwWhnQ8TZgOvMi0diquooY7gRMV+tnkI?= To: Kever Yang , Simon Glass , Philipp Tomsich , Jaehoon Chung , Chris Morgan Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 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.8 at phobos.denx.de X-Virus-Status: Clean The commit 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in") introduce an option to prevent booting a device when the device was powered on due to power plug-in instead of pressing a power button. This feature works by checking the power-on source during PMIC probe and powers off the device if power-on source was power plug-in. This check currently runs very late at PMIC probe in U-Boot proper. Fix so that the power-on source check can work at probe time in SPL. Also enable probe after bind and remove the PMIC banner in SPL. With this we can use ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON and SPL_PMIC_RK8XX to power off the device very quickly after TPL instead of after TF-A and U-Boot proper has been loaded and run. DDR V1.18 f366f69a7d typ 23/07/17-15:48:58 ln LP4/4x derate en, other dram:1x trefi ddrconfig:7 LPDDR4X, 324MHz BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=8192MB change to: 324MHz clk skew:0x64 change to: 528MHz clk skew:0x58 change to: 780MHz clk skew:0x58 change to: 1056MHz(final freq) clk skew:0x40 out Power Off due to plug-in event Fixes: 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in") Signed-off-by: Jonas Karlman --- drivers/power/pmic/rk8xx.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 25ef621f8df4..4e3a17337eee 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -156,6 +156,10 @@ static int rk8xx_bind(struct udevice *dev) if (!children) debug("%s: %s - no child found\n", __func__, dev->name); + if (IS_ENABLED(CONFIG_SPL_BUILD) && + IS_ENABLED(CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON)) + dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND); + /* Always return success for this device */ return 0; } @@ -236,14 +240,16 @@ static int rk8xx_probe(struct udevice *dev) pmic_reg_read(dev, init_data[i].reg)); } - printf("PMIC: RK%x ", show_variant); + if (!IS_ENABLED(CONFIG_SPL_BUILD)) { + printf("PMIC: RK%x ", show_variant); + if (on_source && off_source) + printf("(on=0x%02x, off=0x%02x)", + pmic_reg_read(dev, on_source), + pmic_reg_read(dev, off_source)); + printf("\n"); + } - if (on_source && off_source) - printf("(on=0x%02x, off=0x%02x)", - pmic_reg_read(dev, on_source), - pmic_reg_read(dev, off_source)); - printf("\n"); - if (CONFIG_IS_ENABLED(ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON)) + if (IS_ENABLED(CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON)) rk8xx_off_for_plugin(dev); return 0; -- 2.41.0