[U-Boot-Users] Modify Clock rate

Aras Vaichas arasv at magtech.com.au
Wed Apr 16 01:41:22 CEST 2008


Loren A. Linden Levy wrote:
> Hi,
>
> Is there a way to modify the clock rate in u-boot? I want to
> artificially set the clock rate on an m5282 to 32MHz instead of
> 66MHz. Thanks for any advice.
>
>   
I don't know anything about this CPU at all but I know how to search for
things in source code.

What I did was:

$ grep -ir m5282 ./u-boot-source-code/

and discovered that this pattern appears in only a few unique files. A
file called cpu/mcf52x2/cpu_init.c looks like a likely candidate for
setting up CPU specific stuff to me.

I then had a quick look at this file and found an #if
defined(CONFIG_M5282) and a function called cpu_init_f(void). Looks like
a good place to start.

248 #if defined(CONFIG_M5282)
249 /*
250  * Breath some life into the CPU...
251  *
252  * Set up the memory map,
253  * initialize a bunch of registers,
254  * initialize the UPM's
255  */
256 void cpu_init_f(void)
257 {
258 #ifndef CONFIG_WATCHDOG
259         /* disable watchdog if we aren't using it */
260         MCFWTM_WCR = 0;
261 #endif
262
263 #ifndef CONFIG_MONITOR_IS_IN_RAM
264         /* Set speed /PLL */
265         MCFCLOCK_SYNCR =
266             MCFCLOCK_SYNCR_MFD(CFG_MFD) | MCFCLOCK_SYNCR_RFD(CFG_RFD);
267         while (!(MCFCLOCK_SYNSR & MCFCLOCK_SYNSR_LOCK)) ;


In fact, if you had of looked in the "doc" directory first, you would
have also seen this file doc/README.m68k which says:

143 CFG_MFD
144                 -- defines the PLL Multiplication Factor Devider
145                    (see table 9-4 of MCF user manual)
146 CFG_RFD         -- defines the PLL Reduce Frecuency Devider
147                    (see table 9-4 of MCF user manual)

I didn't know this CPU was an m68K based cpu, so I didn't know to do
this first. Did you know it was an m68K based CPU?

Then look up those registers to see where they might be set, usually
this occurs in the include directory:

$ grep -r CFG_MFD include/*
include/configs/EB+MCF-EV123.h:#define CFG_MFD                  0x01   
/* PLL Multiplication Factor Devider */
include/configs/M5282EVB.h:#define CFG_MFD                      0x02   
/* PLL Multiplication Factor Devider */

There you go. Easy. Make a copy of your config file, the board files and
you can make yourself a custom system.

Now just look up those registers in the PLL section of the datasheet for
your CPU.

Aras

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________




More information about the U-Boot mailing list