env: sf: define API to override sf environment address
authorRajesh Bhagat <rajesh.bhagat@nxp.com>
Mon, 5 Nov 2018 18:01:15 +0000 (18:01 +0000)
committerYork Sun <york.sun@nxp.com>
Tue, 4 Dec 2018 21:07:36 +0000 (13:07 -0800)
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>
env/sf.c

index 2e3c60048392da5dc04789399185fec8e8a5266b..23cbad5d8885c54168237dc8fcb14b719faeb4ad 100644 (file)
--- a/env/sf.c
+++ b/env/sf.c
@@ -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);