diff options
author | Tim Harvey <tharvey@gateworks.com> | 2015-05-14 11:48:04 -0700 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2015-05-19 15:00:56 +0200 |
commit | 9e20560221807ca4b8c540311168fe3f0d48022d (patch) | |
tree | 8c86bb0b781fbe3ea73d09889904d7fb01217a2f /common | |
parent | af1db4a39034ae15a91f0dae7da9548f0501febf (diff) | |
download | u-boot-imx-9e20560221807ca4b8c540311168fe3f0d48022d.zip u-boot-imx-9e20560221807ca4b8c540311168fe3f0d48022d.tar.gz u-boot-imx-9e20560221807ca4b8c540311168fe3f0d48022d.tar.bz2 |
env_nand: use nand_spl_load_image for readenv if SPL
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>
Diffstat (limited to 'common')
-rw-r--r-- | common/env_nand.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/env_nand.c b/common/env_nand.c index 9c9bb82..92e0e05 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -233,6 +233,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; @@ -266,6 +272,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) |