diff options
Diffstat (limited to 'arch/arm/plat-omap/dmtimer.c')
| -rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 73 |
1 files changed, 63 insertions, 10 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 55bb99631292..7f50b6103dee 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | * OMAP2 support by Juha Yrjola | 7 | * OMAP2 support by Juha Yrjola |
| 8 | * API improvements and OMAP2 clock framework support by Timo Teras | 8 | * API improvements and OMAP2 clock framework support by Timo Teras |
| 9 | * | 9 | * |
| 10 | * Copyright (C) 2009 Texas Instruments | ||
| 11 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 12 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify it | 13 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the | 14 | * under the terms of the GNU General Public License as published by the |
| 12 | * Free Software Foundation; either version 2 of the License, or (at your | 15 | * Free Software Foundation; either version 2 of the License, or (at your |
| @@ -150,7 +153,8 @@ | |||
| 150 | struct omap_dm_timer { | 153 | struct omap_dm_timer { |
| 151 | unsigned long phys_base; | 154 | unsigned long phys_base; |
| 152 | int irq; | 155 | int irq; |
| 153 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 156 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ |
| 157 | defined(CONFIG_ARCH_OMAP4) | ||
| 154 | struct clk *iclk, *fclk; | 158 | struct clk *iclk, *fclk; |
| 155 | #endif | 159 | #endif |
| 156 | void __iomem *io_base; | 160 | void __iomem *io_base; |
| @@ -169,6 +173,9 @@ struct omap_dm_timer { | |||
| 169 | #define omap3_dm_timers NULL | 173 | #define omap3_dm_timers NULL |
| 170 | #define omap3_dm_source_names NULL | 174 | #define omap3_dm_source_names NULL |
| 171 | #define omap3_dm_source_clocks NULL | 175 | #define omap3_dm_source_clocks NULL |
| 176 | #define omap4_dm_timers NULL | ||
| 177 | #define omap4_dm_source_names NULL | ||
| 178 | #define omap4_dm_source_clocks NULL | ||
| 172 | 179 | ||
| 173 | static struct omap_dm_timer omap1_dm_timers[] = { | 180 | static struct omap_dm_timer omap1_dm_timers[] = { |
| 174 | { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, | 181 | { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, |
| @@ -191,6 +198,9 @@ static const int dm_timer_count = ARRAY_SIZE(omap1_dm_timers); | |||
| 191 | #define omap3_dm_timers NULL | 198 | #define omap3_dm_timers NULL |
| 192 | #define omap3_dm_source_names NULL | 199 | #define omap3_dm_source_names NULL |
| 193 | #define omap3_dm_source_clocks NULL | 200 | #define omap3_dm_source_clocks NULL |
| 201 | #define omap4_dm_timers NULL | ||
| 202 | #define omap4_dm_source_names NULL | ||
| 203 | #define omap4_dm_source_clocks NULL | ||
| 194 | 204 | ||
| 195 | static struct omap_dm_timer omap2_dm_timers[] = { | 205 | static struct omap_dm_timer omap2_dm_timers[] = { |
| 196 | { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, | 206 | { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, |
| @@ -214,7 +224,7 @@ static const char *omap2_dm_source_names[] __initdata = { | |||
| 214 | NULL | 224 | NULL |
| 215 | }; | 225 | }; |
| 216 | 226 | ||
| 217 | static struct clk **omap2_dm_source_clocks[3]; | 227 | static struct clk *omap2_dm_source_clocks[3]; |
| 218 | static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers); | 228 | static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers); |
| 219 | 229 | ||
| 220 | #elif defined(CONFIG_ARCH_OMAP3) | 230 | #elif defined(CONFIG_ARCH_OMAP3) |
| @@ -225,6 +235,9 @@ static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers); | |||
| 225 | #define omap2_dm_timers NULL | 235 | #define omap2_dm_timers NULL |
| 226 | #define omap2_dm_source_names NULL | 236 | #define omap2_dm_source_names NULL |
| 227 | #define omap2_dm_source_clocks NULL | 237 | #define omap2_dm_source_clocks NULL |
| 238 | #define omap4_dm_timers NULL | ||
| 239 | #define omap4_dm_source_names NULL | ||
| 240 | #define omap4_dm_source_clocks NULL | ||
| 228 | 241 | ||
| 229 | static struct omap_dm_timer omap3_dm_timers[] = { | 242 | static struct omap_dm_timer omap3_dm_timers[] = { |
| 230 | { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 }, | 243 | { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 }, |
| @@ -247,9 +260,43 @@ static const char *omap3_dm_source_names[] __initdata = { | |||
| 247 | NULL | 260 | NULL |
| 248 | }; | 261 | }; |
| 249 | 262 | ||
| 250 | static struct clk **omap3_dm_source_clocks[2]; | 263 | static struct clk *omap3_dm_source_clocks[2]; |
| 251 | static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers); | 264 | static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers); |
| 252 | 265 | ||
| 266 | #elif defined(CONFIG_ARCH_OMAP4) | ||
| 267 | |||
| 268 | #define omap_dm_clk_enable(x) clk_enable(x) | ||
| 269 | #define omap_dm_clk_disable(x) clk_disable(x) | ||
| 270 | #define omap1_dm_timers NULL | ||
| 271 | #define omap2_dm_timers NULL | ||
| 272 | #define omap2_dm_source_names NULL | ||
| 273 | #define omap2_dm_source_clocks NULL | ||
| 274 | #define omap3_dm_timers NULL | ||
| 275 | #define omap3_dm_source_names NULL | ||
| 276 | #define omap3_dm_source_clocks NULL | ||
| 277 | |||
| 278 | static struct omap_dm_timer omap4_dm_timers[] = { | ||
| 279 | { .phys_base = 0x4a318000, .irq = INT_44XX_GPTIMER1 }, | ||
| 280 | { .phys_base = 0x48032000, .irq = INT_44XX_GPTIMER2 }, | ||
| 281 | { .phys_base = 0x48034000, .irq = INT_44XX_GPTIMER3 }, | ||
| 282 | { .phys_base = 0x48036000, .irq = INT_44XX_GPTIMER4 }, | ||
| 283 | { .phys_base = 0x40138000, .irq = INT_44XX_GPTIMER5 }, | ||
| 284 | { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER6 }, | ||
| 285 | { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER7 }, | ||
| 286 | { .phys_base = 0x4013e000, .irq = INT_44XX_GPTIMER8 }, | ||
| 287 | { .phys_base = 0x4803e000, .irq = INT_44XX_GPTIMER9 }, | ||
| 288 | { .phys_base = 0x48086000, .irq = INT_44XX_GPTIMER10 }, | ||
| 289 | { .phys_base = 0x48088000, .irq = INT_44XX_GPTIMER11 }, | ||
| 290 | { .phys_base = 0x4a320000, .irq = INT_44XX_GPTIMER12 }, | ||
| 291 | }; | ||
| 292 | static const char *omap4_dm_source_names[] __initdata = { | ||
| 293 | "sys_ck", | ||
| 294 | "omap_32k_fck", | ||
| 295 | NULL | ||
| 296 | }; | ||
| 297 | static struct clk *omap4_dm_source_clocks[2]; | ||
| 298 | static const int dm_timer_count = ARRAY_SIZE(omap4_dm_timers); | ||
| 299 | |||
| 253 | #else | 300 | #else |
| 254 | 301 | ||
| 255 | #error OMAP architecture not supported! | 302 | #error OMAP architecture not supported! |
| @@ -257,7 +304,7 @@ static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers); | |||
| 257 | #endif | 304 | #endif |
| 258 | 305 | ||
| 259 | static struct omap_dm_timer *dm_timers; | 306 | static struct omap_dm_timer *dm_timers; |
| 260 | static char **dm_source_names; | 307 | static const char **dm_source_names; |
| 261 | static struct clk **dm_source_clocks; | 308 | static struct clk **dm_source_clocks; |
| 262 | 309 | ||
| 263 | static spinlock_t dm_timer_lock; | 310 | static spinlock_t dm_timer_lock; |
| @@ -459,7 +506,8 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask) | |||
| 459 | } | 506 | } |
| 460 | EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); | 507 | EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); |
| 461 | 508 | ||
| 462 | #elif defined(CONFIG_ARCH_OMAP2) || defined (CONFIG_ARCH_OMAP3) | 509 | #elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ |
| 510 | defined(CONFIG_ARCH_OMAP4) | ||
| 463 | 511 | ||
| 464 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) | 512 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) |
| 465 | { | 513 | { |
| @@ -705,12 +753,16 @@ int __init omap_dm_timer_init(void) | |||
| 705 | dm_timers = omap1_dm_timers; | 753 | dm_timers = omap1_dm_timers; |
| 706 | else if (cpu_is_omap24xx()) { | 754 | else if (cpu_is_omap24xx()) { |
| 707 | dm_timers = omap2_dm_timers; | 755 | dm_timers = omap2_dm_timers; |
| 708 | dm_source_names = (char **)omap2_dm_source_names; | 756 | dm_source_names = omap2_dm_source_names; |
| 709 | dm_source_clocks = (struct clk **)omap2_dm_source_clocks; | 757 | dm_source_clocks = omap2_dm_source_clocks; |
| 710 | } else if (cpu_is_omap34xx()) { | 758 | } else if (cpu_is_omap34xx()) { |
| 711 | dm_timers = omap3_dm_timers; | 759 | dm_timers = omap3_dm_timers; |
| 712 | dm_source_names = (char **)omap3_dm_source_names; | 760 | dm_source_names = omap3_dm_source_names; |
| 713 | dm_source_clocks = (struct clk **)omap3_dm_source_clocks; | 761 | dm_source_clocks = omap3_dm_source_clocks; |
| 762 | } else if (cpu_is_omap44xx()) { | ||
| 763 | dm_timers = omap4_dm_timers; | ||
| 764 | dm_source_names = omap4_dm_source_names; | ||
| 765 | dm_source_clocks = omap4_dm_source_clocks; | ||
| 714 | } | 766 | } |
| 715 | 767 | ||
| 716 | if (cpu_class_is_omap2()) | 768 | if (cpu_class_is_omap2()) |
| @@ -723,7 +775,8 @@ int __init omap_dm_timer_init(void) | |||
| 723 | for (i = 0; i < dm_timer_count; i++) { | 775 | for (i = 0; i < dm_timer_count; i++) { |
| 724 | timer = &dm_timers[i]; | 776 | timer = &dm_timers[i]; |
| 725 | timer->io_base = IO_ADDRESS(timer->phys_base); | 777 | timer->io_base = IO_ADDRESS(timer->phys_base); |
| 726 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 778 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ |
| 779 | defined(CONFIG_ARCH_OMAP4) | ||
| 727 | if (cpu_class_is_omap2()) { | 780 | if (cpu_class_is_omap2()) { |
| 728 | char clk_name[16]; | 781 | char clk_name[16]; |
| 729 | sprintf(clk_name, "gpt%d_ick", i + 1); | 782 | sprintf(clk_name, "gpt%d_ick", i + 1); |
