public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Aras Vaichas <arasv@magtech.com.au>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Modify Clock rate
Date: Wed, 16 Apr 2008 09:41:22 +1000	[thread overview]
Message-ID: <48053D22.6090708@magtech.com.au> (raw)
In-Reply-To: <20080414223239.0a916549@uncle-pecos.Colorado.EDU>

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 
______________________________________________________________________

      reply	other threads:[~2008-04-15 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-15  4:32 [U-Boot-Users] Modify Clock rate Loren A. Linden Levy
2008-04-15 23:41 ` Aras Vaichas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48053D22.6090708@magtech.com.au \
    --to=arasv@magtech.com.au \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox