U-boot Archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size
@ 2011-04-05 15:30 Matthew McClintock
  2011-04-05 18:48 ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew McClintock @ 2011-04-05 15:30 UTC (permalink / raw)
  To: u-boot

Change variables to const to reduce code size, these values are
hardcoded via defines anyways so we might as well assume they
are constants

Signed-off-by: Matthew McClintock <msm@freescale.com>
cc: Scott Wood <scottwood@freescale.com>
---
With this change we can reduce the size of the nand_spl by
148 bytes with my particular board/compiler

 nand_spl/nand_boot_fsl_elbc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/nand_spl/nand_boot_fsl_elbc.c b/nand_spl/nand_boot_fsl_elbc.c
index 9547d44..922284f 100644
--- a/nand_spl/nand_boot_fsl_elbc.c
+++ b/nand_spl/nand_boot_fsl_elbc.c
@@ -51,11 +51,11 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
-	int large = in_be32(&regs->bank[0].or) & OR_FCM_PGS;
-	int block_shift = large ? 17 : 14;
-	int block_size = 1 << block_shift;
-	int page_size = large ? 2048 : 512;
-	int bad_marker = large ? page_size + 0 : page_size + 5;
+	const int large = CONFIG_NAND_OR_PRELIM & OR_FCM_PGS;
+	const int block_shift = large ? 17 : 14;
+	const int block_size = 1 << block_shift;
+	const int page_size = large ? 2048 : 512;
+	const int bad_marker = large ? page_size + 0 : page_size + 5;
 	int fmr = (15 << FMR_CWTO_SHIFT) | (2 << FMR_AL_SHIFT) | 2;
 	int pos = 0;
 
-- 
1.7.3.4

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

* [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 15:30 [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
@ 2011-04-05 18:48 ` Scott Wood
  2011-04-05 19:00   ` McClintock Matthew-B29882
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2011-04-05 18:48 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 05, 2011 at 10:30:45AM -0500, Matthew McClintock wrote:
> Change variables to const to reduce code size, these values are
> hardcoded via defines anyways so we might as well assume they
> are constants
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> cc: Scott Wood <scottwood@freescale.com>
> ---
> With this change we can reduce the size of the nand_spl by
> 148 bytes with my particular board/compiler

When building for MPC8315ERDB_NAND, I get:

nand_boot_fsl_elbc.c: In function 'nand_load':
nand_boot_fsl_elbc.c:54:20: error: 'CONFIG_NAND_OR_PRELIM' undeclared (first use in this function)
nand_boot_fsl_elbc.c:54:20: note: each undeclared identifier is reported only once for each function it appears in

It appears 85xx calls it CONFIG_NAND_OR_PRELIM, and 83xx calls it
CONFIG_SYS_NAND_OR_PRELIM.  The latter seems like what we should be
using.

I can't figure out what's "prelim" about it either, but that's another
matter.  :-)

-Scott

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

* [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 18:48 ` Scott Wood
@ 2011-04-05 19:00   ` McClintock Matthew-B29882
  2011-04-05 19:03     ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: McClintock Matthew-B29882 @ 2011-04-05 19:00 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 5, 2011 at 1:48 PM, Scott Wood <scottwood@freescale.com> wrote:
> When building for MPC8315ERDB_NAND, I get:
>
> nand_boot_fsl_elbc.c: In function 'nand_load':
> nand_boot_fsl_elbc.c:54:20: error: 'CONFIG_NAND_OR_PRELIM' undeclared (first use in this function)
> nand_boot_fsl_elbc.c:54:20: note: each undeclared identifier is reported only once for each function it appears in
>
> It appears 85xx calls it CONFIG_NAND_OR_PRELIM, and 83xx calls it
> CONFIG_SYS_NAND_OR_PRELIM. ?The latter seems like what we should be
> using.
>
> I can't figure out what's "prelim" about it either, but that's another
> matter. ?:-)

I'll submit a follow up patch renaming CONFIG_NAND_OR_PRELIM to
CONFIG_SYS_NAND_OR_PRELIM and CONFIG_NAND_BR_PRELIM to
CONFIG_SYS_NAND_BR_PRELIM? Should I go ahead and drop the PRELIM as
well?

-M

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

* [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 19:00   ` McClintock Matthew-B29882
@ 2011-04-05 19:03     ` Scott Wood
  2011-04-05 19:39       ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Matthew McClintock
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2011-04-05 19:03 UTC (permalink / raw)
  To: u-boot

On Tue, 5 Apr 2011 14:00:23 -0500
McClintock Matthew-B29882 <B29882@freescale.com> wrote:

> On Tue, Apr 5, 2011 at 1:48 PM, Scott Wood <scottwood@freescale.com> wrote:
> > When building for MPC8315ERDB_NAND, I get:
> >
> > nand_boot_fsl_elbc.c: In function 'nand_load':
> > nand_boot_fsl_elbc.c:54:20: error: 'CONFIG_NAND_OR_PRELIM' undeclared (first use in this function)
> > nand_boot_fsl_elbc.c:54:20: note: each undeclared identifier is reported only once for each function it appears in
> >
> > It appears 85xx calls it CONFIG_NAND_OR_PRELIM, and 83xx calls it
> > CONFIG_SYS_NAND_OR_PRELIM. ?The latter seems like what we should be
> > using.
> >
> > I can't figure out what's "prelim" about it either, but that's another
> > matter. ?:-)
> 
> I'll submit a follow up patch renaming CONFIG_NAND_OR_PRELIM to
> CONFIG_SYS_NAND_OR_PRELIM and CONFIG_NAND_BR_PRELIM to
> CONFIG_SYS_NAND_BR_PRELIM? Should I go ahead and drop the PRELIM as
> well?

Just add the SYS, dropping PRELIM everywhere would be a bigger rename and
should be done separately if we decide to do that.

-Scott

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

* [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS
  2011-04-05 19:03     ` Scott Wood
@ 2011-04-05 19:39       ` Matthew McClintock
  2011-04-05 19:39         ` [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
  2011-04-08  7:52         ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Kumar Gala
  0 siblings, 2 replies; 10+ messages in thread
From: Matthew McClintock @ 2011-04-05 19:39 UTC (permalink / raw)
  To: u-boot

renaming 85xx define CONFIG_NAND_OR_PRELIM to
CONFIG_SYS_NAND_OR_PRELIM and CONFIG_NAND_BR_PRELIM to
CONFIG_SYS_NAND_BR_PRELIM to use the more appropriate
CONFIG_SYS prefix as well as be consistent with 83xx

Signed-off-by: Matthew McClintock <msm@freescale.com>
cc: Scott Wood <scottwood@freescale.com>
cc: Kumar Gala <kumar.gala@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |    8 ++++----
 include/configs/MPC8536DS.h              |   18 +++++++++---------
 include/configs/MPC8569MDS.h             |   12 ++++++------
 include/configs/MPC8572DS.h              |   18 +++++++++---------
 include/configs/P1_P2_RDB.h              |   12 ++++++------
 include/configs/P2020DS.h                |   14 +++++++-------
 6 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c b/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
index 8fb27ab..920bb47 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
@@ -33,11 +33,11 @@ void cpu_init_f(void)
 	 */
 	out_be32(&lbc->lcrr, LCRR_DBYP | LCRR_CLKDIV_8);
 
-#if defined(CONFIG_NAND_BR_PRELIM) && defined(CONFIG_NAND_OR_PRELIM)
-	set_lbc_br(0, CONFIG_NAND_BR_PRELIM);
-	set_lbc_or(0, CONFIG_NAND_OR_PRELIM);
+#if defined(CONFIG_SYS_NAND_BR_PRELIM) && defined(CONFIG_SYS_NAND_OR_PRELIM)
+	set_lbc_br(0, CONFIG_SYS_NAND_BR_PRELIM);
+	set_lbc_or(0, CONFIG_SYS_NAND_OR_PRELIM);
 #else
-#error  CONFIG_NAND_BR_PRELIM, CONFIG_NAND_OR_PRELIM must be defined
+#error  CONFIG_SYS_NAND_BR_PRELIM, CONFIG_SYS_NAND_OR_PRELIM must be defined
 #endif
 
 #if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 13300de..e915ee7 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -360,13 +360,13 @@
 #define CONFIG_SYS_NAND_U_BOOT_RELOC_SP ((CONFIG_SYS_INIT_L2_END - 1) & ~0xF)
 
 /* NAND flash config */
-#define CONFIG_NAND_BR_PRELIM \
+#define CONFIG_SYS_NAND_BR_PRELIM \
 		(BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
 		| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 		| BR_PS_8		/* Port Size = 8 bit */ \
 		| BR_MS_FCM		/* MSEL = FCM */ \
 		| BR_V)			/* valid */
-#define CONFIG_NAND_OR_PRELIM	(0xFFFC0000	/* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM	(0xFFFC0000	/* length 256K */ \
 		| OR_FCM_PGS		/* Large Page*/ \
 		| OR_FCM_CSCT \
 		| OR_FCM_CST \
@@ -376,15 +376,15 @@
 		| OR_FCM_EHTR)
 
 #ifdef CONFIG_RAMBOOT_NAND
-#define CONFIG_SYS_BR0_PRELIM  CONFIG_NAND_BR_PRELIM	/* NAND Base Address */
-#define CONFIG_SYS_OR0_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_BR0_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR0_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #define CONFIG_SYS_BR2_PRELIM  CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR2_PRELIM  CONFIG_FLASH_OR_PRELIM	/* NOR Options */
 #else
 #define CONFIG_SYS_BR0_PRELIM  CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR0_PRELIM  CONFIG_FLASH_OR_PRELIM	/* NOR Options */
-#define CONFIG_SYS_BR2_PRELIM  CONFIG_NAND_BR_PRELIM	/* NAND Base Address */
-#define CONFIG_SYS_OR2_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_BR2_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR2_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #endif
 
 #define CONFIG_SYS_BR4_PRELIM \
@@ -393,14 +393,14 @@
 		| BR_PS_8		/* Port Size = 8 bit */ \
 		| BR_MS_FCM		/* MSEL = FCM */ \
 		| BR_V)			/* valid */
-#define CONFIG_SYS_OR4_PRELIM	CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR4_PRELIM	CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #define CONFIG_SYS_BR5_PRELIM \
 		(BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0x80000)) \
 		| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 		| BR_PS_8		/* Port Size = 8 bit */ \
 		| BR_MS_FCM		/* MSEL = FCM */ \
 		| BR_V)			/* valid */
-#define CONFIG_SYS_OR5_PRELIM	CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR5_PRELIM	CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 
 #define CONFIG_SYS_BR6_PRELIM \
 		(BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0xc0000)) \
@@ -408,7 +408,7 @@
 		| BR_PS_8		/* Port Size = 8 bit */ \
 		| BR_MS_FCM		/* MSEL = FCM */ \
 		| BR_V)			/* valid */
-#define CONFIG_SYS_OR6_PRELIM	CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR6_PRELIM	CONFIG_SYS_NAND_OR_PRELIM	/* NAND Options */
 
 /* Serial Port - controlled on board with jumper J8
  * open - index 2
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index 9e24e12..4325e58 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -240,12 +240,12 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_CMD_NAND			1
 #define CONFIG_NAND_FSL_ELBC		1
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
-#define CONFIG_NAND_BR_PRELIM	(CONFIG_SYS_NAND_BASE_PHYS \
+#define CONFIG_SYS_NAND_BR_PRELIM	(CONFIG_SYS_NAND_BASE_PHYS \
 				| (2<<BR_DECC_SHIFT) /* Use HW ECC */ \
 				| BR_PS_8	     /* Port Size = 8 bit */ \
 				| BR_MS_FCM	     /* MSEL = FCM */ \
 				| BR_V)		     /* valid */
-#define CONFIG_NAND_OR_PRELIM	(0xFFFC0000	     /* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM	(0xFFFC0000	     /* length 256K */ \
 				| OR_FCM_CSCT \
 				| OR_FCM_CST \
 				| OR_FCM_CHT \
@@ -254,15 +254,15 @@ extern unsigned long get_clock_freq(void);
 				| OR_FCM_EHTR)
 
 #ifdef CONFIG_RAMBOOT_NAND
-#define CONFIG_SYS_BR0_PRELIM	CONFIG_NAND_BR_PRELIM	/* NAND Base Address */
-#define CONFIG_SYS_OR0_PRELIM	CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_BR0_PRELIM	CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR0_PRELIM	CONFIG_SYS_NAND_OR_PRELIM/* NAND Options */
 #define CONFIG_SYS_BR3_PRELIM	CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR3_PRELIM	CONFIG_FLASH_OR_PRELIM	/* NOR Options */
 #else
 #define CONFIG_SYS_BR0_PRELIM	CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR0_PRELIM	CONFIG_FLASH_OR_PRELIM	/* NOR Options */
-#define CONFIG_SYS_BR3_PRELIM	CONFIG_NAND_BR_PRELIM /* NAND Base Address */
-#define CONFIG_SYS_OR3_PRELIM	CONFIG_NAND_OR_PRELIM /* NAND Options */
+#define CONFIG_SYS_BR3_PRELIM	CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR3_PRELIM	CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #endif
 
 #define CONFIG_SYS_LBC_LCRR	0x00000004	/* LB clock ratio reg */
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index bf2fdd6..3823e79 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -361,12 +361,12 @@
 
 
 /* NAND flash config */
-#define CONFIG_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
+#define CONFIG_SYS_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
 			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_NAND_OR_PRELIM  (0xFFFC0000	      /* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM  (0xFFFC0000	      /* length 256K */ \
 			       | OR_FCM_PGS	       /* Large Page*/ \
 			       | OR_FCM_CSCT \
 			       | OR_FCM_CST \
@@ -376,35 +376,35 @@
 			       | OR_FCM_EHTR)
 
 #ifdef CONFIG_RAMBOOT_NAND
-#define CONFIG_SYS_BR0_PRELIM  CONFIG_NAND_BR_PRELIM	/* NAND Base Address */
-#define CONFIG_SYS_OR0_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_BR0_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR0_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #define CONFIG_SYS_BR2_PRELIM  CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR2_PRELIM  CONFIG_FLASH_OR_PRELIM	/* NOR Options */
 #else
 #define CONFIG_SYS_BR0_PRELIM  CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */
 #define CONFIG_SYS_OR0_PRELIM  CONFIG_FLASH_OR_PRELIM	/* NOR Options */
-#define CONFIG_SYS_BR2_PRELIM  CONFIG_NAND_BR_PRELIM  /* NAND Base Address */
-#define CONFIG_SYS_OR2_PRELIM  CONFIG_NAND_OR_PRELIM  /* NAND Options */
+#define CONFIG_SYS_BR2_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR2_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #endif
 #define CONFIG_SYS_BR4_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0x40000))\
 			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_SYS_OR4_PRELIM  CONFIG_NAND_OR_PRELIM	 /* NAND Options */
+#define CONFIG_SYS_OR4_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #define CONFIG_SYS_BR5_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0x80000))\
 			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_SYS_OR5_PRELIM  CONFIG_NAND_OR_PRELIM	 /* NAND Options */
+#define CONFIG_SYS_OR5_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 
 #define CONFIG_SYS_BR6_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0xc0000))\
 			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_SYS_OR6_PRELIM  CONFIG_NAND_OR_PRELIM	 /* NAND Options */
+#define CONFIG_SYS_OR6_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 
 
 /* Serial Port - controlled on board with jumper J8
diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h
index 95b85e3..418ba85 100644
--- a/include/configs/P1_P2_RDB.h
+++ b/include/configs/P1_P2_RDB.h
@@ -263,13 +263,13 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_NAND_U_BOOT_RELOC_SP		((CONFIG_SYS_INIT_L2_END - 1) & ~0xF)
 
 /* NAND flash config */
-#define CONFIG_NAND_BR_PRELIM	(CONFIG_SYS_NAND_BASE_PHYS \
+#define CONFIG_SYS_NAND_BR_PRELIM	(CONFIG_SYS_NAND_BASE_PHYS \
 				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 				| BR_PS_8	/* Port Size = 8 bit */ \
 				| BR_MS_FCM		/* MSEL = FCM */ \
 				| BR_V)			/* valid */
 
-#define CONFIG_NAND_OR_PRELIM	(0xFFF80000		/* length 32K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM	(0xFFF80000	/* length 32K */ \
 				| OR_FCM_CSCT \
 				| OR_FCM_CST \
 				| OR_FCM_CHT \
@@ -278,15 +278,15 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 				| OR_FCM_EHTR)
 
 #ifdef CONFIG_RAMBOOT_NAND
-#define CONFIG_SYS_BR0_PRELIM  CONFIG_NAND_BR_PRELIM  /* NAND Base Address */
-#define CONFIG_SYS_OR0_PRELIM  CONFIG_NAND_OR_PRELIM  /* NAND Options */
+#define CONFIG_SYS_BR0_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR0_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #define CONFIG_SYS_BR1_PRELIM  CONFIG_FLASH_BR_PRELIM  /* NOR Base Address */
 #define CONFIG_SYS_OR1_PRELIM  CONFIG_FLASH_OR_PRELIM  /* NOR Options */
 #else
 #define CONFIG_SYS_BR0_PRELIM  CONFIG_FLASH_BR_PRELIM  /* NOR Base Address */
 #define CONFIG_SYS_OR0_PRELIM  CONFIG_FLASH_OR_PRELIM  /* NOR Options */
-#define CONFIG_SYS_BR1_PRELIM  CONFIG_NAND_BR_PRELIM  /* NAND Base Address */
-#define CONFIG_SYS_OR1_PRELIM  CONFIG_NAND_OR_PRELIM  /* NAND Options */
+#define CONFIG_SYS_BR1_PRELIM  CONFIG_SYS_NAND_BR_PRELIM /* NAND Base Address */
+#define CONFIG_SYS_OR1_PRELIM  CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */
 #endif
 
 #define CONFIG_SYS_VSC7385_BASE	0xffb00000
diff --git a/include/configs/P2020DS.h b/include/configs/P2020DS.h
index b32a997..ff20e97 100644
--- a/include/configs/P2020DS.h
+++ b/include/configs/P2020DS.h
@@ -305,12 +305,12 @@
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
 
 /* NAND flash config */
-#define CONFIG_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
+#define CONFIG_SYS_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
 				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 				| BR_PS_8		/* Port Size = 8bit */ \
 				| BR_MS_FCM		/* MSEL = FCM */ \
 				| BR_V)			/* valid */
-#define CONFIG_NAND_OR_PRELIM  (0xFFFC0000		/* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM  (0xFFFC0000		/* length 256K */ \
 				| OR_FCM_PGS		/* Large Page*/ \
 				| OR_FCM_CSCT \
 				| OR_FCM_CST \
@@ -321,28 +321,28 @@
 
 #define CONFIG_SYS_BR0_PRELIM  CONFIG_FLASH_BR_PRELIM  /* NOR Base Address */
 #define CONFIG_SYS_OR0_PRELIM  CONFIG_FLASH_OR_PRELIM  /* NOR Options */
-#define CONFIG_SYS_BR2_PRELIM  CONFIG_NAND_BR_PRELIM  /* NAND Base Address */
-#define CONFIG_SYS_OR2_PRELIM  CONFIG_NAND_OR_PRELIM  /* NAND Options */
+#define CONFIG_SYS_BR2_PRELIM  CONFIG_SYS_NAND_BR_PRELIM  /* NAND Base Address */
+#define CONFIG_SYS_OR2_PRELIM  CONFIG_SYS_NAND_OR_PRELIM  /* NAND Options */
 
 #define CONFIG_SYS_BR4_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0x40000))\
 				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 				| BR_PS_8		/* Port Size = 8bit */ \
 				| BR_MS_FCM		/* MSEL = FCM */ \
 				| BR_V)			/* valid */
-#define CONFIG_SYS_OR4_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR4_PRELIM  CONFIG_SYS_NAND_OR_PRELIM	/* NAND Options */
 #define CONFIG_SYS_BR5_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0x80000))\
 				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 				| BR_PS_8		/* Port Size = 8bit */ \
 				| BR_MS_FCM		/* MSEL = FCM */ \
 				| BR_V)			/* valid */
-#define CONFIG_SYS_OR5_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR5_PRELIM  CONFIG_SYS_NAND_OR_PRELIM	/* NAND Options */
 
 #define CONFIG_SYS_BR6_PRELIM  (BR_PHYS_ADDR((CONFIG_SYS_NAND_BASE_PHYS + 0xc0000))\
 				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
 				| BR_PS_8		/* Port Size = 8bit */ \
 				| BR_MS_FCM		/* MSEL = FCM */ \
 				| BR_V)			/* valid */
-#define CONFIG_SYS_OR6_PRELIM  CONFIG_NAND_OR_PRELIM	/* NAND Options */
+#define CONFIG_SYS_OR6_PRELIM  CONFIG_SYS_NAND_OR_PRELIM	/* NAND Options */
 
 /* Serial Port - controlled on board with jumper J8
  * open - index 2
-- 
1.7.3.4

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

* [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 19:39       ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Matthew McClintock
@ 2011-04-05 19:39         ` Matthew McClintock
  2011-04-09 15:53           ` Kumar Gala
  2011-04-11 18:56           ` Scott Wood
  2011-04-08  7:52         ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Kumar Gala
  1 sibling, 2 replies; 10+ messages in thread
From: Matthew McClintock @ 2011-04-05 19:39 UTC (permalink / raw)
  To: u-boot

Change variables to const to reduce code size, these values are
hardcoded via defines anyways so we might as well assume they
are constants

Signed-off-by: Matthew McClintock <msm@freescale.com>
cc: Scott Wood <scottwood@freescale.com>
---
With this change we can reduce the size of the nand_spl by
148 bytes with my particular board/compiler

v1: Add prior patch to correct naming of CONFIG_SYS_NAND_*_PRELIM

 nand_spl/nand_boot_fsl_elbc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/nand_spl/nand_boot_fsl_elbc.c b/nand_spl/nand_boot_fsl_elbc.c
index 9547d44..502605b 100644
--- a/nand_spl/nand_boot_fsl_elbc.c
+++ b/nand_spl/nand_boot_fsl_elbc.c
@@ -51,11 +51,11 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
-	int large = in_be32(&regs->bank[0].or) & OR_FCM_PGS;
-	int block_shift = large ? 17 : 14;
-	int block_size = 1 << block_shift;
-	int page_size = large ? 2048 : 512;
-	int bad_marker = large ? page_size + 0 : page_size + 5;
+	const int large = CONFIG_SYS_NAND_OR_PRELIM & OR_FCM_PGS;
+	const int block_shift = large ? 17 : 14;
+	const int block_size = 1 << block_shift;
+	const int page_size = large ? 2048 : 512;
+	const int bad_marker = large ? page_size + 0 : page_size + 5;
 	int fmr = (15 << FMR_CWTO_SHIFT) | (2 << FMR_AL_SHIFT) | 2;
 	int pos = 0;
 
-- 
1.7.3.4

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

* [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS
  2011-04-05 19:39       ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Matthew McClintock
  2011-04-05 19:39         ` [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
@ 2011-04-08  7:52         ` Kumar Gala
  1 sibling, 0 replies; 10+ messages in thread
From: Kumar Gala @ 2011-04-08  7:52 UTC (permalink / raw)
  To: u-boot


On Apr 5, 2011, at 2:39 PM, Matthew McClintock wrote:

> renaming 85xx define CONFIG_NAND_OR_PRELIM to
> CONFIG_SYS_NAND_OR_PRELIM and CONFIG_NAND_BR_PRELIM to
> CONFIG_SYS_NAND_BR_PRELIM to use the more appropriate
> CONFIG_SYS prefix as well as be consistent with 83xx
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> cc: Scott Wood <scottwood@freescale.com>
> cc: Kumar Gala <kumar.gala@freescale.com>
> ---
> arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |    8 ++++----
> include/configs/MPC8536DS.h              |   18 +++++++++---------
> include/configs/MPC8569MDS.h             |   12 ++++++------
> include/configs/MPC8572DS.h              |   18 +++++++++---------
> include/configs/P1_P2_RDB.h              |   12 ++++++------
> include/configs/P2020DS.h                |   14 +++++++-------
> 6 files changed, 41 insertions(+), 41 deletions(-)

applied to 85xx

- k

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

* [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 19:39         ` [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
@ 2011-04-09 15:53           ` Kumar Gala
  2011-04-11 16:36             ` Scott Wood
  2011-04-11 18:56           ` Scott Wood
  1 sibling, 1 reply; 10+ messages in thread
From: Kumar Gala @ 2011-04-09 15:53 UTC (permalink / raw)
  To: u-boot


On Apr 5, 2011, at 2:39 PM, Matthew McClintock wrote:

> Change variables to const to reduce code size, these values are
> hardcoded via defines anyways so we might as well assume they
> are constants
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> cc: Scott Wood <scottwood@freescale.com>
> ---
> With this change we can reduce the size of the nand_spl by
> 148 bytes with my particular board/compiler
> 
> v1: Add prior patch to correct naming of CONFIG_SYS_NAND_*_PRELIM
> 
> nand_spl/nand_boot_fsl_elbc.c |   10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)

Scott, do you want this to go via nand tree or 85xx ok?  if 85xx ok please ack.

- k

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

* [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-09 15:53           ` Kumar Gala
@ 2011-04-11 16:36             ` Scott Wood
  0 siblings, 0 replies; 10+ messages in thread
From: Scott Wood @ 2011-04-11 16:36 UTC (permalink / raw)
  To: u-boot

On Sat, 9 Apr 2011 10:53:34 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> 
> On Apr 5, 2011, at 2:39 PM, Matthew McClintock wrote:
> 
> > Change variables to const to reduce code size, these values are
> > hardcoded via defines anyways so we might as well assume they
> > are constants
> > 
> > Signed-off-by: Matthew McClintock <msm@freescale.com>
> > cc: Scott Wood <scottwood@freescale.com>
> > ---
> > With this change we can reduce the size of the nand_spl by
> > 148 bytes with my particular board/compiler
> > 
> > v1: Add prior patch to correct naming of CONFIG_SYS_NAND_*_PRELIM
> > 
> > nand_spl/nand_boot_fsl_elbc.c |   10 +++++-----
> > 1 files changed, 5 insertions(+), 5 deletions(-)
> 
> Scott, do you want this to go via nand tree or 85xx ok?  if 85xx ok please ack.

I'll take it.

-Scott

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

* [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size
  2011-04-05 19:39         ` [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
  2011-04-09 15:53           ` Kumar Gala
@ 2011-04-11 18:56           ` Scott Wood
  1 sibling, 0 replies; 10+ messages in thread
From: Scott Wood @ 2011-04-11 18:56 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 05, 2011 at 02:39:34PM -0500, Matthew McClintock wrote:
> Change variables to const to reduce code size, these values are
> hardcoded via defines anyways so we might as well assume they
> are constants
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> cc: Scott Wood <scottwood@freescale.com>
> ---
> With this change we can reduce the size of the nand_spl by
> 148 bytes with my particular board/compiler
> 
> v1: Add prior patch to correct naming of CONFIG_SYS_NAND_*_PRELIM

Applied to u-boot-nand-flash

-Scott

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

end of thread, other threads:[~2011-04-11 18:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 15:30 [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
2011-04-05 18:48 ` Scott Wood
2011-04-05 19:00   ` McClintock Matthew-B29882
2011-04-05 19:03     ` Scott Wood
2011-04-05 19:39       ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Matthew McClintock
2011-04-05 19:39         ` [U-Boot] [PATCH v1 2/2] nand/spl: Assuming a static nand page size to reduce code size Matthew McClintock
2011-04-09 15:53           ` Kumar Gala
2011-04-11 16:36             ` Scott Wood
2011-04-11 18:56           ` Scott Wood
2011-04-08  7:52         ` [U-Boot] [PATCH v1 1/2] powerpc/85xx: rename NAND prefixes to CONFIG_SYS Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).