Hi,

After reading over MPC85xx specs, I realized that the patch I sent
should use a better macro name. The new function was also a bit
confusing because it had the CLKDIV bits as its argument, instead of
the actual ratio.

Here is a new version of the patch that corrects these issues. Both
macro and function should now be clearer.

The patch is against git commit:
c956717ab25c962ef49d49064dfc73f4edcba1fb

John Ogness

Signed-off-by: John Ogness <[EMAIL PROTECTED]>

Add support for manually setting the CCB:LBC clock ratio.

This patch introduces a new macro CONFIG_LBC_CLOCK_RATIO, whose value
should be set to the desired clock divider. If the macro is not defined,
this patch has no effect. For the MPC85xx boards, the clock divider
defaults to a value of 16.

As an example, the new option can be used in the board config file like
this:

#define CONFIG_LBC_CLOCK_RATIO 4

Signed-off-by: John Ogness <[EMAIL PROTECTED]>
---
diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
index 0f72051..0f20c33 100644
--- a/cpu/mpc85xx/cpu.c
+++ b/cpu/mpc85xx/cpu.c
@@ -69,6 +69,31 @@ struct cpu_type *identify_cpu(u32 ver)
 	return NULL;
 }
 
+#ifdef CONFIG_LBC_CLOCK_RATIO
+void set_lbc_clock_ratio(uint clkratio)
+{
+	volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
+	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 */
+			break;
+	}
+}
+#endif
+
 int checkcpu (void)
 {
 	sys_info_t sysinfo;
@@ -91,6 +116,10 @@ int checkcpu (void)
 	major = SVR_MAJ(svr);
 	minor = SVR_MIN(svr);
 
+#ifdef CONFIG_LBC_CLOCK_RATIO
+	set_lbc_clock_ratio(CONFIG_LBC_CLOCK_RATIO);
+#endif
+
 	puts("CPU:   ");
 
 	cpu = identify_cpu(ver);
-------------------------------------------------------------------------
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