Patchwork [U-Boot,27/31] M28: Save environment in NAND

login
register
mail settings
Submitter Marek Vasut
Date Sept. 8, 2011, 8:42 p.m.
Message ID <1315514579-19215-28-git-send-email-marek.vasut@gmail.com>
Download mbox | patch
Permalink /patch/113979/
State Changes Requested
Headers show

Comments

Marek Vasut - Sept. 8, 2011, 8:42 p.m.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
---
 include/configs/m28evk.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
Scott Wood - Sept. 16, 2011, 7:15 p.m.
On 09/08/2011 03:42 PM, Marek Vasut wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> ---
>  include/configs/m28evk.h |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
> index 0d4a0a3..c120c63 100644
> --- a/include/configs/m28evk.h
> +++ b/include/configs/m28evk.h
> @@ -131,6 +131,15 @@
>  #define	CONFIG_SYS_NAND_5_ADDR_CYCLE
>  #define	NAND_MAX_CHIPS			8
>  
> +/* Environment is in NAND */
> +#define	CONFIG_ENV_IS_IN_NAND		1
> +#define	CONFIG_ENV_SECT_SIZE		(128 * 1024)
> +#define	CONFIG_ENV_SIZE			(16 * 1024)
> +#define	CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
> +#define	CONFIG_ENV_OFFSET		0x300000
> +#define	CONFIG_ENV_OFFSET_REDUND	\
> +		(CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
> +
>  #define	CONFIG_CMD_UBI
>  #define	CONFIG_CMD_UBIFS
>  #define	CONFIG_CMD_MTDPARTS
> @@ -230,6 +239,4 @@
>  #define	CONFIG_LOADADDR		0x42000000
>  #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
>  
> -#define	CONFIG_ENV_IS_NOWHERE	1
> -
>  #endif /* __M28_H__ */

Consider using CONFIG_ENV_RANGE to allow for bad blocks.

-Scott
Fabio Estevam - Sept. 17, 2011, 7:10 a.m.
On Thu, Sep 8, 2011 at 5:42 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
...
> +/* Environment is in NAND */
> +#define        CONFIG_ENV_IS_IN_NAND           1

You should remove the "1".
Marek Vasut - Sept. 17, 2011, 8:20 a.m.
On Friday, September 16, 2011 09:15:12 PM Scott Wood wrote:
> On 09/08/2011 03:42 PM, Marek Vasut wrote:
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > Cc: Wolfgang Denk <wd@denx.de>
> > Cc: Detlev Zundel <dzu@denx.de>
> > ---
> > 
> >  include/configs/m28evk.h |   11 +++++++++--
> >  1 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
> > index 0d4a0a3..c120c63 100644
> > --- a/include/configs/m28evk.h
> > +++ b/include/configs/m28evk.h
> > @@ -131,6 +131,15 @@
> > 
> >  #define	CONFIG_SYS_NAND_5_ADDR_CYCLE
> >  #define	NAND_MAX_CHIPS			8
> > 
> > +/* Environment is in NAND */
> > +#define	CONFIG_ENV_IS_IN_NAND		1
> > +#define	CONFIG_ENV_SECT_SIZE		(128 * 1024)
> > +#define	CONFIG_ENV_SIZE			(16 * 1024)
> > +#define	CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
> > +#define	CONFIG_ENV_OFFSET		0x300000
> > +#define	CONFIG_ENV_OFFSET_REDUND	\
> > +		(CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
> > +
> > 
> >  #define	CONFIG_CMD_UBI
> >  #define	CONFIG_CMD_UBIFS
> >  #define	CONFIG_CMD_MTDPARTS
> > 
> > @@ -230,6 +239,4 @@
> > 
> >  #define	CONFIG_LOADADDR		0x42000000
> >  #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
> > 
> > -#define	CONFIG_ENV_IS_NOWHERE	1
> > -
> > 
> >  #endif /* __M28_H__ */
> 
> Consider using CONFIG_ENV_RANGE to allow for bad blocks.

How does this actually play with CONFIG_MTDPARTS ?

For you see -- I now have
CONFIG_MTDPARTS "...128k(environment), 128k(redundant-environment)..."
and CONFIG_ENV_SECT_SIZE (128 * 1024).

So what exactly am I supposed to set into CONFIG_ENV_RANGE and do I have to 
modify the CONFIG_MTDPARTS?

Thanks, cheers!
> 
> -Scott
Scott Wood - Sept. 19, 2011, 5:54 p.m.
On 09/17/2011 03:20 AM, Marek Vasut wrote:
> On Friday, September 16, 2011 09:15:12 PM Scott Wood wrote:
>> Consider using CONFIG_ENV_RANGE to allow for bad blocks.
> 
> How does this actually play with CONFIG_MTDPARTS ?

I don't think there's any direct interaction between the environment
code and mtdparts.

> For you see -- I now have
> CONFIG_MTDPARTS "...128k(environment), 128k(redundant-environment)..."
> and CONFIG_ENV_SECT_SIZE (128 * 1024).
> 
> So what exactly am I supposed to set into CONFIG_ENV_RANGE and do I have to 
> modify the CONFIG_MTDPARTS?

You'd have to make the environment partitions larger -- the idea is to
provide an extra block or two in case of bad blocks.  CONFIG_ENV_RANGE
would be set to the partition size.

-Scott

Patch

diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index 0d4a0a3..c120c63 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -131,6 +131,15 @@ 
 #define	CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define	NAND_MAX_CHIPS			8
 
+/* Environment is in NAND */
+#define	CONFIG_ENV_IS_IN_NAND		1
+#define	CONFIG_ENV_SECT_SIZE		(128 * 1024)
+#define	CONFIG_ENV_SIZE			(16 * 1024)
+#define	CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
+#define	CONFIG_ENV_OFFSET		0x300000
+#define	CONFIG_ENV_OFFSET_REDUND	\
+		(CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
+
 #define	CONFIG_CMD_UBI
 #define	CONFIG_CMD_UBIFS
 #define	CONFIG_CMD_MTDPARTS
@@ -230,6 +239,4 @@ 
 #define	CONFIG_LOADADDR		0x42000000
 #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 
-#define	CONFIG_ENV_IS_NOWHERE	1
-
 #endif /* __M28_H__ */