[PATCH u-boot-marvell 2/8] arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function
Marek Behún
marek.behun at nic.cz
Wed Mar 2 13:37:25 CET 2022
On Wed, 2 Mar 2022 12:47:52 +0100
Pali Rohár <pali at kernel.org> 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.
>
> Therefore no initialization code is required to access SPI Flags from
> U-Boot SPL. In proper U-Boot it is remapped to other location.
>
> So in mvebu implementation of env_sf_get_env_addr() function returns
> 0xD4000000 when running in SPL and NULL when in proper U-Boot.
>
> This change would allow to use U-Boot ENV in U-Boot SPL. Normally it is not
> 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.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
> board/CZ.NIC/turris_omnia/turris_omnia.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_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;
> }
>
> +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
More information about the U-Boot
mailing list