Skip to contentSkip to conversation

ppc32: cpci690 updates

PATCH New Mark A. Greer 1 participant 1 message Sep 2, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc32: cpci690 updates

Update the cpci690 platform code:
- pass mem size in from bootwrapper via bi_rec
- some minor fixups

--

arch/ppc/boot/simple/misc-cpci690.c +41 -1
diff -Nur linux-2.6.13-mm1/arch/ppc/boot/simple/misc-cpci690.c linux-2.6.13-mm1-mag/arch/ppc/boot/simple/misc-cpci690.c
@@ -12,16 +12,56 @@
  */
 
 #include <linux/types.h>
+#include <asm/io.h>
 #include <platforms/cpci690.h>
 
+#define	KB	(1024UL)
+#define	MB	(1024UL*KB)
+#define	GB	(1024UL*MB)
+
 extern u32 mv64x60_console_baud;
 extern u32 mv64x60_mpsc_clk_src;
 extern u32 mv64x60_mpsc_clk_freq;
 
+u32 mag = 0xffff;
+
+unsigned long
+get_mem_size(void)
+{
+	u32	size;
+
+	switch (in_8(((void __iomem *)CPCI690_BR_BASE + CPCI690_BR_MEM_CTLR))
+			& 0x07) {
+	case 0x01:
+		size = 256*MB;
+		break;
+	case 0x02:
+		size = 512*MB;
+		break;
+	case 0x03:
+		size = 768*MB;
+		break;
+	case 0x04:
+		size = 1*GB;
+		break;
+	case 0x05:
+		size = 1*GB + 512*MB;
+		break;
+	case 0x06:
+		size = 2*GB;
+		break;
+	default:
+		size = 0;
+	}
+
+	return size;
+}
+
 void
 mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
 {
 	mv64x60_console_baud = CPCI690_MPSC_BAUD;
 	mv64x60_mpsc_clk_src = CPCI690_MPSC_CLK_SRC;
-	mv64x60_mpsc_clk_freq = CPCI690_BUS_FREQ;
+	mv64x60_mpsc_clk_freq =
+		(get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
 }
arch/ppc/configs/cpci690_defconfig +214 -102

625 lines not on this page · raw message

arch/ppc/platforms/cpci690.c +71 -106

272 lines not on this page · raw message

arch/ppc/platforms/cpci690.h +0 -2
diff -Nur linux-2.6.13-mm1/arch/ppc/platforms/cpci690.h linux-2.6.13-mm1-mag/arch/ppc/platforms/cpci690.h
@@ -73,6 +73,4 @@
 #define	CPCI690_MPSC_BAUD			9600
 #define	CPCI690_MPSC_CLK_SRC			8 /* TCLK */
 
-#define	CPCI690_BUS_FREQ			133333333
-
 #endif /* __PPC_PLATFORMS_CPCI690_H */