ARM omap: add omap4_get_sysclk()
Subsystems (3)
PATCH 1/1 ARM omap: add omap4_get_sysclk()
This patch adds a function to get actual system clock.
Signed-off-by Christoph Fritz <[email protected]>
--- arch/arm/mach-omap/include/mach/omap4-clock.h | 4 ++++ arch/arm/mach-omap/omap4_clock.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)
arch/arm/mach-omap/include/mach/omap4-clock.h +4 -0
@@ -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 */
arch/arm/mach-omap/omap4_clock.c +19 -0
@@ -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]; +}
Signature · 9 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox