]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
updates the at91 main_clock calculation
authorJens Scharsig <js_at_ng@scharsoft.de>
Sun, 14 Feb 2010 11:20:43 +0000 (12:20 +0100)
committerTom Rix <Tom.Rix@windriver.com>
Sun, 7 Mar 2010 18:36:36 +0000 (12:36 -0600)
* 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
include/asm-arm/arch-at91/at91_pmc.h

index 444d42d9ecca4ec2f48841a74a84b81129f9f880..b06d7601b915aef15abf314236dde1baed57407a 100644 (file)
@@ -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;
index 369b5d72efc571b2326ea46e5875bb5384e2b614..680fe33270d54f87ef5f95573fa9467dc53458bd 100644 (file)
@@ -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