ARM: OMAP: Remove loses_context variable from timer platform data
authorJon Hunter <jon-hunter@ti.com>
Tue, 5 Jun 2012 17:34:55 +0000 (12:34 -0500)
committerTony Lindgren <tony@atomide.com>
Thu, 14 Jun 2012 09:39:47 +0000 (02:39 -0700)
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>
arch/arm/mach-omap1/timer.c
arch/arm/mach-omap2/timer.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/include/plat/dmtimer.h

index 64c65bcb2d67574af11b0af2c64e8374317b7419..b4bf48c188fb2a13186d9dae055fcf7e9fc3742f 100644 (file)
@@ -141,6 +141,7 @@ static int __init omap1_dm_timer_init(void)
 
                pdata->set_timer_src = omap1_dm_timer_set_src;
                pdata->needs_manual_reset = 1;
+               pdata->timer_capability = OMAP_TIMER_ALWON;
 
                ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
                if (ret) {
index 8c046d9d8ae899374f3dd8d67270f5945fb59631..9b6880a33793d972bb971292e53c8c2725a998ca 100644 (file)
@@ -462,7 +462,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        struct dmtimer_platform_data *pdata;
        struct platform_device *pdev;
        struct omap_timer_capability_dev_attr *timer_dev_attr;
-       struct powerdomain *pwrdm;
 
        pr_debug("%s: %s\n", __func__, oh->name);
 
@@ -495,8 +494,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        if (timer_dev_attr)
                pdata->timer_capability = timer_dev_attr->timer_capability;
 
-       pwrdm = omap_hwmod_get_pwrdm(oh);
-       pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
 #ifdef CONFIG_PM
        pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
 #endif
index 30742d8e68194ebe2fdbb0f0c278016da5f11760..7aa12785e23823dd800f432fa3ef255840f074d4 100644 (file)
@@ -341,7 +341,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 
        omap_dm_timer_enable(timer);
 
-       if (timer->loses_context) {
+       if (!(timer->capability & OMAP_TIMER_ALWON)) {
                u32 ctx_loss_cnt_after =
                        timer->get_context_loss_count(&timer->pdev->dev);
                if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -374,7 +374,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
        __omap_dm_timer_stop(timer, timer->posted, rate);
 
-       if (timer->loses_context && timer->get_context_loss_count)
+       if (!(timer->capability & OMAP_TIMER_ALWON) &&
+                       timer->get_context_loss_count)
                timer->ctx_loss_count =
                        timer->get_context_loss_count(&timer->pdev->dev);
 
@@ -447,7 +448,7 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 
        omap_dm_timer_enable(timer);
 
-       if (timer->loses_context) {
+       if (!(timer->capability & OMAP_TIMER_ALWON)) {
                u32 ctx_loss_cnt_after =
                        timer->get_context_loss_count(&timer->pdev->dev);
                if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -692,7 +693,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
        timer->irq = irq->start;
        timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
        timer->pdev = pdev;
-       timer->loses_context = pdata->loses_context;
        timer->get_context_loss_count = pdata->get_context_loss_count;
        timer->capability = pdata->timer_capability;
 
index 362cf97d721c32ee8102f1b4970071cbec150f2b..0a7ed31954eabf71f5d8a274a2954bd5b20e3837 100644 (file)
@@ -91,8 +91,6 @@ struct timer_regs {
 struct dmtimer_platform_data {
        int (*set_timer_src)(struct platform_device *pdev, int source);
        u32 needs_manual_reset:1;
-       bool loses_context;
-
        int (*get_context_loss_count)(struct device *dev);
        u32 timer_capability;
 };
@@ -264,7 +262,6 @@ struct omap_dm_timer {
        unsigned reserved:1;
        unsigned posted:1;
        struct timer_regs context;
-       bool loses_context;
        int ctx_loss_count;
        int revision;
        u32 capability;