[U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
Ashish Kumar
ashish.kumar at nxp.com
Thu Jan 11 09:32:32 UTC 2018
> -----Original Message-----
> From: York Sun
> Sent: Monday, January 08, 2018 11:53 PM
> To: Ashish Kumar <ashish.kumar at nxp.com>; u-boot at lists.denx.de; Simon
> Glass <sjg at chromium.org>; Jagan Teki <jagan at openedev.com>
> Subject: Re: [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
>
> On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> > ENV variables can now be used before relocation.
> >
> > Signed-off-by: Ashish Kumar <Ashish.Kumar at nxp.com>
> > ---
> > v2:
> > replace & with && in #if
> >
> > Tested on ls1088ardb.
> > Tested on ls1012hexa after defining CONFIG_ENV_ADDR
> >
> > env/sf.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/env/sf.c b/env/sf.c
> > index e51b1ae..a2e4c93 100644
> > --- a/env/sf.c
> > +++ b/env/sf.c
> > @@ -34,6 +34,7 @@
> >
> > #ifndef CONFIG_SPL_BUILD
> > #define CMD_SAVEENV
> > +#define INITENV
> > #endif
> >
> > #ifdef CONFIG_ENV_OFFSET_REDUND
> > @@ -348,6 +349,23 @@ out:
> > }
> > #endif
> >
> > +#if defined(INITENV) && defined(CONFIG_ENV_ADDR) static int
> > +env_sf_init(void) {
> > + env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
> > +
> > + if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
> > + gd->env_addr = (ulong)&(env_ptr->data);
> > + gd->env_valid = 1;
> > + } else {
> > + gd->env_addr = (ulong)&default_environment[0];
> > + gd->env_valid = 1;
> > + }
> > +
> > + return 0;
> > +}
> > +#endif
> > +
> > U_BOOT_ENV_LOCATION(sf) = {
> > .location = ENVL_SPI_FLASH,
> > ENV_NAME("SPI Flash")
> > @@ -355,4 +373,7 @@ U_BOOT_ENV_LOCATION(sf) = { #ifdef
> CMD_SAVEENV
> > .save = env_save_ptr(env_sf_save),
> > #endif
> > +#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
> > + .init = env_sf_init,
> > +#endif
> > };
> >
>
> Please run get_maintainer.pl to get the CC list if you don't use patman.
>
> I wonder how SPI worked before. Did it work, Simon and Jagan?
SPI is working, this patch adds support to init environment such that it can be used before u-boot relocation similar to that of IFC-NOR.
Regards
Ashish
>
> York
More information about the U-Boot
mailing list