diff options
Diffstat (limited to 'arch/arm/plat-omap/common.c')
| -rw-r--r-- | arch/arm/plat-omap/common.c | 140 |
1 files changed, 100 insertions, 40 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 3a4768d55895..f12f0e39ddf2 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
| @@ -29,13 +29,14 @@ | |||
| 29 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
| 31 | 31 | ||
| 32 | #include <mach/common.h> | 32 | #include <plat/common.h> |
| 33 | #include <mach/board.h> | 33 | #include <plat/board.h> |
| 34 | #include <mach/control.h> | 34 | #include <plat/control.h> |
| 35 | #include <mach/mux.h> | 35 | #include <plat/mux.h> |
| 36 | #include <mach/fpga.h> | 36 | #include <plat/fpga.h> |
| 37 | #include <plat/serial.h> | ||
| 37 | 38 | ||
| 38 | #include <mach/clock.h> | 39 | #include <plat/clock.h> |
| 39 | 40 | ||
| 40 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 41 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
| 41 | # include "../mach-omap2/sdrc.h" | 42 | # include "../mach-omap2/sdrc.h" |
| @@ -43,12 +44,12 @@ | |||
| 43 | 44 | ||
| 44 | #define NO_LENGTH_CHECK 0xffffffff | 45 | #define NO_LENGTH_CHECK 0xffffffff |
| 45 | 46 | ||
| 46 | unsigned char omap_bootloader_tag[512]; | ||
| 47 | int omap_bootloader_tag_len; | ||
| 48 | |||
| 49 | struct omap_board_config_kernel *omap_board_config; | 47 | struct omap_board_config_kernel *omap_board_config; |
| 50 | int omap_board_config_size; | 48 | int omap_board_config_size; |
| 51 | 49 | ||
| 50 | /* used by omap-smp.c and board-4430sdp.c */ | ||
| 51 | void __iomem *gic_cpu_base_addr; | ||
| 52 | |||
| 52 | static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out) | 53 | static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out) |
| 53 | { | 54 | { |
| 54 | struct omap_board_config_kernel *kinfo = NULL; | 55 | struct omap_board_config_kernel *kinfo = NULL; |
| @@ -96,10 +97,17 @@ EXPORT_SYMBOL(omap_get_var_config); | |||
| 96 | 97 | ||
| 97 | #include <linux/clocksource.h> | 98 | #include <linux/clocksource.h> |
| 98 | 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 | |||
| 99 | #ifdef CONFIG_ARCH_OMAP16XX | 107 | #ifdef CONFIG_ARCH_OMAP16XX |
| 100 | static cycle_t omap16xx_32k_read(struct clocksource *cs) | 108 | static cycle_t omap16xx_32k_read(struct clocksource *cs) |
| 101 | { | 109 | { |
| 102 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED); | 110 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k; |
| 103 | } | 111 | } |
| 104 | #else | 112 | #else |
| 105 | #define omap16xx_32k_read NULL | 113 | #define omap16xx_32k_read NULL |
| @@ -108,7 +116,7 @@ static cycle_t omap16xx_32k_read(struct clocksource *cs) | |||
| 108 | #ifdef CONFIG_ARCH_OMAP2420 | 116 | #ifdef CONFIG_ARCH_OMAP2420 |
| 109 | static cycle_t omap2420_32k_read(struct clocksource *cs) | 117 | static cycle_t omap2420_32k_read(struct clocksource *cs) |
| 110 | { | 118 | { |
| 111 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10); | 119 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k; |
| 112 | } | 120 | } |
| 113 | #else | 121 | #else |
| 114 | #define omap2420_32k_read NULL | 122 | #define omap2420_32k_read NULL |
| @@ -117,16 +125,16 @@ static cycle_t omap2420_32k_read(struct clocksource *cs) | |||
| 117 | #ifdef CONFIG_ARCH_OMAP2430 | 125 | #ifdef CONFIG_ARCH_OMAP2430 |
| 118 | static cycle_t omap2430_32k_read(struct clocksource *cs) | 126 | static cycle_t omap2430_32k_read(struct clocksource *cs) |
| 119 | { | 127 | { |
| 120 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10); | 128 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 121 | } | 129 | } |
| 122 | #else | 130 | #else |
| 123 | #define omap2430_32k_read NULL | 131 | #define omap2430_32k_read NULL |
| 124 | #endif | 132 | #endif |
| 125 | 133 | ||
| 126 | #ifdef CONFIG_ARCH_OMAP34XX | 134 | #ifdef CONFIG_ARCH_OMAP3 |
| 127 | static cycle_t omap34xx_32k_read(struct clocksource *cs) | 135 | static cycle_t omap34xx_32k_read(struct clocksource *cs) |
| 128 | { | 136 | { |
| 129 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10); | 137 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 130 | } | 138 | } |
| 131 | #else | 139 | #else |
| 132 | #define omap34xx_32k_read NULL | 140 | #define omap34xx_32k_read NULL |
| @@ -135,7 +143,7 @@ static cycle_t omap34xx_32k_read(struct clocksource *cs) | |||
| 135 | #ifdef CONFIG_ARCH_OMAP4 | 143 | #ifdef CONFIG_ARCH_OMAP4 |
| 136 | static cycle_t omap44xx_32k_read(struct clocksource *cs) | 144 | static cycle_t omap44xx_32k_read(struct clocksource *cs) |
| 137 | { | 145 | { |
| 138 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10); | 146 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k; |
| 139 | } | 147 | } |
| 140 | #else | 148 | #else |
| 141 | #define omap44xx_32k_read NULL | 149 | #define omap44xx_32k_read NULL |
| @@ -169,6 +177,32 @@ unsigned long long sched_clock(void) | |||
| 169 | clocksource_32k.mult, clocksource_32k.shift); | 177 | clocksource_32k.mult, clocksource_32k.shift); |
| 170 | } | 178 | } |
| 171 | 179 | ||
| 180 | /** | ||
| 181 | * read_persistent_clock - Return time from a persistent clock. | ||
| 182 | * | ||
| 183 | * Reads the time from a source which isn't disabled during PM, the | ||
| 184 | * 32k sync timer. Convert the cycles elapsed since last read into | ||
| 185 | * nsecs and adds to a monotonically increasing timespec. | ||
| 186 | */ | ||
| 187 | static struct timespec persistent_ts; | ||
| 188 | static cycles_t cycles, last_cycles; | ||
| 189 | void read_persistent_clock(struct timespec *ts) | ||
| 190 | { | ||
| 191 | unsigned long long nsecs; | ||
| 192 | cycles_t delta; | ||
| 193 | struct timespec *tsp = &persistent_ts; | ||
| 194 | |||
| 195 | last_cycles = cycles; | ||
| 196 | cycles = clocksource_32k.read(&clocksource_32k); | ||
| 197 | delta = cycles - last_cycles; | ||
| 198 | |||
| 199 | nsecs = clocksource_cyc2ns(delta, | ||
| 200 | clocksource_32k.mult, clocksource_32k.shift); | ||
| 201 | |||
| 202 | timespec_add_ns(tsp, nsecs); | ||
| 203 | *ts = *tsp; | ||
| 204 | } | ||
| 205 | |||
| 172 | static int __init omap_init_clocksource_32k(void) | 206 | static int __init omap_init_clocksource_32k(void) |
| 173 | { | 207 | { |
| 174 | static char err[] __initdata = KERN_ERR | 208 | static char err[] __initdata = KERN_ERR |
| @@ -197,6 +231,8 @@ static int __init omap_init_clocksource_32k(void) | |||
| 197 | clocksource_32k.mult = clocksource_hz2mult(32768, | 231 | clocksource_32k.mult = clocksource_hz2mult(32768, |
| 198 | clocksource_32k.shift); | 232 | clocksource_32k.shift); |
| 199 | 233 | ||
| 234 | offset_32k = clocksource_32k.read(&clocksource_32k); | ||
| 235 | |||
| 200 | if (clocksource_register(&clocksource_32k)) | 236 | if (clocksource_register(&clocksource_32k)) |
| 201 | printk(err, clocksource_32k.name); | 237 | printk(err, clocksource_32k.name); |
| 202 | } | 238 | } |
| @@ -216,6 +252,7 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals) | |||
| 216 | omap2_set_globals_sdrc(omap2_globals); | 252 | omap2_set_globals_sdrc(omap2_globals); |
| 217 | omap2_set_globals_control(omap2_globals); | 253 | omap2_set_globals_control(omap2_globals); |
| 218 | omap2_set_globals_prcm(omap2_globals); | 254 | omap2_set_globals_prcm(omap2_globals); |
| 255 | omap2_set_globals_uart(omap2_globals); | ||
| 219 | } | 256 | } |
| 220 | 257 | ||
| 221 | #endif | 258 | #endif |
| @@ -224,12 +261,15 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals) | |||
| 224 | 261 | ||
| 225 | static struct omap_globals omap242x_globals = { | 262 | static struct omap_globals omap242x_globals = { |
| 226 | .class = OMAP242X_CLASS, | 263 | .class = OMAP242X_CLASS, |
| 227 | .tap = OMAP2_IO_ADDRESS(0x48014000), | 264 | .tap = OMAP2_L4_IO_ADDRESS(0x48014000), |
| 228 | .sdrc = OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE), | 265 | .sdrc = OMAP2420_SDRC_BASE, |
| 229 | .sms = OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE), | 266 | .sms = OMAP2420_SMS_BASE, |
| 230 | .ctrl = OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE), | 267 | .ctrl = OMAP2420_CTRL_BASE, |
| 231 | .prm = OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE), | 268 | .prm = OMAP2420_PRM_BASE, |
| 232 | .cm = OMAP2_IO_ADDRESS(OMAP2420_CM_BASE), | 269 | .cm = OMAP2420_CM_BASE, |
| 270 | .uart1_phys = OMAP2_UART1_BASE, | ||
| 271 | .uart2_phys = OMAP2_UART2_BASE, | ||
| 272 | .uart3_phys = OMAP2_UART3_BASE, | ||
| 233 | }; | 273 | }; |
| 234 | 274 | ||
| 235 | void __init omap2_set_globals_242x(void) | 275 | void __init omap2_set_globals_242x(void) |
| @@ -242,12 +282,15 @@ void __init omap2_set_globals_242x(void) | |||
| 242 | 282 | ||
| 243 | static struct omap_globals omap243x_globals = { | 283 | static struct omap_globals omap243x_globals = { |
| 244 | .class = OMAP243X_CLASS, | 284 | .class = OMAP243X_CLASS, |
| 245 | .tap = OMAP2_IO_ADDRESS(0x4900a000), | 285 | .tap = OMAP2_L4_IO_ADDRESS(0x4900a000), |
| 246 | .sdrc = OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE), | 286 | .sdrc = OMAP243X_SDRC_BASE, |
| 247 | .sms = OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE), | 287 | .sms = OMAP243X_SMS_BASE, |
| 248 | .ctrl = OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE), | 288 | .ctrl = OMAP243X_CTRL_BASE, |
| 249 | .prm = OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE), | 289 | .prm = OMAP2430_PRM_BASE, |
| 250 | .cm = OMAP2_IO_ADDRESS(OMAP2430_CM_BASE), | 290 | .cm = OMAP2430_CM_BASE, |
| 291 | .uart1_phys = OMAP2_UART1_BASE, | ||
| 292 | .uart2_phys = OMAP2_UART2_BASE, | ||
| 293 | .uart3_phys = OMAP2_UART3_BASE, | ||
| 251 | }; | 294 | }; |
| 252 | 295 | ||
| 253 | void __init omap2_set_globals_243x(void) | 296 | void __init omap2_set_globals_243x(void) |
| @@ -256,37 +299,54 @@ void __init omap2_set_globals_243x(void) | |||
| 256 | } | 299 | } |
| 257 | #endif | 300 | #endif |
| 258 | 301 | ||
| 259 | #if defined(CONFIG_ARCH_OMAP3430) | 302 | #if defined(CONFIG_ARCH_OMAP3) |
| 260 | 303 | ||
| 261 | static struct omap_globals omap343x_globals = { | 304 | static struct omap_globals omap3_globals = { |
| 262 | .class = OMAP343X_CLASS, | 305 | .class = OMAP343X_CLASS, |
| 263 | .tap = OMAP2_IO_ADDRESS(0x4830A000), | 306 | .tap = OMAP2_L4_IO_ADDRESS(0x4830A000), |
| 264 | .sdrc = OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE), | 307 | .sdrc = OMAP343X_SDRC_BASE, |
| 265 | .sms = OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE), | 308 | .sms = OMAP343X_SMS_BASE, |
| 266 | .ctrl = OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE), | 309 | .ctrl = OMAP343X_CTRL_BASE, |
| 267 | .prm = OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE), | 310 | .prm = OMAP3430_PRM_BASE, |
| 268 | .cm = OMAP2_IO_ADDRESS(OMAP3430_CM_BASE), | 311 | .cm = OMAP3430_CM_BASE, |
| 312 | .uart1_phys = OMAP3_UART1_BASE, | ||
| 313 | .uart2_phys = OMAP3_UART2_BASE, | ||
| 314 | .uart3_phys = OMAP3_UART3_BASE, | ||
| 269 | }; | 315 | }; |
| 270 | 316 | ||
| 271 | void __init omap2_set_globals_343x(void) | 317 | void __init omap2_set_globals_343x(void) |
| 272 | { | 318 | { |
| 273 | __omap2_set_globals(&omap343x_globals); | 319 | __omap2_set_globals(&omap3_globals); |
| 320 | } | ||
| 321 | |||
| 322 | void __init omap2_set_globals_36xx(void) | ||
| 323 | { | ||
| 324 | omap3_globals.uart4_phys = OMAP3_UART4_BASE; | ||
| 325 | |||
| 326 | __omap2_set_globals(&omap3_globals); | ||
| 274 | } | 327 | } |
| 275 | #endif | 328 | #endif |
| 276 | 329 | ||
| 277 | #if defined(CONFIG_ARCH_OMAP4) | 330 | #if defined(CONFIG_ARCH_OMAP4) |
| 278 | static struct omap_globals omap4_globals = { | 331 | static struct omap_globals omap4_globals = { |
| 279 | .class = OMAP443X_CLASS, | 332 | .class = OMAP443X_CLASS, |
| 280 | .tap = OMAP2_IO_ADDRESS(0x4830a000), | 333 | .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), |
| 281 | .ctrl = OMAP2_IO_ADDRESS(OMAP443X_CTRL_BASE), | 334 | .ctrl = OMAP443X_CTRL_BASE, |
| 282 | .prm = OMAP2_IO_ADDRESS(OMAP4430_PRM_BASE), | 335 | .prm = OMAP4430_PRM_BASE, |
| 283 | .cm = OMAP2_IO_ADDRESS(OMAP4430_CM_BASE), | 336 | .cm = OMAP4430_CM_BASE, |
| 337 | .cm2 = OMAP4430_CM2_BASE, | ||
| 338 | .uart1_phys = OMAP4_UART1_BASE, | ||
| 339 | .uart2_phys = OMAP4_UART2_BASE, | ||
| 340 | .uart3_phys = OMAP4_UART3_BASE, | ||
| 341 | .uart4_phys = OMAP4_UART4_BASE, | ||
| 284 | }; | 342 | }; |
| 285 | 343 | ||
| 286 | void __init omap2_set_globals_443x(void) | 344 | void __init omap2_set_globals_443x(void) |
| 287 | { | 345 | { |
| 288 | omap2_set_globals_tap(&omap4_globals); | 346 | omap2_set_globals_tap(&omap4_globals); |
| 289 | omap2_set_globals_control(&omap4_globals); | 347 | omap2_set_globals_control(&omap4_globals); |
| 348 | omap2_set_globals_prcm(&omap4_globals); | ||
| 349 | omap2_set_globals_uart(&omap4_globals); | ||
| 290 | } | 350 | } |
| 291 | #endif | 351 | #endif |
| 292 | 352 | ||
