summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2011-09-22 15:42:25 +0200
committerRobert Marklund <robert.marklund@stericsson.com>2011-10-05 13:01:13 +0200
commit3d0ec28a9a3530c6db4fa7acdbd25caeae44cea3 (patch)
treea87f45519d21cc3179d5c270dd1d02be9efa21c1 /arch/arm
parent8364f08ab5f8dd3217ee2f2d4b8393c186e4d507 (diff)
ARM: kernel: smp_twd: Add save/restore functions
Add simple save and restore functions which needs to be called before/after the core(s) are powered off. Change-Id: I95b7e5205d067e3c4949ba09370ea099633ca54e Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32133
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/smp_twd.h8
-rw-r--r--arch/arm/kernel/smp_twd.c24
2 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index fed9981fba0..2379b5f930a 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -25,4 +25,12 @@ extern void __iomem *twd_base;
int twd_timer_ack(void);
void twd_timer_setup(struct clock_event_device *);
+#if defined(CONFIG_HOTPLUG) || defined(CONFIG_CPU_IDLE)
+void twd_save(void);
+void twd_restore(void);
+#else
+static inline void twd_save(void) { }
+static inline void twd_restore(void) { }
+#endif
+
#endif
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 36c12ef9499..bee5ce12cc1 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -32,6 +32,9 @@ static struct clk *twd_clk;
static unsigned long twd_timer_rate;
static DEFINE_PER_CPU(struct clock_event_device *, twd_ce);
+static DEFINE_PER_CPU(u32, twd_ctrl);
+static DEFINE_PER_CPU(u32, twd_load);
+
static void twd_set_mode(enum clock_event_mode mode,
struct clock_event_device *clk)
{
@@ -220,3 +223,24 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
clockevents_config_and_register(clk, twd_timer_rate,
0xf, 0xffffffff);
}
+
+#if defined(CONFIG_HOTPLUG) || defined(CONFIG_CPU_IDLE)
+void twd_save(void)
+{
+ int this_cpu = smp_processor_id();
+
+ per_cpu(twd_ctrl, this_cpu) = __raw_readl(twd_base + TWD_TIMER_CONTROL);
+ per_cpu(twd_load, this_cpu) = __raw_readl(twd_base + TWD_TIMER_LOAD);
+
+}
+
+void twd_restore(void)
+{
+ int this_cpu = smp_processor_id();
+
+ __raw_writel(per_cpu(twd_ctrl, this_cpu),
+ twd_base + TWD_TIMER_CONTROL);
+ __raw_writel(per_cpu(twd_load, this_cpu),
+ twd_base + TWD_TIMER_LOAD);
+}
+#endif