Skip to contentSkip to conversation

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

PATCH New Tarun Kanti DebBarma 2 participants 2 messages Dec 7, 2011 – Mar 5, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
Simplified checks around context loss count read.

Baseline: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Branch: master
Commit: b835c0f

 arch/arm/plat-omap/dmtimer.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
arch/arm/plat-omap/dmtimer.c +16 -3
index af3b92b..0b77fe8 100644
@@ -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,19 @@ 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)
+		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);
Signature · 1 line
1.7.0.4
#1 lore raw

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

Quoted 5 lines · 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.

Quoted 8 lines

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.

Thanks applying this to fixes-non-critical-part2. Sorry for the delays, looks like I'm a bit behind with patches..

Regards,

Tony