diff options
| -rw-r--r-- | arch/arm/mach-omap2/timer.c | 9 | ||||
| -rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 18 | ||||
| -rw-r--r-- | arch/arm/plat-omap/include/plat/dmtimer.h | 3 |
3 files changed, 20 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index c030dfeee76a..b0b208077c96 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
| @@ -69,8 +69,6 @@ | |||
| 69 | #define OMAP3_SECURE_TIMER 1 | 69 | #define OMAP3_SECURE_TIMER 1 |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | static u32 sys_timer_reserved; | ||
| 73 | |||
| 74 | /* Clockevent code */ | 72 | /* Clockevent code */ |
| 75 | 73 | ||
| 76 | static struct omap_dm_timer clkev; | 74 | static struct omap_dm_timer clkev; |
| @@ -177,7 +175,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
| 177 | 175 | ||
| 178 | omap_hwmod_enable(oh); | 176 | omap_hwmod_enable(oh); |
| 179 | 177 | ||
| 180 | sys_timer_reserved |= (1 << (gptimer_id - 1)); | 178 | if (omap_dm_timer_reserve_systimer(gptimer_id)) |
| 179 | return -ENODEV; | ||
| 181 | 180 | ||
| 182 | if (gptimer_id != 12) { | 181 | if (gptimer_id != 12) { |
| 183 | struct clk *src; | 182 | struct clk *src; |
| @@ -501,10 +500,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) | |||
| 501 | pdata->set_timer_src = omap2_dm_timer_set_src; | 500 | pdata->set_timer_src = omap2_dm_timer_set_src; |
| 502 | pdata->timer_ip_version = oh->class->rev; | 501 | pdata->timer_ip_version = oh->class->rev; |
| 503 | 502 | ||
| 504 | /* Mark clocksource and clockevent timers as reserved */ | ||
| 505 | if ((sys_timer_reserved >> (id - 1)) & 0x1) | ||
| 506 | pdata->reserved = 1; | ||
| 507 | |||
| 508 | pwrdm = omap_hwmod_get_pwrdm(oh); | 503 | pwrdm = omap_hwmod_get_pwrdm(oh); |
| 509 | pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm); | 504 | pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm); |
| 510 | #ifdef CONFIG_PM | 505 | #ifdef CONFIG_PM |
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 3b0cfeb33d05..f5b5c89ac7c2 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | 45 | ||
| 46 | #include <mach/hardware.h> | 46 | #include <mach/hardware.h> |
| 47 | 47 | ||
| 48 | static u32 omap_reserved_systimers; | ||
| 48 | static LIST_HEAD(omap_timer_list); | 49 | static LIST_HEAD(omap_timer_list); |
| 49 | static DEFINE_SPINLOCK(dm_timer_lock); | 50 | static DEFINE_SPINLOCK(dm_timer_lock); |
| 50 | 51 | ||
| @@ -152,6 +153,21 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer) | |||
| 152 | return ret; | 153 | return ret; |
| 153 | } | 154 | } |
| 154 | 155 | ||
| 156 | static inline u32 omap_dm_timer_reserved_systimer(int id) | ||
| 157 | { | ||
| 158 | return (omap_reserved_systimers & (1 << (id - 1))) ? 1 : 0; | ||
| 159 | } | ||
| 160 | |||
| 161 | int omap_dm_timer_reserve_systimer(int id) | ||
| 162 | { | ||
| 163 | if (omap_dm_timer_reserved_systimer(id)) | ||
| 164 | return -ENODEV; | ||
| 165 | |||
| 166 | omap_reserved_systimers |= (1 << (id - 1)); | ||
| 167 | |||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | |||
| 155 | struct omap_dm_timer *omap_dm_timer_request(void) | 171 | struct omap_dm_timer *omap_dm_timer_request(void) |
| 156 | { | 172 | { |
| 157 | struct omap_dm_timer *timer = NULL, *t; | 173 | struct omap_dm_timer *timer = NULL, *t; |
| @@ -674,7 +690,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) | |||
| 674 | 690 | ||
| 675 | timer->id = pdev->id; | 691 | timer->id = pdev->id; |
| 676 | timer->irq = irq->start; | 692 | timer->irq = irq->start; |
| 677 | timer->reserved = pdata->reserved; | 693 | timer->reserved = omap_dm_timer_reserved_systimer(timer->id); |
| 678 | timer->pdev = pdev; | 694 | timer->pdev = pdev; |
| 679 | timer->loses_context = pdata->loses_context; | 695 | timer->loses_context = pdata->loses_context; |
| 680 | timer->get_context_loss_count = pdata->get_context_loss_count; | 696 | timer->get_context_loss_count = pdata->get_context_loss_count; |
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index 5fdfaa481259..1e5ce5d56240 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h | |||
| @@ -98,13 +98,12 @@ struct dmtimer_platform_data { | |||
| 98 | int (*set_timer_src)(struct platform_device *pdev, int source); | 98 | int (*set_timer_src)(struct platform_device *pdev, int source); |
| 99 | int timer_ip_version; | 99 | int timer_ip_version; |
| 100 | u32 needs_manual_reset:1; | 100 | u32 needs_manual_reset:1; |
| 101 | bool reserved; | ||
| 102 | |||
| 103 | bool loses_context; | 101 | bool loses_context; |
| 104 | 102 | ||
| 105 | int (*get_context_loss_count)(struct device *dev); | 103 | int (*get_context_loss_count)(struct device *dev); |
| 106 | }; | 104 | }; |
| 107 | 105 | ||
| 106 | int omap_dm_timer_reserve_systimer(int id); | ||
| 108 | struct omap_dm_timer *omap_dm_timer_request(void); | 107 | struct omap_dm_timer *omap_dm_timer_request(void); |
| 109 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); | 108 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); |
| 110 | int omap_dm_timer_free(struct omap_dm_timer *timer); | 109 | int omap_dm_timer_free(struct omap_dm_timer *timer); |
