Re: [PATCH] ARM: OMAP: dmtimer: fix missing content/correction in low-power mode support

2011-12-07 Thread Felipe Contreras
On Tue, Nov 8, 2011 at 8:00 AM, Tarun Kanti DebBarma tarun.ka...@ti.com wrote:
 Since omap_dm_timer_write_reg/__omap_dm_timer_write is now modified
 to use timer-func_base OCP_CFG should not use this wrapper anymore.
 Instead use __raw_writel() directly and use timer-io_base instead
 to write to OCP_CFG.

 The timer-sys_stat is valid only if timer-revision is 1. In the
 context restore function make this correction.

 Save the contexts and loss count when timer is stopped.
 Also, disable the clock. Else, clock usecount would become imbalanced.

 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com

It looks like this patch is doing 3 things, so I think this patch
should be split into 3 logical patches.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: OMAP: dmtimer: fix missing content/correction in low-power mode support

2011-11-23 Thread DebBarma, Tarun Kanti
On Mon, Nov 21, 2011 at 10:12 PM, Ramirez Luna, Omar
omar.rami...@ti.com wrote:
 Hi,

 On Tue, Nov 8, 2011 at 12:00 AM, Tarun Kanti DebBarma
 tarun.ka...@ti.com wrote:
 Since omap_dm_timer_write_reg/__omap_dm_timer_write is now modified
 to use timer-func_base OCP_CFG should not use this wrapper anymore.
 Instead use __raw_writel() directly and use timer-io_base instead
 to write to OCP_CFG.

 The timer-sys_stat is valid only if timer-revision is 1. In the
 context restore function make this correction.

 Save the contexts and loss count when timer is stopped.
 Also, disable the clock. Else, clock usecount would become imbalanced.

 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
 ...
 diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
 index af3b92b..f042c82 100644
 --- a/arch/arm/plat-omap/dmtimer.c
 +++ b/arch/arm/plat-omap/dmtimer.c
 ...
 @@ -357,6 +357,21 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)

        __omap_dm_timer_stop(timer, timer-posted, rate);

 +       if (timer-loses_context) {
 +               if (timer-get_context_loss_count)

 Maybe: if (timer-loses_context  timer-get_context_loss_count)
Sure.

 +                       timer-ctx_loss_count =
 +                       timer-get_context_loss_count(timer-pdev-dev);

 could get rid  of this weird one-line formatting
ok.

 +       }
 +
 +       /*
 +        * Since the register values are computed and written within
 +        * __omap_dm_timer_stop, we need to use read to retrieve the
 +        * context.
 +        */
 +       timer-context.tclr =
 +                       omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
 +       timer-context.tisr = __raw_readl(timer-irq_stat);
 +       omap_dm_timer_disable(timer);

 FWIW, functionally it looks good to me, besides it fixes the broken
 dmtimer start/stop sequence from 3.2-rc1. Tested with tidspbridge on
 omap3.
Thanks.


 If needed:

 Tested-by: Omar Ramirez Luna omar.rami...@ti.com
Sure. Thanks.
--
Tarun

 Regards,

 Omar

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: OMAP: dmtimer: fix missing content/correction in low-power mode support

2011-11-21 Thread Ramirez Luna, Omar
Hi,

On Tue, Nov 8, 2011 at 12:00 AM, Tarun Kanti DebBarma
tarun.ka...@ti.com wrote:
 Since omap_dm_timer_write_reg/__omap_dm_timer_write is now modified
 to use timer-func_base OCP_CFG should not use this wrapper anymore.
 Instead use __raw_writel() directly and use timer-io_base instead
 to write to OCP_CFG.

 The timer-sys_stat is valid only if timer-revision is 1. In the
 context restore function make this correction.

 Save the contexts and loss count when timer is stopped.
 Also, disable the clock. Else, clock usecount would become imbalanced.

 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
...
 diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
 index af3b92b..f042c82 100644
 --- a/arch/arm/plat-omap/dmtimer.c
 +++ b/arch/arm/plat-omap/dmtimer.c
...
 @@ -357,6 +357,21 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)

        __omap_dm_timer_stop(timer, timer-posted, rate);

 +       if (timer-loses_context) {
 +               if (timer-get_context_loss_count)

Maybe: if (timer-loses_context  timer-get_context_loss_count)

 +                       timer-ctx_loss_count =
 +                       timer-get_context_loss_count(timer-pdev-dev);

could get rid  of this weird one-line formatting

 +       }
 +
 +       /*
 +        * Since the register values are computed and written within
 +        * __omap_dm_timer_stop, we need to use read to retrieve the
 +        * context.
 +        */
 +       timer-context.tclr =
 +                       omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
 +       timer-context.tisr = __raw_readl(timer-irq_stat);
 +       omap_dm_timer_disable(timer);

FWIW, functionally it looks good to me, besides it fixes the broken
dmtimer start/stop sequence from 3.2-rc1. Tested with tidspbridge on
omap3.

If needed:

Tested-by: Omar Ramirez Luna omar.rami...@ti.com

Regards,

Omar
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP: dmtimer: fix missing content/correction in low-power mode support

2011-11-07 Thread Tarun Kanti DebBarma
Since omap_dm_timer_write_reg/__omap_dm_timer_write is now modified
to use timer-func_base OCP_CFG should not use this wrapper anymore.
Instead use __raw_writel() directly and use timer-io_base instead
to write to OCP_CFG.

The timer-sys_stat is valid only if timer-revision is 1. In the
context restore function make this correction.

Save the contexts and loss count when timer is stopped.
Also, disable the clock. Else, clock usecount would become imbalanced.

Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
---
Baseline: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Branch: master
Linux 3.2-rc1

 arch/arm/plat-omap/dmtimer.c |   21 ++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index af3b92b..f042c82 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -80,9 +80,9 @@ static void omap_dm_timer_write_reg(struct omap_dm_timer 
*timer, u32 reg,
 
 static void omap_timer_restore_context(struct omap_dm_timer *timer)
 {
-   omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_OFFSET,
-   timer-context.tiocp_cfg);
-   if (timer-revision  1)
+   __raw_writel(timer-context.tiocp_cfg,
+   timer-io_base + OMAP_TIMER_OCP_CFG_OFFSET);
+   if (timer-revision == 1)
__raw_writel(timer-context.tistat, timer-sys_stat);
 
__raw_writel(timer-context.tisr, timer-irq_stat);
@@ -357,6 +357,21 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
__omap_dm_timer_stop(timer, timer-posted, rate);
 
+   if (timer-loses_context) {
+   if (timer-get_context_loss_count)
+   timer-ctx_loss_count =
+   timer-get_context_loss_count(timer-pdev-dev);
+   }
+
+   /*
+* Since the register values are computed and written within
+* __omap_dm_timer_stop, we need to use read to retrieve the
+* context.
+*/
+   timer-context.tclr =
+   omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
+   timer-context.tisr = __raw_readl(timer-irq_stat);
+   omap_dm_timer_disable(timer);
return 0;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html