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 33C0DC433EF for ; Mon, 14 Mar 2022 09:09:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 70E9B83A6B; Mon, 14 Mar 2022 10:09:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=rock-chips.com 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 E9AD7839A7; Mon, 14 Mar 2022 10:09:17 +0100 (CET) Received: from mail-m17662.qiye.163.com (mail-m17662.qiye.163.com [59.111.176.62]) (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 38592839A7 for ; Mon, 14 Mar 2022 10:09:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@rock-chips.com Received: from [192.168.60.65] (unknown [103.29.142.67]) by mail-m17662.qiye.163.com (Hmail) with ESMTPA id 702CD1403BD; Mon, 14 Mar 2022 17:09:00 +0800 (CST) Message-ID: <4f49ce3d-9ae1-a987-85e2-7940d2bbc526@rock-chips.com> Date: Mon, 14 Mar 2022 17:08:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1 06/11] rockchip: handle bootrom recovery mode in spl Content-Language: en-US To: Peter Geis , Simon Glass , Philipp Tomsich Cc: u-boot@lists.denx.de References: <20220222013131.3114990-1-pgwipeout@gmail.com> <20220222013131.3114990-7-pgwipeout@gmail.com> From: Kever Yang In-Reply-To: <20220222013131.3114990-7-pgwipeout@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUNKTUpWTx8YHUxIT0JLTx 5NVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NCI6Pww*Oj5WLyghURg1NAIP FQMwCkNVSlVKTU9MSU9DQk9KS0pPVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlKS0hVSUJVSk9JVU1MWVdZCAFZQU9CSEM3Bg++ X-HM-Tid: 0a7f87b01ea6da2ckuws702cd1403bd 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.5 at phobos.denx.de X-Virus-Status: Clean Hi Peter, On 2022/2/22 09:31, Peter Geis wrote: > Fixup the bootrom recovery mode code to function in spl, so we can > handle recovery mode in case u-boot loading is broken. I don't understand what do you mean about "Fixup the bootrom recovery mode code"? I would like to make SPL simple and small enough so that it can fit all kinds of SoCs. I believeĀ  there are other modules to coming after saradc if we enable boot_mode in SPL, the SPL may become bloatware later. So please remove the boot mode relate patches so that other patches need by rk3568 can be merge first. Thanks, - Kever > > Signed-off-by: Peter Geis > --- > arch/arm/mach-rockchip/Makefile | 6 +++--- > arch/arm/mach-rockchip/boot_mode.c | 4 +++- > arch/arm/mach-rockchip/rk3568/rk3568.c | 23 +++++++++++++++++++++++ > 3 files changed, 29 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile > index 00aef0ecee6a..53aff25ce8f6 100644 > --- a/arch/arm/mach-rockchip/Makefile > +++ b/arch/arm/mach-rockchip/Makefile > @@ -15,13 +15,13 @@ obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o > > obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o > > -ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) > - > # Always include boot_mode.o, as we bypass it (i.e. turn it off) > # inside of boot_mode.c when CONFIG_BOOT_MODE_REG is 0. This way, > # we can have the preprocessor correctly recognise both 0x0 and 0 > # meaning "turn it off". > -obj-y += boot_mode.o > +obj-$(CONFIG_ARCH_ROCKCHIP) += boot_mode.o > + > +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) > obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o > obj-$(CONFIG_MISC_INIT_R) += misc.o > endif > diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c > index 1a1a887fc2cd..43cb369465a2 100644 > --- a/arch/arm/mach-rockchip/boot_mode.c > +++ b/arch/arm/mach-rockchip/boot_mode.c > @@ -51,7 +51,7 @@ __weak int rockchip_dnl_key_pressed(void) > ret = -ENODEV; > uclass_foreach_dev(dev, uc) { > if (!strncmp(dev->name, "saradc", 6)) { > - ret = adc_channel_single_shot(dev->name, 1, &val); > + ret = adc_channel_single_shot(dev->name, 0, &val); > break; > } > } > @@ -89,6 +89,7 @@ int setup_boot_mode(void) > boot_mode = readl(reg); > debug("%s: boot mode 0x%08x\n", __func__, boot_mode); > > +#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) > /* Clear boot mode */ > writel(BOOT_NORMAL, reg); > > @@ -102,6 +103,7 @@ int setup_boot_mode(void) > env_set("preboot", "setenv preboot; ums mmc 0"); > break; > } > +#endif > > return 0; > } > diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c b/arch/arm/mach-rockchip/rk3568/rk3568.c > index 22eeb77d41fa..4e23feb9417f 100644 > --- a/arch/arm/mach-rockchip/rk3568/rk3568.c > +++ b/arch/arm/mach-rockchip/rk3568/rk3568.c > @@ -104,3 +104,26 @@ int arch_cpu_init(void) > #endif > return 0; > } > + > +#ifdef CONFIG_SPL_BUILD > + > +void __weak led_setup(void) > +{ > +} > + > +void spl_board_init(void) > +{ > + led_setup(); > + > +#if defined(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 > + > + setup_boot_mode(); > +} > +#endif