public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Marek Behún" <marek.behun@nic.cz>
To: "Pali Rohár" <pali@kernel.org>
Cc: Stefan Roese <sr@denx.de>, u-boot@lists.denx.de
Subject: Re: [PATCH u-boot-marvell 2/8] arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function
Date: Wed, 2 Mar 2022 13:37:25 +0100	[thread overview]
Message-ID: <20220302133725.6dde7559@dellmb> (raw)
In-Reply-To: <20220302114758.21787-3-pali@kernel.org>

On Wed,  2 Mar 2022 12:47:52 +0100
Pali Rohár <pali@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@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

  reply	other threads:[~2022-03-02 12:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 11:47 [PATCH u-boot-marvell 0/8] Turris Omnia: Add support for configuring mSATA and WWAN slots via env variables Pali Rohár
2022-03-02 11:47 ` [PATCH u-boot-marvell 1/8] env: sf: Allow to use env_sf_init_addr() at any stage Pali Rohár
2022-03-02 11:47 ` [PATCH u-boot-marvell 2/8] arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function Pali Rohár
2022-03-02 12:37   ` Marek Behún [this message]
2022-04-22 11:49     ` Pali Rohár
2022-04-22 12:21       ` Marek Behún
2022-03-02 11:47 ` [PATCH u-boot-marvell 3/8] arm: mvebu: turris_omnia: Enable ENV support in SPL Pali Rohár
2022-03-02 11:47 ` [PATCH u-boot-marvell 4/8] arm: mvebu: turris_omnia: Define only one serdes map variable Pali Rohár
2022-03-02 11:47 ` [PATCH u-boot-marvell 5/8] arm: mvebu: turris_omnia: Allow to configure mSATA slot via env variable Pali Rohár
2022-03-02 12:36   ` Marek Behún
2022-03-02 11:47 ` [PATCH u-boot-marvell 6/8] arm: mvebu: turris_omnia: Extract code for disabling sata/pcie Pali Rohár
2022-03-02 12:38   ` Marek Behún
2022-04-22  9:20     ` Pali Rohár
2022-04-22  9:23       ` Stefan Roese
2022-03-02 11:47 ` [PATCH u-boot-marvell 7/8] arm: mvebu: turris_omnia: Signal error when sata/pcie DT mode Pali Rohár
2022-03-02 11:47 ` [PATCH u-boot-marvell 8/8] arm: mvebu: turris_omnia: Add support for USB3.0 mode in WWAN MiniPCIe slot Pali Rohár
2022-03-02 12:46   ` Marek Behún
2022-04-22 11:47     ` Pali Rohár
2022-04-22 12:20       ` Marek Behún
2022-05-01 14:57 ` [PATCH u-boot-marvell 0/8] Turris Omnia: Add support for configuring mSATA and WWAN slots via env variables Pali Rohár
2022-05-02 15:39 ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302133725.6dde7559@dellmb \
    --to=marek.behun@nic.cz \
    --cc=pali@kernel.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox