* [PATCH] ARM omap: add omap4_get_sysclk()
@ 2013-04-04 6:42 Christoph Fritz
0 siblings, 0 replies; only message in thread
From: Christoph Fritz @ 2013-04-04 6:42 UTC (permalink / raw)
To: Sascha Hauer, barebox
This patch adds a function to get actual system clock.
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
arch/arm/mach-omap/include/mach/omap4-clock.h | 4 ++++
arch/arm/mach-omap/omap4_clock.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/arch/arm/mach-omap/include/mach/omap4-clock.h b/arch/arm/mach-omap/include/mach/omap4-clock.h
index 8f49aa3..9e53e16 100644
--- a/arch/arm/mach-omap/include/mach/omap4-clock.h
+++ b/arch/arm/mach-omap/include/mach/omap4-clock.h
@@ -4,7 +4,10 @@
/* PRCM */
#define CM_SYS_CLKSEL 0x4a306110
+#define CM_SYS_CLKSEL_12M 0x1
+#define CM_SYS_CLKSEL_16M8 0x3
#define CM_SYS_CLKSEL_19M2 0x4
+#define CM_SYS_CLKSEL_26M 0x5
#define CM_SYS_CLKSEL_38M4 0x7
/* PRM.CKGEN module registers */
@@ -341,5 +344,6 @@ void omap4_enable_gpio1_wup_clocks(void);
void omap4_enable_gpio_clocks(void);
void omap4_enable_all_clocks(void);
void omap4_do_scale_tps62361(u32 reg, u32 volt_mv);
+int omap4_get_sysclk(void);
#endif /* __MACH_OMAP4_CLOCK_H */
diff --git a/arch/arm/mach-omap/omap4_clock.c b/arch/arm/mach-omap/omap4_clock.c
index 889d1f9..37af756 100644
--- a/arch/arm/mach-omap/omap4_clock.c
+++ b/arch/arm/mach-omap/omap4_clock.c
@@ -413,3 +413,22 @@ void omap4_do_scale_tps62361(u32 reg, u32 volt_mv)
OMAP44XX_PRM_VC_VAL_BYPASS, LDELAY))
debug("Scaling voltage failed for vdd_mpu from TPS\n");
}
+
+int omap4_get_sysclk(void)
+{
+ int omap4_cm_sys_clks[] = {
+ -1,
+ 12000000, /* CM_SYS_CLKSEL_12M */
+ -1,
+ 16800000, /* CM_SYS_CLKSEL_16M8 */
+ 19200000, /* CM_SYS_CLKSEL_19M2 */
+ 26000000, /* CM_SYS_CLKSEL_26M */
+ -1,
+ 38400000, /* CM_SYS_CLKSEL_38M4 */
+ };
+ int v = __raw_readl(CM_SYS_CLKSEL);
+
+ if (v >= ARRAY_SIZE(omap4_cm_sys_clks))
+ return -1;
+ return omap4_cm_sys_clks[v];
+}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-04-04 6:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 6:42 [PATCH] ARM omap: add omap4_get_sysclk() Christoph Fritz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox