Commit 9e205602 authored by Tim Harvey's avatar Tim Harvey Committed by Stefano Babic
Browse files

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: default avatarTim Harvey <tharvey@gateworks.com>
Acked-by: default avatarScott Wood <scottwood@freescale.com>
parent af1db4a3
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment