]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
at91: Enable slow master clock on meesc board
authorDaniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
Wed, 20 Jan 2010 07:00:11 +0000 (08:00 +0100)
committerTom Rix <Tom.Rix@windriver.com>
Sat, 23 Jan 2010 14:15:50 +0000 (08:15 -0600)
Normally the processor clock has a divisor of 2.
In some cases this this needs to be set to 4.
Check the user has set environment mdiv to 4 to change the divisor.

Signed-off-by: Daniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
board/esd/meesc/meesc.c
include/configs/meesc.h

index efba60df9948879c7ee41272b89b2d949d990740..a1b66cbc40fa64ae93fc2acae3c3ae5d0fac3f36 100644 (file)
@@ -219,6 +219,32 @@ u32 get_board_rev(void)
 }
 #endif
 
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+       char *str;
+       char buf[32];
+
+       /*
+        * Normally the processor clock has a divisor of 2.
+        * In some cases this this needs to be set to 4.
+        * Check the user has set environment mdiv to 4 to change the divisor.
+        */
+       if ((str = getenv("mdiv")) && (strcmp(str, "4") == 0)) {
+               at91_sys_write(AT91_PMC_MCKR,
+                       (at91_sys_read(AT91_PMC_MCKR) & ~AT91_PMC_MDIV) |
+                       AT91SAM9_PMC_MDIV_4);
+               at91_clock_init(0);
+               serial_setbrg();
+               /* Notify the user that the clock is not default */
+               printf("Setting master clock to %s MHz\n",
+                       strmhz(buf, get_mck_clk_rate()));
+       }
+
+       return 0;
+}
+#endif /* CONFIG_MISC_INIT_R */
+
 int board_init(void)
 {
        /* Peripheral Clock Enable Register */
index ab5cbca1860004dc0da1e452b0420e800f6112fd..c3255fad6441756ff8964d9f31bc548755866cb8 100644 (file)
@@ -48,6 +48,7 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SKIP_RELOCATE_UBOOT
+#define CONFIG_MISC_INIT_R                     /* Call misc_init_r */
 
 #define CONFIG_ARCH_CPU_INIT