env: sf: define API to override sf environment address

Defines env_sf_get_env_addr API to override sf environment address,
required to support multiple environment.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
This commit is contained in:
Rajesh Bhagat 2018-11-05 18:01:15 +00:00 committed by York Sun
parent b6cba297af
commit 119c01c2a5

9
env/sf.c vendored
View File

@ -298,10 +298,17 @@ out:
}
#endif
#ifdef CONFIG_ENV_ADDR
__weak void *env_sf_get_env_addr(void)
{
return (void *)CONFIG_ENV_ADDR;
}
#endif
#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
static int env_sf_init(void)
{
env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
env_t *env_ptr = (env_t *)env_sf_get_env_addr();
if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
gd->env_addr = (ulong)&(env_ptr->data);