[U-Boot] [PATCH 5/5] New implementation for internal handling of environment variables.

Wolfgang Denk wd at denx.de
Tue Jul 20 23:43:14 CEST 2010


Dear Kim,

In message <20100720160808.b7ecf34c.kim.phillips at freescale.com> you wrote:
> 
> > However, I cannot see any gentenv() use before relocation for your
> > board, so the problem there is still unclear. I think I need your
> > help to debug this...
> 
> looks like arch/powerpc/cpu/mpc8xxx/ddr/options.c gets memory
> interleaving configuration from the environment, using getenv().

Ah! Can you please try the following patch - it's not intended to be a
fix, just to verify my hypothesis. Thanks in advance.

diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/options.c b/arch/powerpc/cpu/mpc8xxx/ddr/options.c
index 46731c8..0b9cb1d 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/options.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/options.c
@@ -24,6 +24,7 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 {
 	unsigned int i;
 	const char *p;
+	char tmp[64];
 
 	/* Chip select options. */
 
@@ -221,7 +222,8 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 	 * should be a subset of the requested configuration.
 	 */
 #if (CONFIG_NUM_DDR_CONTROLLERS > 1)
-	if ((p = getenv("memctl_intlv_ctl")) != NULL) {
+	i = getenv_r("memctl_intlv_ctl", tmp, sizeof (tmp));
+	if (i > 0) {
 		if (pdimm[0].n_ranks == 0) {
 			printf("There is no rank on CS0. Because only rank on "
 				"CS0 and ranks chip-select interleaved with CS0"
@@ -230,37 +232,38 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 			popts->memctl_interleaving = 0;
 		} else {
 			popts->memctl_interleaving = 1;
-			if (strcmp(p, "cacheline") == 0)
+			if (strcmp(tmp, "cacheline") == 0)
 				popts->memctl_interleaving_mode =
 					FSL_DDR_CACHE_LINE_INTERLEAVING;
-			else if (strcmp(p, "page") == 0)
+			else if (strcmp(tmp, "page") == 0)
 				popts->memctl_interleaving_mode =
 					FSL_DDR_PAGE_INTERLEAVING;
-			else if (strcmp(p, "bank") == 0)
+			else if (strcmp(tmp, "bank") == 0)
 				popts->memctl_interleaving_mode =
 					FSL_DDR_BANK_INTERLEAVING;
-			else if (strcmp(p, "superbank") == 0)
+			else if (strcmp(tmp, "superbank") == 0)
 				popts->memctl_interleaving_mode =
 					FSL_DDR_SUPERBANK_INTERLEAVING;
 			else
 				popts->memctl_interleaving_mode =
-						simple_strtoul(p, NULL, 0);
+						simple_strtoul(tmp, NULL, 0);
 		}
 	}
 #endif
 
-	if( ((p = getenv("ba_intlv_ctl")) != NULL) &&
+	i = getenv_r("ba_intlv_ctl", tmp, sizeof (tmp));
+	if (i > 0) && (CONFIG_CHIP_SELECTS_PER_CTRL > 1)) {
 		(CONFIG_CHIP_SELECTS_PER_CTRL > 1)) {
-		if (strcmp(p, "cs0_cs1") == 0)
+		if (strcmp(tmp, "cs0_cs1") == 0)
 			popts->ba_intlv_ctl = FSL_DDR_CS0_CS1;
-		else if (strcmp(p, "cs2_cs3") == 0)
+		else if (strcmp(tmp, "cs2_cs3") == 0)
 			popts->ba_intlv_ctl = FSL_DDR_CS2_CS3;
-		else if (strcmp(p, "cs0_cs1_and_cs2_cs3") == 0)
+		else if (strcmp(tmp, "cs0_cs1_and_cs2_cs3") == 0)
 			popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_AND_CS2_CS3;
-		else if (strcmp(p, "cs0_cs1_cs2_cs3") == 0)
+		else if (strcmp(tmp, "cs0_cs1_cs2_cs3") == 0)
 			popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_CS2_CS3;
 		else
-			popts->ba_intlv_ctl = simple_strtoul(p, NULL, 0);
+			popts->ba_intlv_ctl = simple_strtoul(tmp, NULL, 0);
 
 		switch (popts->ba_intlv_ctl & FSL_DDR_CS0_CS1_CS2_CS3) {
 		case FSL_DDR_CS0_CS1_CS2_CS3:


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche


More information about the U-Boot mailing list