[PATCH 4/5] PPC/PCM030: fix reference clock

Juergen Borleis jbe at pengutronix.de
Fri Jul 24 06:42:05 PDT 2015


The PCM030 CPU module comes with a 33.333 MHz instead of a 33.333333 MHz
crystal reference. If such a special reference is in use, the USB PLL
needs a tweak to create a correct frequency. Without this tweak the USB
does not work correctly.

Signed-off-by: Juergen Borleis <jbe at pengutronix.de>
---
 arch/ppc/boards/pcm030/config.h | 2 +-
 arch/ppc/boards/pcm030/pcm030.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/ppc/boards/pcm030/config.h b/arch/ppc/boards/pcm030/config.h
index 1521811..3fe1f28 100644
--- a/arch/ppc/boards/pcm030/config.h
+++ b/arch/ppc/boards/pcm030/config.h
@@ -25,7 +25,7 @@
 
 #include <mach/mpc5xxx.h>
 
-#define CFG_MPC5XXX_CLKIN	33333333 /* ... running at 33.333333MHz */
+#define CFG_MPC5XXX_CLKIN	33333000 /* ... running at 33.333MHz */
 
 #define CFG_HID0_INIT		HID0_ICE | HID0_ICFI
 #define CFG_HID0_FINAL		HID0_ICE
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c
index a7fa21d..376891a 100644
--- a/arch/ppc/boards/pcm030/pcm030.c
+++ b/arch/ppc/boards/pcm030/pcm030.c
@@ -32,6 +32,7 @@
 #include <memory.h>
 #include <linux/sizes.h>
 #include <linux/stat.h>
+#include <asm/io.h>
 #include <fs.h>
 
 static struct fec_platform_data fec_info = {
@@ -43,6 +44,14 @@ static int devices_init (void)
 	struct stat s;
 	int ret;
 
+#if CFG_MPC5XXX_CLKIN == 33333000
+	/*
+	 * Make USB work due to the special base crystal frequency:
+	 * 33,3330MHz * 16 = 533,328MHz main clock, but should be 528 MHz Clock
+	 */
+	out_be32((void *)MPC5XXX_CDM_48_FDC, 0x00015555);
+#endif
+
 	/*
 	 * Flash can be 16MB or 32MB, setup for the last 32MB no matter
 	 * what we find later.
-- 
2.1.4




More information about the barebox mailing list