All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] at91: Enable slow master clock on meesc board
@ 2009-11-03  8:37 Daniel Gorsulowski
  0 siblings, 0 replies; only message in thread
From: Daniel Gorsulowski @ 2009-11-03  8:37 UTC (permalink / raw)
  To: u-boot

In some cases, we need low speed master clock. So depending on the
"mdiv" variable, the processor clock is divided by 2 (default) or 4.

Signed-off-by: Daniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
---
PS: Tom, are you still temporary at91 custodian?

 board/esd/meesc/meesc.c |   24 ++++++++++++++++++++++++
 include/configs/meesc.h |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index efba60d..4f6c5b7 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -219,6 +219,30 @@ u32 get_board_rev(void)
 }
 #endif
 
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+	char *str;
+	char buf[32];
+
+	/*
+	 * In some cases, we need low speed master clock. So depending on the
+	 * "mdiv" variable, the processor clock is divided by 2 (default) or 4.
+	 */
+	if ((str = getenv("mdiv")) && (!strcmp(str, "4"))) {
+		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();
+		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 */
diff --git a/include/configs/meesc.h b/include/configs/meesc.h
index b996854..034e81c 100644
--- a/include/configs/meesc.h
+++ b/include/configs/meesc.h
@@ -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
 
-- 
1.5.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-03  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03  8:37 [U-Boot] [PATCH] at91: Enable slow master clock on meesc board Daniel Gorsulowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.