Skip to contentSkip to conversation

ppc4xx: Fix zeus (405EP) board port

PATCH New Stefan Roese 1 participant 1 message Sep 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc4xx: Fix zeus (405EP) board port

This patch fixes a problem with the SDRAM initialization of the zeus board port. It also enable the FDT support to support booting arch/powerpc Linux kernel versions.

---
 board/zeus/zeus.c      |   23 -----------------------
 cpu/ppc4xx/sdram.c     |   14 ++++++++++----
 include/configs/zeus.h |    6 ++++++
 3 files changed, 16 insertions(+), 27 deletions(-)
board/zeus/zeus.c +0 -23
index 33d971a..2a4ec5c 100644
@@ -190,29 +190,6 @@ int checkboard(void)
 	return (0);
 }
 
-static u32 detect_sdram_size(void)
-{
-	u32 val;
-	u32 size;
-
-	mfsdram(mem_mb0cf, val);
-	size = (4 << 20) << ((val & 0x000e0000) >> 17);
-
-	/*
-	 * Check if 2nd bank is enabled too
-	 */
-	mfsdram(mem_mb1cf, val);
-	if (val & 1)
-		size += (4 << 20) << ((val & 0x000e0000) >> 17);
-
-	return size;
-}
-
-phys_size_t initdram (int board_type)
-{
-	return detect_sdram_size();
-}
-
 static int default_env_var(char *buf, char *var)
 {
 	char *ptr;
cpu/ppc4xx/sdram.c +10 -4
index 7d60ad6..b5a6a4c 100644
@@ -209,15 +209,15 @@ phys_size_t initdram(int board_type)
 		udelay(10000);
 
 		if (get_ram_size(0, mb0cf[i].size) == mb0cf[i].size) {
+			phys_size_t size = mb0cf[i].size;
+
 			/*
 			 * OK, size detected.  Enable second bank if
 			 * defined (assumes same type as bank 0)
 			 */
 #ifdef CONFIG_SDRAM_BANK1
-			u32 b1cr = mb0cf[i].size | mb0cf[i].reg;
-
 			mtsdram(mem_mcopt1, 0x00000000);
-			mtsdram(mem_mb1cf, b1cr); /* SDRAM0_B1CR */
+			mtsdram(mem_mb1cf, mb0cf[i].size | mb0cf[i].reg);
 			mtsdram(mem_mcopt1, 0x80800000);
 			udelay(10000);
 
@@ -230,13 +230,19 @@ phys_size_t initdram(int board_type)
 			    mb0cf[i].size) {
 				mtsdram(mem_mb1cf, 0);
 				mtsdram(mem_mcopt1, 0);
+			} else {
+				/*
+				 * We have two identical banks, so the size
+				 * is twice the bank size
+				 */
+				size = 2 * size;
 			}
 #endif
 
 			/*
 			 * OK, size detected -> all done
 			 */
-			return mb0cf[i].size;
+			return size;
 		}
 	}
 
include/configs/zeus.h +6 -0
index b50cba5..b71f711 100644
@@ -309,6 +309,12 @@
 #define CONFIG_KGDB_SER_INDEX	2		/* which serial port to use */
 #endif
 
+/*
+ * Pass open firmware flat tree
+ */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
+
 /* ENVIRONMENT VARS */
 
 #define CONFIG_PREBOOT		"echo;echo Welcome to Bulletendpoints board v1.1;echo"
Signature · 1 line
1.5.6.5