From patchwork Fri Jul 22 10:09:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 1659460 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lq4t73YNSz9sGZ for ; Fri, 22 Jul 2022 20:09:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D085583F82; Fri, 22 Jul 2022 12:09:25 +0200 (CEST) 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 0322783F94; Fri, 22 Jul 2022 12:09:25 +0200 (CEST) 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 relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) (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 9813D83F4B for ; Fri, 22 Jul 2022 12:09:22 +0200 (CEST) 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 8ECB7200003; Fri, 22 Jul 2022 10:09:20 +0000 (UTC) From: Quentin Schulz To: Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, alpernebiyasak@gmail.com, email2tema@gmail.com, u-boot@lists.denx.de, Quentin Schulz , Quentin Schulz , Xavier Drudis Ferran Subject: [PATCH v2 1/2] spl: enable regulator-boot-on and disable regulator-force-boot-off Date: Fri, 22 Jul 2022 12:09:07 +0200 Message-Id: <20220722100908.3853994-1-foss+uboot@0leil.net> X-Mailer: git-send-email 2.37.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 This makes sure regulators that need to be turned on or off at boot are turned on or off in the SPL. This may be required for the SPL to do some operations, such as finding possible loading media for U-Boot proper. Cc: Quentin Schulz Tested-by: Xavier Drudis Ferran Signed-off-by: Quentin Schulz --- v2: - added Tested-by, - fixed build for boards with SPL_DM_REGULATOR disabled by always included power/regulator.h and defining a dummy implementation for regulators_enable_boot_off, common/spl/spl.c | 10 ++++++++++ include/power/regulator.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index 29e0898f03..6ab997279d 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -39,6 +39,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; DECLARE_BINMAN_MAGIC_SYM; @@ -773,6 +774,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2) if (CONFIG_IS_ENABLED(GPIO_HOG)) gpio_hog_probe_all(); + if (CONFIG_IS_ENABLED(DM_REGULATOR)) { + if (regulators_enable_boot_on(false)) + debug("%s: Cannot enable boot on regulator\n", + __func__); + if (regulators_enable_boot_off(false)) + debug("%s: Cannot enable boot off regulator\n", + __func__); + } + #if CONFIG_IS_ENABLED(BOARD_INIT) spl_board_init(); #endif diff --git a/include/power/regulator.h b/include/power/regulator.h index ff1bfc2435..4bce61dd9f 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -631,6 +631,11 @@ static inline int regulators_enable_boot_on(bool verbose) return -ENOSYS; } +static inline int regulators_enable_boot_off(bool verbose) +{ + return -ENOSYS; +} + static inline int regulator_autoset(struct udevice *dev) { return -ENOSYS; From patchwork Fri Jul 22 10:09:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 1659461 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lq4tN6gsVz9sGZ for ; Fri, 22 Jul 2022 20:09:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7030583F9B; Fri, 22 Jul 2022 12:09:30 +0200 (CEST) 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 E2CC883F89; Fri, 22 Jul 2022 12:09:26 +0200 (CEST) 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 relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) (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 3D0C583F89 for ; Fri, 22 Jul 2022 12:09:24 +0200 (CEST) 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 8D4DE200009; Fri, 22 Jul 2022 10:09:22 +0000 (UTC) From: Quentin Schulz To: Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, alpernebiyasak@gmail.com, email2tema@gmail.com, u-boot@lists.denx.de, Quentin Schulz , Quentin Schulz , Xavier Drudis Ferran Subject: [PATCH v2 2/2] rockchip: rk3399: remove duplicate call to regulators_enable_boot_on Date: Fri, 22 Jul 2022 12:09:08 +0200 Message-Id: <20220722100908.3853994-2-foss+uboot@0leil.net> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722100908.3853994-1-foss+uboot@0leil.net> References: <20220722100908.3853994-1-foss+uboot@0leil.net> 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 An earlier commit makes the common SPL code call regulators_enable_boot_on and regulators_enable_boot_off before iterating over possible boot media for U-Boot proper. There is therefore no need to do this in the rk3399-specific code, so let's remove it. Cc: Quentin Schulz Tested-by: Xavier Drudis Ferran Signed-off-by: Quentin Schulz Reviewed-by: Jagan Teki --- This patch depends on: - https://lore.kernel.org/u-boot/20220722093014.3850165-1-foss+uboot@0leil.net/ - https://lore.kernel.org/u-boot/20220722093014.3850165-2-foss+uboot@0leil.net/ v2: - added Tested-by, arch/arm/mach-rockchip/rk3399/rk3399.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index fc1acaf4bd..94d0fa58c4 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -280,15 +280,5 @@ void spl_board_init(void) if (cru->glb_rst_st != 0) rk3399_force_power_on_reset(); } - - if (IS_ENABLED(CONFIG_SPL_DM_REGULATOR)) { - /* - * Turning the eMMC and SPI back on (if disabled via the Qseven - * BIOS_ENABLE) signal is done through a always-on regulator). - */ - if (regulators_enable_boot_on(false)) - debug("%s: Cannot enable boot on regulator\n", - __func__); - } } #endif