I've changed the patch so that it is less intrusive. It now simply
adds the new function to the "init_sequence" if defined.

Signed-off-by: John Ogness <[EMAIL PROTECTED]>
diff -Nur a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
--- a/cpu/mpc85xx/cpu.c	2008-07-11 11:15:15.000000000 +0200
+++ b/cpu/mpc85xx/cpu.c	2008-07-11 11:23:27.000000000 +0200
@@ -69,6 +69,35 @@
 	return NULL;
 }
 
+#ifdef CONFIG_LBC_CLOCK_RATIO
+void set_lbc_clock_ratio (void)
+{
+	volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+	uint clkratio = CONFIG_LBC_CLOCK_RATIO;
+	uint lcrr;
+
+	switch (clkratio) {
+		case 4:
+		case 8:
+		case 16:
+			lcrr = lbc->lcrr;
+			lcrr &= ~0xf;
+			lcrr |= (clkratio >> 1);
+			lbc->lcrr = lcrr;
+			lcrr = lbc->lcrr;
+			 __asm__ __volatile__ ("isync" : : : "memory");
+			break;
+
+		default:
+			/* invalid CCB:LBC clock ratio */
+			printf("Error: invalid CCB:LBC clock ratio "
+				"(CONFIG_LBC_CLOCK_RATIO=%d)\n",
+				clkratio);
+			break;
+	}
+}
+#endif
+
 int checkcpu (void)
 {
 	sys_info_t sysinfo;
diff -Nur a/lib_ppc/board.c b/lib_ppc/board.c
--- a/lib_ppc/board.c	2008-07-11 11:14:52.000000000 +0200
+++ b/lib_ppc/board.c	2008-07-11 11:23:27.000000000 +0200
@@ -83,6 +83,10 @@
 extern void sc3_read_eeprom(void);
 #endif
 
+#ifdef CONFIG_LBC_CLOCK_RATIO
+extern void set_lbc_clock_ratio (void);
+#endif
+
 #if defined(CONFIG_CMD_DOC)
 void doc_init (void);
 #endif
@@ -329,6 +333,9 @@
 #if defined(CONFIG_MPC83XX)
 	prt_83xx_rsr,
 #endif
+#ifdef CONFIG_LBC_CLOCK_RATIO
+	set_lbc_clock_ratio,
+#endif
 	checkcpu,
 #if defined(CONFIG_MPC5xxx)
 	prt_mpc5xxx_clks,
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to