summaryrefslogtreecommitdiff
path: root/cpu/mcf5227x/speed.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@freescale.com>2008-11-10 10:04:51 -0600
committerJon Loeliger <jdl@freescale.com>2008-11-10 10:04:51 -0600
commit33211469f7d7e2afacf103cc55790f734572f7a6 (patch)
tree7c374cde48fba08b52b4f83bdf00aae89d7f85a3 /cpu/mcf5227x/speed.c
parent1266df887781c779deaf6d05eea2ef90a470cb34 (diff)
parent1378174a1351c0285736863a665ab758fe8d5f71 (diff)
downloadu-boot-imx-33211469f7d7e2afacf103cc55790f734572f7a6.zip
u-boot-imx-33211469f7d7e2afacf103cc55790f734572f7a6.tar.gz
u-boot-imx-33211469f7d7e2afacf103cc55790f734572f7a6.tar.bz2
Merge commit 'wd/master'
Diffstat (limited to 'cpu/mcf5227x/speed.c')
-rw-r--r--cpu/mcf5227x/speed.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/cpu/mcf5227x/speed.c b/cpu/mcf5227x/speed.c
index 74b9059..7e385d3 100644
--- a/cpu/mcf5227x/speed.c
+++ b/cpu/mcf5227x/speed.c
@@ -90,17 +90,33 @@ int get_clocks(void)
int vco, temp, pcrvalue, pfdr;
u8 bootmode;
- bootmode = (ccm->ccr & 0x000C) >> 2;
-
pcrvalue = pll->pcr & 0xFF0F0FFF;
pfdr = pcrvalue >> 24;
- if (pfdr != 0x1E) {
+ if (pfdr == 0x1E)
+ bootmode = 0; /* Normal Mode */
+
+#ifdef CONFIG_CF_SBF
+ bootmode = 3; /* Serial Mode */
+#endif
+
+ if (bootmode == 0) {
+ /* Normal mode */
+ vco = ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
+ if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) {
+ /* Default value */
+ pcrvalue = (pll->pcr & 0x00FFFFFF);
+ pcrvalue |= 0x1E << 24;
+ pll->pcr = pcrvalue;
+ vco =
+ ((pll->pcr & 0xFF000000) >> 24) *
+ CONFIG_SYS_INPUT_CLKSRC;
+ }
+ gd->vco_clk = vco; /* Vco clock */
+ } else if (bootmode == 3) {
/* serial mode */
- } else {
- /* Normal Mode */
- vco = pfdr * CONFIG_SYS_INPUT_CLKSRC;
- gd->vco_clk = vco;
+ vco = ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
+ gd->vco_clk = vco; /* Vco clock */
}
if ((ccm->ccr & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) {