public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] env_nand: use nand_spl_load_image for readenv if SPL
@ 2015-05-14 18:48 Tim Harvey
  2015-05-15 18:59 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Harvey @ 2015-05-14 18:48 UTC (permalink / raw)
  To: u-boot

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>
---
 common/env_nand.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/env_nand.c b/common/env_nand.c
index 7fc7558..bab89fd 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -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)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] env_nand: use nand_spl_load_image for readenv if SPL
  2015-05-14 18:48 [U-Boot] [PATCH] env_nand: use nand_spl_load_image for readenv if SPL Tim Harvey
@ 2015-05-15 18:59 ` Scott Wood
  2015-05-19 13:02   ` Stefano Babic
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2015-05-15 18:59 UTC (permalink / raw)
  To: u-boot

On Thu, 2015-05-14 at 11:48 -0700, Tim Harvey wrote:
> 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>
> ---
>  common/env_nand.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] env_nand: use nand_spl_load_image for readenv if SPL
  2015-05-15 18:59 ` Scott Wood
@ 2015-05-19 13:02   ` Stefano Babic
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2015-05-19 13:02 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On 15/05/2015 20:59, Scott Wood wrote:
> On Thu, 2015-05-14 at 11:48 -0700, Tim Harvey wrote:
>> 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>
>> ---
>>  common/env_nand.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
> 
> Acked-by: Scott Wood <scottwood@freescale.com>
> 

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
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
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-19 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14 18:48 [U-Boot] [PATCH] env_nand: use nand_spl_load_image for readenv if SPL Tim Harvey
2015-05-15 18:59 ` Scott Wood
2015-05-19 13:02   ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox