summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/timer.c
diff options
context:
space:
mode:
authorOlof Johansson2018-05-26 00:23:25 +0200
committerOlof Johansson2018-05-26 00:23:25 +0200
commitbd6cc4f2d2700fb0a1b0251a95113f0fb517a9b9 (patch)
tree588bd62d6147e9bd0807fc91d370152756ad2713 /arch/arm/mach-omap2/timer.c
parentMerge tag 'berlin-core-for-v4.18' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
parentOMAP: CLK: CLKSRC: Add suspend resume hooks (diff)
downloadkernel-qcow2-linux-bd6cc4f2d2700fb0a1b0251a95113f0fb517a9b9.tar.gz
kernel-qcow2-linux-bd6cc4f2d2700fb0a1b0251a95113f0fb517a9b9.tar.xz
kernel-qcow2-linux-bd6cc4f2d2700fb0a1b0251a95113f0fb517a9b9.zip
Merge tag 'omap-for-v4.18/soc-late-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/soc
Late omap soc changes for v4.18 merge window This series contains two omap1 ams-delta GPIO clean-up patches to get started with removal of hard-coded GPIO numbers from drivers. And then the removal of board mach includes from drivers. The second patch mostly touches the ams-delta audio driver but is included here because of the removal of the latch gpios and is acked by Mark Brown. And there are two more am437x related PM patches to save and restore control module and timer registers for RTC only suspend mode. Looks like the patch title for the timer changes is a bit misleading, not all the timer code is yet living under drivers/clocksource. But I had already pushed out the branch before I noticed this. * tag 'omap-for-v4.18/soc-late-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: OMAP: CLK: CLKSRC: Add suspend resume hooks ARM: AM43XX: Add functions to save/restore am43xx control registers ASoC: ams_delta: use GPIO lookup table ARM: OMAP1: ams-delta: add GPIO lookup tables Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-omap2/timer.c')
-rw-r--r--arch/arm/mach-omap2/timer.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 5a70ab67af8e..98ed5ac073bc 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -70,6 +70,9 @@ static struct clock_event_device clockevent_gpt;
/* Clockevent hwmod for am335x and am437x suspend */
static struct omap_hwmod *clockevent_gpt_hwmod;
+/* Clockesource hwmod for am437x suspend */
+static struct omap_hwmod *clocksource_gpt_hwmod;
+
#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
static unsigned long arch_timer_freq;
@@ -478,6 +481,26 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
return ret;
}
+static unsigned int omap2_gptimer_clksrc_load;
+
+static void omap2_gptimer_clksrc_suspend(struct clocksource *unused)
+{
+ omap2_gptimer_clksrc_load =
+ __omap_dm_timer_read_counter(&clksrc, OMAP_TIMER_NONPOSTED);
+
+ omap_hwmod_idle(clocksource_gpt_hwmod);
+}
+
+static void omap2_gptimer_clksrc_resume(struct clocksource *unused)
+{
+ omap_hwmod_enable(clocksource_gpt_hwmod);
+
+ __omap_dm_timer_load_start(&clksrc,
+ OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR,
+ omap2_gptimer_clksrc_load,
+ OMAP_TIMER_NONPOSTED);
+}
+
static void __init omap2_gptimer_clocksource_init(int gptimer_id,
const char *fck_source,
const char *property)
@@ -490,6 +513,15 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
res = omap_dm_timer_init_one(&clksrc, fck_source, property,
&clocksource_gpt.name,
OMAP_TIMER_NONPOSTED);
+
+ if (soc_is_am43xx()) {
+ clocksource_gpt.suspend = omap2_gptimer_clksrc_suspend;
+ clocksource_gpt.resume = omap2_gptimer_clksrc_resume;
+
+ clocksource_gpt_hwmod =
+ omap_hwmod_lookup(clocksource_gpt.name);
+ }
+
BUG_ON(res);
__omap_dm_timer_load_start(&clksrc,