aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2012-06-05 13:34:55 -0400
committerTony Lindgren <tony@atomide.com>2012-06-14 05:39:47 -0400
commit1c2d076b589225e51e022d85bb9f25dca26530f3 (patch)
treede3e16c873c844a8529fe596aae9c8e2235282c3 /arch/arm
parent67d2e760ae1909f3a3c444a063961e35a54b7bb0 (diff)
ARM: OMAP: Remove loses_context variable from timer platform data
The platform data variable loses_context is used to determine if the timer may lose its logic state during power transitions and so needs to be restored. This information is also provided in the HWMOD device attributes for OMAP2+ devices via the OMAP_TIMER_ALWON flag. When this flag is set the timer will not lose context. So use the HWMOD device attributes to determine this. For OMAP1 devices, loses_context is never set and so set the OMAP_TIMER_ALWON flag for OMAP1 timers to ensure that code is equivalent. Signed-off-by: Jon Hunter <jon-hunter@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap1/timer.c1
-rw-r--r--arch/arm/mach-omap2/timer.c3
-rw-r--r--arch/arm/plat-omap/dmtimer.c8
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h3
4 files changed, 5 insertions, 10 deletions
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 64c65bcb2d67..b4bf48c188fb 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -141,6 +141,7 @@ static int __init omap1_dm_timer_init(void)
141 141
142 pdata->set_timer_src = omap1_dm_timer_set_src; 142 pdata->set_timer_src = omap1_dm_timer_set_src;
143 pdata->needs_manual_reset = 1; 143 pdata->needs_manual_reset = 1;
144 pdata->timer_capability = OMAP_TIMER_ALWON;
144 145
145 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata)); 146 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
146 if (ret) { 147 if (ret) {
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 8c046d9d8ae8..9b6880a33793 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -462,7 +462,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
462 struct dmtimer_platform_data *pdata; 462 struct dmtimer_platform_data *pdata;
463 struct platform_device *pdev; 463 struct platform_device *pdev;
464 struct omap_timer_capability_dev_attr *timer_dev_attr; 464 struct omap_timer_capability_dev_attr *timer_dev_attr;
465 struct powerdomain *pwrdm;
466 465
467 pr_debug("%s: %s\n", __func__, oh->name); 466 pr_debug("%s: %s\n", __func__, oh->name);
468 467
@@ -495,8 +494,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
495 if (timer_dev_attr) 494 if (timer_dev_attr)
496 pdata->timer_capability = timer_dev_attr->timer_capability; 495 pdata->timer_capability = timer_dev_attr->timer_capability;
497 496
498 pwrdm = omap_hwmod_get_pwrdm(oh);
499 pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
500#ifdef CONFIG_PM 497#ifdef CONFIG_PM
501 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; 498 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
502#endif 499#endif
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 30742d8e6819..7aa12785e238 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -341,7 +341,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
341 341
342 omap_dm_timer_enable(timer); 342 omap_dm_timer_enable(timer);
343 343
344 if (timer->loses_context) { 344 if (!(timer->capability & OMAP_TIMER_ALWON)) {
345 u32 ctx_loss_cnt_after = 345 u32 ctx_loss_cnt_after =
346 timer->get_context_loss_count(&timer->pdev->dev); 346 timer->get_context_loss_count(&timer->pdev->dev);
347 if (ctx_loss_cnt_after != timer->ctx_loss_count) 347 if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -374,7 +374,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
374 374
375 __omap_dm_timer_stop(timer, timer->posted, rate); 375 __omap_dm_timer_stop(timer, timer->posted, rate);
376 376
377 if (timer->loses_context && timer->get_context_loss_count) 377 if (!(timer->capability & OMAP_TIMER_ALWON) &&
378 timer->get_context_loss_count)
378 timer->ctx_loss_count = 379 timer->ctx_loss_count =
379 timer->get_context_loss_count(&timer->pdev->dev); 380 timer->get_context_loss_count(&timer->pdev->dev);
380 381
@@ -447,7 +448,7 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
447 448
448 omap_dm_timer_enable(timer); 449 omap_dm_timer_enable(timer);
449 450
450 if (timer->loses_context) { 451 if (!(timer->capability & OMAP_TIMER_ALWON)) {
451 u32 ctx_loss_cnt_after = 452 u32 ctx_loss_cnt_after =
452 timer->get_context_loss_count(&timer->pdev->dev); 453 timer->get_context_loss_count(&timer->pdev->dev);
453 if (ctx_loss_cnt_after != timer->ctx_loss_count) 454 if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -692,7 +693,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
692 timer->irq = irq->start; 693 timer->irq = irq->start;
693 timer->reserved = omap_dm_timer_reserved_systimer(timer->id); 694 timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
694 timer->pdev = pdev; 695 timer->pdev = pdev;
695 timer->loses_context = pdata->loses_context;
696 timer->get_context_loss_count = pdata->get_context_loss_count; 696 timer->get_context_loss_count = pdata->get_context_loss_count;
697 timer->capability = pdata->timer_capability; 697 timer->capability = pdata->timer_capability;
698 698
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 362cf97d721c..0a7ed31954ea 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -91,8 +91,6 @@ struct timer_regs {
91struct dmtimer_platform_data { 91struct dmtimer_platform_data {
92 int (*set_timer_src)(struct platform_device *pdev, int source); 92 int (*set_timer_src)(struct platform_device *pdev, int source);
93 u32 needs_manual_reset:1; 93 u32 needs_manual_reset:1;
94 bool loses_context;
95
96 int (*get_context_loss_count)(struct device *dev); 94 int (*get_context_loss_count)(struct device *dev);
97 u32 timer_capability; 95 u32 timer_capability;
98}; 96};
@@ -264,7 +262,6 @@ struct omap_dm_timer {
264 unsigned reserved:1; 262 unsigned reserved:1;
265 unsigned posted:1; 263 unsigned posted:1;
266 struct timer_regs context; 264 struct timer_regs context;
267 bool loses_context;
268 int ctx_loss_count; 265 int ctx_loss_count;
269 int revision; 266 int revision;
270 u32 capability; 267 u32 capability;