From mboxrd@z Thu Jan 1 00:00:00 1970 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 8CE7BECAAD1 for ; Thu, 1 Sep 2022 13:05:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9420184A09; Thu, 1 Sep 2022 15:05:31 +0200 (CEST) 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 07E9E84A0D; Thu, 1 Sep 2022 15:05:30 +0200 (CEST) Received: from mail-m11876.qiye.163.com (mail-m11876.qiye.163.com [115.236.118.76]) (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 D7ABB844E4 for ; Thu, 1 Sep 2022 15:05:26 +0200 (CEST) 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 [172.16.12.93] (unknown [58.22.7.114]) by mail-m11876.qiye.163.com (Hmail) with ESMTPA id 551123C036A; Thu, 1 Sep 2022 21:05:13 +0800 (CST) Message-ID: <46a95abb-4b9c-fbe6-bca1-8b6f56fa89a2@rock-chips.com> Date: Thu, 1 Sep 2022 21:05:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 05/12] rockchip: puma-rk3399: load environment from same MMC as used for loading U-Boot proper Content-Language: en-US To: Quentin Schulz Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, klaus.goger@theobroma-systems.com, knaerzche@gmail.com, u-boot@lists.denx.de, Quentin Schulz References: <20220722160655.3904213-1-foss+uboot@0leil.net> <20220722160655.3904213-6-foss+uboot@0leil.net> From: Kever Yang In-Reply-To: <20220722160655.3904213-6-foss+uboot@0leil.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJSktLSjdXWS1ZQUlXWQ8JGhUIEh9ZQVlCTkpCVkoeTUNMGRkYGUpMSVUTARMWGhIXJB QOD1lXWRgSC1lBWU5DVUlJVUxVSkpPWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVSktLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NCo6Kyo5DT01M0MyAk1JMFZR ERgaCxBVSlVKTU1JS0hMTkpIQkNCVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlOQ1VJSVVMVUpKT1lXWQgBWUFISUxINwY+ X-HM-Tid: 0a82f927d5b32eb2kusn551123c036a 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 On 2022/7/23 00:06, Quentin Schulz wrote: > From: Quentin Schulz > > Automatically detect which MMC device (SD-Card or eMMC) was used to load > U-Boot proper and load the environment from that MMC device instead of > a hardcoded one. > > Cc: Quentin Schulz > Signed-off-by: Quentin Schulz Reviewed-by: Kever Yang Thanks, - Kever > --- > > Depends on > https://lore.kernel.org/u-boot/20220715151552.953654-1-foss+uboot@0leil.net/ > > .../puma_rk3399/puma-rk3399.c | 22 +++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c > index ce3436b770..5e5e58c88e 100644 > --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c > +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c > @@ -113,6 +113,28 @@ static int setup_boottargets(void) > return 0; > } > > +int mmc_get_env_dev(void) > +{ > + const char *boot_device = > + ofnode_read_chosen_string("u-boot,spl-boot-device"); > + > + if (!boot_device) { > + debug("%s: /chosen/u-boot,spl-boot-device not set\n", > + __func__); > + return CONFIG_SYS_MMC_ENV_DEV; > + } > + > + debug("%s: booted from %s\n", __func__, boot_device); > + > + if (!strcmp(boot_device, "/mmc@fe320000")) > + return 1; > + > + if (!strcmp(boot_device, "/mmc@fe330000")) > + return 0; > + > + return CONFIG_SYS_MMC_ENV_DEV; > +} > + > int misc_init_r(void) > { > const u32 cpuid_offset = 0x7;