env_nand: use nand_spl_load_image for readenv if SPL
PATCH 1/1 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).
--- common/env_nand.c | 7 +++++++ 1 file changed, 7 insertions(+)
common/env_nand.c +7 -0
@@ -260,6 +260,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 ;
@@ -295,6 +301,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)
Signature · 1 line
1.9.1
PATCH 1/1 env_nand: use nand_spl_load_image for readenv if SPL
Quoted 10 lines · Tim Harvey
The
readenv()implementation ofenv_nanduses the mtd layer which is unnecessary overhead in SPL when we already have anand_spl_load_image()function that doesn't need it. Using this instead eliminates the need to provide amtd_readfor SPL env as well as reduces code (4KB savings in IMX6 SPL).Signed-off-by Tim Harvey <[email protected]>--- common/env_nand.c | 7 +++++++ 1 file changed, 7 insertions(+)
-Scott
PATCH 1/1 env_nand: use nand_spl_load_image for readenv if SPL
Hi Tim,
Quoted 7 lines · Scott Wood
Quoted 6 lines · Tim Harvey
The
readenv()implementation ofenv_nanduses the mtd layer which is unnecessary overhead in SPL when we already have anand_spl_load_image()function that doesn't need it. Using this instead eliminates the need to provide amtd_readfor SPL env as well as reduces code (4KB savings in IMX6 SPL).
Quoted 7 lines
Quoted 4 lines
Signed-off-by Tim Harvey <[email protected]>--- common/env_nand.c | 7 +++++++ 1 file changed, 7 insertions(+)Acked-by Scott Wood <[email protected]>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================