]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
env_nand: use nand_spl_load_image for readenv if SPL
authorTim Harvey <tharvey@gateworks.com>
Thu, 14 May 2015 18:48:04 +0000 (11:48 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 13:00:31 +0000 (15:00 +0200)
The readenv() implementation of env_nand uses the mtd layer which is
unnecessary overhead in SPL when we already have a nand_spl_load_image()
function that doesn't need it. Using this instead eliminates the need
to provide a mtd_read for SPL env as well as reduces code (4KB savings in IMX6
SPL).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Scott Wood <scottwood@freescale.com>
common/env_nand.c

index dc457f959d708e98cba41b8714d340748f687c4d..4a97b6ca651c53b17f1f61d2e41edfa0a755aeef 100644 (file)
@@ -231,6 +231,12 @@ int saveenv(void)
 }
 #endif /* CMD_SAVEENV */
 
+#if defined(CONFIG_SPL_BUILD)
+static int readenv(size_t offset, u_char *buf)
+{
+       return nand_spl_load_image(offset, CONFIG_ENV_SIZE, buf);
+}
+#else
 static int readenv(size_t offset, u_char *buf)
 {
        size_t end = offset + CONFIG_ENV_RANGE;
@@ -264,6 +270,7 @@ static int readenv(size_t offset, u_char *buf)
 
        return 0;
 }
+#endif /* #if defined(CONFIG_SPL_BUILD) */
 
 #ifdef CONFIG_ENV_OFFSET_OOB
 int get_nand_env_oob(nand_info_t *nand, unsigned long *result)