diff options
Diffstat (limited to 'arch/arm/plat-omap/common.c')
-rw-r--r-- | arch/arm/plat-omap/common.c | 22 |
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 | ||
47 | unsigned char omap_bootloader_tag[512]; | ||
48 | int omap_bootloader_tag_len; | ||
49 | |||
50 | struct omap_board_config_kernel *omap_board_config; | 47 | struct omap_board_config_kernel *omap_board_config; |
51 | int omap_board_config_size; | 48 | int 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 | */ | ||
105 | static u32 offset_32k __read_mostly; | ||
106 | |||
103 | #ifdef CONFIG_ARCH_OMAP16XX | 107 | #ifdef CONFIG_ARCH_OMAP16XX |
104 | static cycle_t omap16xx_32k_read(struct clocksource *cs) | 108 | static 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 |
113 | static cycle_t omap2420_32k_read(struct clocksource *cs) | 117 | static 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 |
122 | static cycle_t omap2430_32k_read(struct clocksource *cs) | 126 | static 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 |
131 | static cycle_t omap34xx_32k_read(struct clocksource *cs) | 135 | static 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 |
140 | static cycle_t omap44xx_32k_read(struct clocksource *cs) | 144 | static 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 | } |