Skip to contentSkip to conversation

clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG

PATCH Applied Tony Lindgren 2 participants 2 messages Apr 15, 2021 – Jun 18, 2021 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG

As we are using cpu_pm to save and restore context, we must also save and restore the timer sysconfig register TIOCP_CFG. This is needed because we are not calling PM runtime functions at all with cpu_pm.

Fixes b34677b0999a ("clocksource/drivers/timer-ti-dm: Implement cpu_pm notifier for context save and restore")
Cc Aaro Koskinen <[email protected]>
Cc Adam Ford <[email protected]>
Cc Andreas Kemnade <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc Peter Ujfalusi <[email protected]>
---
 drivers/clocksource/timer-ti-dm.c | 6 ++++++
 include/clocksource/timer-ti-dm.h | 1 +
 2 files changed, 7 insertions(+)
drivers/clocksource/timer-ti-dm.c +6 -0
@@ -78,6 +78,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(timer, OMAP_TIMER_OCP_CFG_OFFSET,
+			      timer->context.ocp_cfg, 0);
+
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG,
 				timer->context.twer);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
@@ -95,6 +98,9 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)
 
 static void omap_timer_save_context(struct omap_dm_timer *timer)
 {
+	timer->context.ocp_cfg =
+		__omap_dm_timer_read(timer, OMAP_TIMER_OCP_CFG_OFFSET, 0);
+
 	timer->context.tclr =
 			omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
 	timer->context.twer =
include/clocksource/timer-ti-dm.h +1 -0
@@ -74,6 +74,7 @@
 #define OMAP_TIMER_ERRATA_I103_I767			0x80000000
 
 struct timer_regs {
+	u32 ocp_cfg;
 	u32 tidr;
 	u32 tier;
 	u32 twer;
Signature · 1 line
2.31.1
merge bot Applied
#1 lore raw
The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     9517c577f9f722270584cfb1a7b4e1354e408658
Gitweb:        https://git.kernel.org/tip/9517c577f9f722270584cfb1a7b4e1354e408658
Author:        Tony Lindgren <[email protected]>
AuthorDate:    Thu, 15 Apr 2021 11:55:06 +03:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Tue, 15 Jun 2021 14:14:14 +02:00

clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG

As we are using cpu_pm to save and restore context, we must also save and restore the timer sysconfig register TIOCP_CFG. This is needed because we are not calling PM runtime functions at all with cpu_pm.

Fixes b34677b0999a ("clocksource/drivers/timer-ti-dm: Implement cpu_pm notifier for context save and restore")
Cc Aaro Koskinen <[email protected]>
Cc Adam Ford <[email protected]>
Cc Andreas Kemnade <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc Peter Ujfalusi <[email protected]>
---
 drivers/clocksource/timer-ti-dm.c | 6 ++++++
 include/clocksource/timer-ti-dm.h | 1 +
 2 files changed, 7 insertions(+)
drivers/clocksource/timer-ti-dm.c +6 -0
index 33eeabf..e5c631f 100644
@@ -78,6 +78,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(timer, OMAP_TIMER_OCP_CFG_OFFSET,
+			      timer->context.ocp_cfg, 0);
+
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG,
 				timer->context.twer);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
@@ -95,6 +98,9 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)
 
 static void omap_timer_save_context(struct omap_dm_timer *timer)
 {
+	timer->context.ocp_cfg =
+		__omap_dm_timer_read(timer, OMAP_TIMER_OCP_CFG_OFFSET, 0);
+
 	timer->context.tclr =
 			omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
 	timer->context.twer =
include/clocksource/timer-ti-dm.h +1 -0
index 4c61dad..f6da8a1 100644
@@ -74,6 +74,7 @@
 #define OMAP_TIMER_ERRATA_I103_I767			0x80000000
 
 struct timer_regs {
+	u32 ocp_cfg;
 	u32 tidr;
 	u32 tier;
 	u32 twer;