|
|
|
@ -226,6 +226,7 @@ int get_clocks_866 (void) |
|
|
|
|
volatile immap_t *immr = (immap_t *) CFG_IMMR; |
|
|
|
|
char tmp[64]; |
|
|
|
|
long cpuclk = 0; |
|
|
|
|
long sccr_reg; |
|
|
|
|
|
|
|
|
|
if (getenv_r ("cpuclk", tmp, sizeof (tmp)) > 0) |
|
|
|
|
cpuclk = simple_strtoul (tmp, NULL, 10) * 1000000; |
|
|
|
@ -238,10 +239,19 @@ int get_clocks_866 (void) |
|
|
|
|
gd->cpu_clk = measure_gclk (); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if ((immr->im_clkrst.car_sccr & SCCR_EBDF11) == 0) |
|
|
|
|
/* if cpu clock <= 66 MHz then set bus division factor to 1,
|
|
|
|
|
* otherwise set it to 2 |
|
|
|
|
*/ |
|
|
|
|
sccr_reg = immr->im_clkrst.car_sccr; |
|
|
|
|
sccr_reg &= ~SCCR_EBDF11; |
|
|
|
|
if (gd->cpu_clk <= 66000000) { |
|
|
|
|
sccr_reg |= SCCR_EBDF00; /* bus division factor = 1 */ |
|
|
|
|
gd->bus_clk = gd->cpu_clk; |
|
|
|
|
else |
|
|
|
|
} else { |
|
|
|
|
sccr_reg |= SCCR_EBDF01; /* bus division factor = 2 */ |
|
|
|
|
gd->bus_clk = gd->cpu_clk / 2; |
|
|
|
|
} |
|
|
|
|
immr->im_clkrst.car_sccr = sccr_reg; |
|
|
|
|
|
|
|
|
|
return (0); |
|
|
|
|
} |
|
|
|
|