Skip to content

Commit

Permalink
clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG
Browse files Browse the repository at this point in the history
[ Upstream commit 9517c57 ]

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: b34677b ("clocksource/drivers/timer-ti-dm: Implement cpu_pm notifier for context save and restore")
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Adam Ford <aford173@gmail.com>
Cc: Andreas Kemnade <andreas@kemnade.info>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210415085506.56828-1-tony@atomide.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tmlind authored and gregkh committed Jul 14, 2021
1 parent 27f9d64 commit f100097
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/clocksource/timer-ti-dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions include/clocksource/timer-ti-dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#define OMAP_TIMER_ERRATA_I103_I767 0x80000000

struct timer_regs {
u32 ocp_cfg;
u32 tidr;
u32 tier;
u32 twer;
Expand Down

0 comments on commit f100097

Please sign in to comment.