diff options
author | Tom Rini <trini@konsulko.com> | 2018-01-17 13:48:35 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-01-17 13:48:35 -0500 |
commit | 086ebcd40e9bf8efc520f1b177fd8e3cc0e506fa (patch) | |
tree | e25d93fda4ce7cd672e7340f60015ec6fe2de27f /env | |
parent | 3759df0c0810636b31fe64c56868aa831514e509 (diff) | |
parent | 2eb2dbd4577898bf289e911b2286df3f2363af6e (diff) | |
download | u-boot-086ebcd40e9bf8efc520f1b177fd8e3cc0e506fa.tar.gz u-boot-086ebcd40e9bf8efc520f1b177fd8e3cc0e506fa.tar.bz2 u-boot-086ebcd40e9bf8efc520f1b177fd8e3cc0e506fa.zip |
Merge git://git.denx.de/u-boot-fsl-qoriq
Diffstat (limited to 'env')
-rw-r--r-- | env/sf.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 }; |