diff options
Diffstat (limited to 'arch/arm/plat-omap/common.c')
-rw-r--r-- | arch/arm/plat-omap/common.c | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 4f0f9c4e938e..bd1cef2c3c14 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -27,11 +27,16 @@ | |||
27 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
28 | 28 | ||
29 | #include <asm/arch/board.h> | 29 | #include <asm/arch/board.h> |
30 | #include <asm/arch/control.h> | ||
30 | #include <asm/arch/mux.h> | 31 | #include <asm/arch/mux.h> |
31 | #include <asm/arch/fpga.h> | 32 | #include <asm/arch/fpga.h> |
32 | 33 | ||
33 | #include <asm/arch/clock.h> | 34 | #include <asm/arch/clock.h> |
34 | 35 | ||
36 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
37 | # include "../mach-omap2/sdrc.h" | ||
38 | #endif | ||
39 | |||
35 | #define NO_LENGTH_CHECK 0xffffffff | 40 | #define NO_LENGTH_CHECK 0xffffffff |
36 | 41 | ||
37 | unsigned char omap_bootloader_tag[512]; | 42 | unsigned char omap_bootloader_tag[512]; |
@@ -171,8 +176,8 @@ console_initcall(omap_add_serial_console); | |||
171 | 176 | ||
172 | #if defined(CONFIG_ARCH_OMAP16XX) | 177 | #if defined(CONFIG_ARCH_OMAP16XX) |
173 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 | 178 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 |
174 | #elif defined(CONFIG_ARCH_OMAP24XX) | 179 | #elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
175 | #define TIMER_32K_SYNCHRONIZED (OMAP24XX_32KSYNCT_BASE + 0x10) | 180 | #define TIMER_32K_SYNCHRONIZED (OMAP2_32KSYNCT_BASE + 0x10) |
176 | #endif | 181 | #endif |
177 | 182 | ||
178 | #ifdef TIMER_32K_SYNCHRONIZED | 183 | #ifdef TIMER_32K_SYNCHRONIZED |
@@ -193,12 +198,35 @@ static struct clocksource clocksource_32k = { | |||
193 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 198 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
194 | }; | 199 | }; |
195 | 200 | ||
201 | /* | ||
202 | * Rounds down to nearest nsec. | ||
203 | */ | ||
204 | unsigned long long omap_32k_ticks_to_nsecs(unsigned long ticks_32k) | ||
205 | { | ||
206 | return cyc2ns(&clocksource_32k, ticks_32k); | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * Returns current time from boot in nsecs. It's OK for this to wrap | ||
211 | * around for now, as it's just a relative time stamp. | ||
212 | */ | ||
213 | unsigned long long sched_clock(void) | ||
214 | { | ||
215 | return omap_32k_ticks_to_nsecs(omap_32k_read()); | ||
216 | } | ||
217 | |||
196 | static int __init omap_init_clocksource_32k(void) | 218 | static int __init omap_init_clocksource_32k(void) |
197 | { | 219 | { |
198 | static char err[] __initdata = KERN_ERR | 220 | static char err[] __initdata = KERN_ERR |
199 | "%s: can't register clocksource!\n"; | 221 | "%s: can't register clocksource!\n"; |
200 | 222 | ||
201 | if (cpu_is_omap16xx() || cpu_is_omap24xx()) { | 223 | if (cpu_is_omap16xx() || cpu_class_is_omap2()) { |
224 | struct clk *sync_32k_ick; | ||
225 | |||
226 | sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); | ||
227 | if (sync_32k_ick) | ||
228 | clk_enable(sync_32k_ick); | ||
229 | |||
202 | clocksource_32k.mult = clocksource_hz2mult(32768, | 230 | clocksource_32k.mult = clocksource_hz2mult(32768, |
203 | clocksource_32k.shift); | 231 | clocksource_32k.shift); |
204 | 232 | ||
@@ -210,3 +238,33 @@ static int __init omap_init_clocksource_32k(void) | |||
210 | arch_initcall(omap_init_clocksource_32k); | 238 | arch_initcall(omap_init_clocksource_32k); |
211 | 239 | ||
212 | #endif /* TIMER_32K_SYNCHRONIZED */ | 240 | #endif /* TIMER_32K_SYNCHRONIZED */ |
241 | |||
242 | /* Global address base setup code */ | ||
243 | |||
244 | #if defined(CONFIG_ARCH_OMAP2420) | ||
245 | void __init omap2_set_globals_242x(void) | ||
246 | { | ||
247 | omap2_sdrc_base = OMAP2420_SDRC_BASE; | ||
248 | omap2_sms_base = OMAP2420_SMS_BASE; | ||
249 | omap_ctrl_base_set(OMAP2420_CTRL_BASE); | ||
250 | } | ||
251 | #endif | ||
252 | |||
253 | #if defined(CONFIG_ARCH_OMAP2430) | ||
254 | void __init omap2_set_globals_243x(void) | ||
255 | { | ||
256 | omap2_sdrc_base = OMAP243X_SDRC_BASE; | ||
257 | omap2_sms_base = OMAP243X_SMS_BASE; | ||
258 | omap_ctrl_base_set(OMAP243X_CTRL_BASE); | ||
259 | } | ||
260 | #endif | ||
261 | |||
262 | #if defined(CONFIG_ARCH_OMAP3430) | ||
263 | void __init omap2_set_globals_343x(void) | ||
264 | { | ||
265 | omap2_sdrc_base = OMAP343X_SDRC_BASE; | ||
266 | omap2_sms_base = OMAP343X_SMS_BASE; | ||
267 | omap_ctrl_base_set(OMAP343X_CTRL_BASE); | ||
268 | } | ||
269 | #endif | ||
270 | |||