aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/common.c')
-rw-r--r--arch/arm/plat-omap/common.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 088c1a03b946..f12f0e39ddf2 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -44,9 +44,6 @@
44 44
45#define NO_LENGTH_CHECK 0xffffffff 45#define NO_LENGTH_CHECK 0xffffffff
46 46
47unsigned char omap_bootloader_tag[512];
48int omap_bootloader_tag_len;
49
50struct omap_board_config_kernel *omap_board_config; 47struct omap_board_config_kernel *omap_board_config;
51int omap_board_config_size; 48int omap_board_config_size;
52 49
@@ -100,10 +97,17 @@ EXPORT_SYMBOL(omap_get_var_config);
100 97
101#include <linux/clocksource.h> 98#include <linux/clocksource.h>
102 99
100/*
101 * offset_32k holds the init time counter value. It is then subtracted
102 * from every counter read to achieve a counter that counts time from the
103 * kernel boot (needed for sched_clock()).
104 */
105static u32 offset_32k __read_mostly;
106
103#ifdef CONFIG_ARCH_OMAP16XX 107#ifdef CONFIG_ARCH_OMAP16XX
104static cycle_t omap16xx_32k_read(struct clocksource *cs) 108static cycle_t omap16xx_32k_read(struct clocksource *cs)
105{ 109{
106 return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED); 110 return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
107} 111}
108#else 112#else
109#define omap16xx_32k_read NULL 113#define omap16xx_32k_read NULL
@@ -112,7 +116,7 @@ static cycle_t omap16xx_32k_read(struct clocksource *cs)
112#ifdef CONFIG_ARCH_OMAP2420 116#ifdef CONFIG_ARCH_OMAP2420
113static cycle_t omap2420_32k_read(struct clocksource *cs) 117static cycle_t omap2420_32k_read(struct clocksource *cs)
114{ 118{
115 return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10); 119 return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
116} 120}
117#else 121#else
118#define omap2420_32k_read NULL 122#define omap2420_32k_read NULL
@@ -121,7 +125,7 @@ static cycle_t omap2420_32k_read(struct clocksource *cs)
121#ifdef CONFIG_ARCH_OMAP2430 125#ifdef CONFIG_ARCH_OMAP2430
122static cycle_t omap2430_32k_read(struct clocksource *cs) 126static cycle_t omap2430_32k_read(struct clocksource *cs)
123{ 127{
124 return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10); 128 return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
125} 129}
126#else 130#else
127#define omap2430_32k_read NULL 131#define omap2430_32k_read NULL
@@ -130,7 +134,7 @@ static cycle_t omap2430_32k_read(struct clocksource *cs)
130#ifdef CONFIG_ARCH_OMAP3 134#ifdef CONFIG_ARCH_OMAP3
131static cycle_t omap34xx_32k_read(struct clocksource *cs) 135static cycle_t omap34xx_32k_read(struct clocksource *cs)
132{ 136{
133 return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10); 137 return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
134} 138}
135#else 139#else
136#define omap34xx_32k_read NULL 140#define omap34xx_32k_read NULL
@@ -139,7 +143,7 @@ static cycle_t omap34xx_32k_read(struct clocksource *cs)
139#ifdef CONFIG_ARCH_OMAP4 143#ifdef CONFIG_ARCH_OMAP4
140static cycle_t omap44xx_32k_read(struct clocksource *cs) 144static cycle_t omap44xx_32k_read(struct clocksource *cs)
141{ 145{
142 return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10); 146 return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
143} 147}
144#else 148#else
145#define omap44xx_32k_read NULL 149#define omap44xx_32k_read NULL
@@ -227,6 +231,8 @@ static int __init omap_init_clocksource_32k(void)
227 clocksource_32k.mult = clocksource_hz2mult(32768, 231 clocksource_32k.mult = clocksource_hz2mult(32768,
228 clocksource_32k.shift); 232 clocksource_32k.shift);
229 233
234 offset_32k = clocksource_32k.read(&clocksource_32k);
235
230 if (clocksource_register(&clocksource_32k)) 236 if (clocksource_register(&clocksource_32k))
231 printk(err, clocksource_32k.name); 237 printk(err, clocksource_32k.name);
232 } 238 }