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 E74D2C433EF for ; Wed, 2 Mar 2022 12:37:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6DDE483C84; Wed, 2 Mar 2022 13:37:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="E3N8OaZ4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82C7A83C63; Wed, 2 Mar 2022 13:37:30 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 049FC83C84 for ; Wed, 2 Mar 2022 13:37:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from dellmb (unknown [IPv6:2001:1488:fffe:6:8747:7254:5571:3010]) by mail.nic.cz (Postfix) with ESMTPSA id B00A61409E2; Wed, 2 Mar 2022 13:37:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1646224645; bh=uVtK8An3T8eati4+0CZlR7YyGBEmjfkTD8pMnAvEm/0=; h=Date:From:To; b=E3N8OaZ4apk6Ba+vV4g432DyMP9T1P0Fho+KFQ/7FmcEWF3hwW0p5Ir9optUzZBhz H7jPm0kFwaHFA4yfgZlUv6NcIhZW8Qqw26LAOd5BGVuENlEjnRELWqbqfJTjaa57UJ 0pBSpwa3w228zDN3K1xXP/W5ms0JDnyOi1dYY9o0= Date: Wed, 2 Mar 2022 13:37:25 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: [PATCH u-boot-marvell 2/8] arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function Message-ID: <20220302133725.6dde7559@dellmb> In-Reply-To: <20220302114758.21787-3-pali@kernel.org> References: <20220302114758.21787-1-pali@kernel.org> <20220302114758.21787-3-pali@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Wed, 2 Mar 2022 12:47:52 +0100 Pali Roh=C3=A1r wrote: > BootROM maps SPI Flash to fixed address 0xD4000000 and this mapping is > active also when BootROM is executing binary kwbimage headers, which > includes also U-Boot SPL. >=20 > Therefore no initialization code is required to access SPI Flags from > U-Boot SPL. In proper U-Boot it is remapped to other location. >=20 > So in mvebu implementation of env_sf_get_env_addr() function returns > 0xD4000000 when running in SPL and NULL when in proper U-Boot. >=20 > This change would allow to use U-Boot ENV in U-Boot SPL. Normally it is n= ot > possible to read ENV because it is too big and U-Boot SPL does not have > such big malloc() pool to real all ENV variables. >=20 > Signed-off-by: Pali Roh=C3=A1r > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turr= is_omnia/turris_omnia.c > index 33cec6587e19..a93af6c5b877 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -243,6 +243,16 @@ static bool omnia_detect_sata(void) > return stsword & MSATA_IND_STSBIT ? true : false; > } > =20 > +void *env_sf_get_env_addr(void) > +{ > + /* SPI Flash is mapped to address 0xD4000000 only in SPL */ > +#ifdef CONFIG_SPL_BUILD > + return (void *)0xD4000000 + CONFIG_ENV_OFFSET; > +#else > + return NULL; > +#endif if (IS_ENABLED(CONFIG_SPL_BUILD)) return (void *)0xD4000000 + CONFIG_ENV_OFFSET; else return NULL; Marek