aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-prima2/timer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-01 20:22:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-01 20:22:01 -0700
commitcd9a0b6bd67ec372b0ef3cb2abe26974f888b956 (patch)
treeffec66aa48f95b2b764f9e84fbafc519cce5000e /arch/arm/mach-prima2/timer.c
parentac5761a650d22dd7dfad4d417463a0981d2da0a4 (diff)
parent090ad104c5c59c7952d4b8d4cfb60559b38eb3e0 (diff)
Merge branch 'next/pm' of git://git.linaro.org/people/arnd/arm-soc
* 'next/pm' of git://git.linaro.org/people/arnd/arm-soc: (66 commits) ARM: CSR: PM: use outer_resume to resume L2 cache ARM: CSR: call l2x0_of_init to init L2 cache of SiRFprimaII ARM: OMAP: voltage: voltage layer present, even when CONFIG_PM=n ARM: CSR: PM: add sleep entry for SiRFprimaII ARM: CSR: PM: save/restore irq status in suspend cycle ARM: CSR: PM: save/restore timer status in suspend cycle OMAP4: PM: TWL6030: add cmd register OMAP4: PM: TWL6030: fix ON/RET/OFF voltages OMAP4: PM: TWL6030: address 0V conversions OMAP4: PM: TWL6030: fix uv to voltage for >0x39 OMAP4: PM: TWL6030: fix voltage conversion formula omap: voltage: add a stub header file for external/regulator use OMAP2+: VC: more registers are per-channel starting with OMAP5 OMAP3+: voltage: update nominal voltage in voltdm_scale() not VC post-scale OMAP3+: voltage: rename omap_voltage_get_nom_volt -> voltdm_get_voltage OMAP3+: voltdm: final removal of omap_vdd_info OMAP3+: voltage: move/rename curr_volt from vdd_info into struct voltagedomain OMAP3+: voltage: rename scale and reset functions using voltdm_ prefix OMAP3+: VP: combine setting init voltage into common function OMAP3+: VP: remove unused omap_vp_get_curr_volt() ... Fix up trivial conflict in arch/arm/mach-prima2/l2x0.c (code removal vs edit)
Diffstat (limited to 'arch/arm/mach-prima2/timer.c')
-rw-r--r--arch/arm/mach-prima2/timer.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c
index 26ab6fee5619..b7a6091ce791 100644
--- a/arch/arm/mach-prima2/timer.c
+++ b/arch/arm/mach-prima2/timer.c
@@ -40,6 +40,17 @@
#define SIRFSOC_TIMER_LATCH_BIT BIT(0)
+#define SIRFSOC_TIMER_REG_CNT 11
+
+static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = {
+ SIRFSOC_TIMER_MATCH_0, SIRFSOC_TIMER_MATCH_1, SIRFSOC_TIMER_MATCH_2,
+ SIRFSOC_TIMER_MATCH_3, SIRFSOC_TIMER_MATCH_4, SIRFSOC_TIMER_MATCH_5,
+ SIRFSOC_TIMER_INT_EN, SIRFSOC_TIMER_WATCHDOG_EN, SIRFSOC_TIMER_DIV,
+ SIRFSOC_TIMER_LATCHED_LO, SIRFSOC_TIMER_LATCHED_HI,
+};
+
+static u32 sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT];
+
static void __iomem *sirfsoc_timer_base;
static void __init sirfsoc_of_timer_map(void);
@@ -106,6 +117,27 @@ static void sirfsoc_timer_set_mode(enum clock_event_mode mode,
}
}
+static void sirfsoc_clocksource_suspend(struct clocksource *cs)
+{
+ int i;
+
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
+
+ for (i = 0; i < SIRFSOC_TIMER_REG_CNT; i++)
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
+}
+
+static void sirfsoc_clocksource_resume(struct clocksource *cs)
+{
+ int i;
+
+ for (i = 0; i < SIRFSOC_TIMER_REG_CNT; i++)
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
+
+ writel_relaxed(sirfsoc_timer_reg_val[i - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
+ writel_relaxed(sirfsoc_timer_reg_val[i - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
+}
+
static struct clock_event_device sirfsoc_clockevent = {
.name = "sirfsoc_clockevent",
.rating = 200,
@@ -120,6 +152,8 @@ static struct clocksource sirfsoc_clocksource = {
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
.read = sirfsoc_timer_read,
+ .suspend = sirfsoc_clocksource_suspend,
+ .resume = sirfsoc_clocksource_resume,
};
static struct irqaction sirfsoc_timer_irq = {