public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jens Scharsig <js_at_ng@scharsoft.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH ARM] updates the at91  main_clock calculation
Date: Sun, 14 Feb 2010 12:20:43 +0100	[thread overview]
Message-ID: <4B77DC8B.6050209@scharsoft.de> (raw)

 * updates the conditional main_clock calculation (if AT91_MAIN_CLOCK defined) to c structure SoC access
 * add need register flags


Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
---
 cpu/arm926ejs/at91/clock.c           |    7 ++++---
 include/asm-arm/arch-at91/at91_pmc.h |    3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/cpu/arm926ejs/at91/clock.c b/cpu/arm926ejs/at91/clock.c
index 7e03907..f3988fc 100644
--- a/cpu/arm926ejs/at91/clock.c
+++ b/cpu/arm926ejs/at91/clock.c
@@ -157,9 +157,10 @@ int at91_clock_init(unsigned long main_clock)
 	 */
 	if (!main_clock) {
 		do {
-			tmp = at91_sys_read(AT91_CKGR_MCFR);
-		} while (!(tmp & AT91_PMC_MAINRDY));
-		main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16);
+			tmp = readl(&pmc->mcfr);
+		} while (!(tmp & AT91_PMC_MCFR_MAINRDY));
+		tmp &= AT91_PMC_MCFR_MAINF_MASK;
+		main_clock = tmp * (AT91_SLOW_CLOCK / 16);
 	}
 #endif
 	main_clk_rate_hz = main_clock;
diff --git a/include/asm-arm/arch-at91/at91_pmc.h b/include/asm-arm/arch-at91/at91_pmc.h
index 369b5d7..680fe33 100644
--- a/include/asm-arm/arch-at91/at91_pmc.h
+++ b/include/asm-arm/arch-at91/at91_pmc.h
@@ -71,6 +71,9 @@ typedef struct at91_pmc {
 #define AT91_PMC_PLLBR_USBDIV_2		0x10000000
 #define AT91_PMC_PLLBR_USBDIV_4		0x20000000
 
+#define AT91_PMC_MCFR_MAINRDY		0x00010000
+#define AT91_PMC_MCFR_MAINF_MASK	0x0000FFFF
+
 #define AT91_PMC_MCKR_CSS_SLOW		0x00000000
 #define AT91_PMC_MCKR_CSS_MAIN		0x00000001
 #define AT91_PMC_MCKR_CSS_PLLA		0x00000002
-- 
1.6.0.2

             reply	other threads:[~2010-02-14 11:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-14 11:20 Jens Scharsig [this message]
2010-02-16  6:17 ` [U-Boot] [PATCH ARM] updates the at91 main_clock calculation Daniel Gorsulowski
2010-02-16 15:23   ` Tom
2010-02-17  8:29     ` Daniel Gorsulowski
2010-02-17 19:08       ` Jens Scharsig
2010-02-17 21:17       ` Tom

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=4B77DC8B.6050209@scharsoft.de \
    --to=js_at_ng@scharsoft.de \
    --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