diff options
author | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2013-04-05 08:59:03 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-04-09 12:48:21 -0400 |
commit | db4f3dab629109882170a7b1b8fb655a34c52846 (patch) | |
tree | a3c4ab822464b606c92f9e0056fbac7a565a7efd /arch/arm/mach-omap2/cpuidle44xx.c | |
parent | e7457253494fff660a72bc0cedeee97491ccd173 (diff) |
ARM: OMAP4+: CPUidle: Consolidate idle driver for OMAP5 support
The OMAP5 idle driver can re-use most of OMAP4 CPUidle driver
implementation. Also the next derivative SOCs are going to re-use
the MPUSS so, same driver with minor updates can be re-used.
Prepare the code so that its easier to add CPUidle support for
OMAP5 devices.
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'arch/arm/mach-omap2/cpuidle44xx.c')
-rw-r--r-- | arch/arm/mach-omap2/cpuidle44xx.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index e72b55d8eac3..8a0e43c69b0b 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP4 CPU idle Routines | 2 | * OMAP4+ CPU idle Routines |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011-2013 Texas Instruments, Inc. |
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | 5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
6 | * Rajendra Nayak <rnayak@ti.com> | 6 | * Rajendra Nayak <rnayak@ti.com> |
7 | * | 7 | * |
@@ -23,13 +23,13 @@ | |||
23 | #include "clockdomain.h" | 23 | #include "clockdomain.h" |
24 | 24 | ||
25 | /* Machine specific information */ | 25 | /* Machine specific information */ |
26 | struct omap4_idle_statedata { | 26 | struct idle_statedata { |
27 | u32 cpu_state; | 27 | u32 cpu_state; |
28 | u32 mpu_logic_state; | 28 | u32 mpu_logic_state; |
29 | u32 mpu_state; | 29 | u32 mpu_state; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | static struct omap4_idle_statedata omap4_idle_data[] = { | 32 | static struct idle_statedata omap4_idle_data[] = { |
33 | { | 33 | { |
34 | .cpu_state = PWRDM_POWER_ON, | 34 | .cpu_state = PWRDM_POWER_ON, |
35 | .mpu_state = PWRDM_POWER_ON, | 35 | .mpu_state = PWRDM_POWER_ON, |
@@ -52,11 +52,12 @@ static struct clockdomain *cpu_clkdm[NR_CPUS]; | |||
52 | 52 | ||
53 | static atomic_t abort_barrier; | 53 | static atomic_t abort_barrier; |
54 | static bool cpu_done[NR_CPUS]; | 54 | static bool cpu_done[NR_CPUS]; |
55 | static struct idle_statedata *state_ptr = &omap4_idle_data[0]; | ||
55 | 56 | ||
56 | /* Private functions */ | 57 | /* Private functions */ |
57 | 58 | ||
58 | /** | 59 | /** |
59 | * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions | 60 | * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions |
60 | * @dev: cpuidle device | 61 | * @dev: cpuidle device |
61 | * @drv: cpuidle driver | 62 | * @drv: cpuidle driver |
62 | * @index: the index of state to be entered | 63 | * @index: the index of state to be entered |
@@ -65,7 +66,7 @@ static bool cpu_done[NR_CPUS]; | |||
65 | * specified low power state selected by the governor. | 66 | * specified low power state selected by the governor. |
66 | * Returns the amount of time spent in the low power state. | 67 | * Returns the amount of time spent in the low power state. |
67 | */ | 68 | */ |
68 | static int omap4_enter_idle_simple(struct cpuidle_device *dev, | 69 | static int omap_enter_idle_simple(struct cpuidle_device *dev, |
69 | struct cpuidle_driver *drv, | 70 | struct cpuidle_driver *drv, |
70 | int index) | 71 | int index) |
71 | { | 72 | { |
@@ -76,11 +77,11 @@ static int omap4_enter_idle_simple(struct cpuidle_device *dev, | |||
76 | return index; | 77 | return index; |
77 | } | 78 | } |
78 | 79 | ||
79 | static int omap4_enter_idle_coupled(struct cpuidle_device *dev, | 80 | static int omap_enter_idle_coupled(struct cpuidle_device *dev, |
80 | struct cpuidle_driver *drv, | 81 | struct cpuidle_driver *drv, |
81 | int index) | 82 | int index) |
82 | { | 83 | { |
83 | struct omap4_idle_statedata *cx = &omap4_idle_data[index]; | 84 | struct idle_statedata *cx = state_ptr + index; |
84 | 85 | ||
85 | local_fiq_disable(); | 86 | local_fiq_disable(); |
86 | 87 | ||
@@ -158,7 +159,7 @@ fail: | |||
158 | return index; | 159 | return index; |
159 | } | 160 | } |
160 | 161 | ||
161 | static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | 162 | static DEFINE_PER_CPU(struct cpuidle_device, omap_idle_dev); |
162 | 163 | ||
163 | static struct cpuidle_driver omap4_idle_driver = { | 164 | static struct cpuidle_driver omap4_idle_driver = { |
164 | .name = "omap4_idle", | 165 | .name = "omap4_idle", |
@@ -170,7 +171,7 @@ static struct cpuidle_driver omap4_idle_driver = { | |||
170 | .exit_latency = 2 + 2, | 171 | .exit_latency = 2 + 2, |
171 | .target_residency = 5, | 172 | .target_residency = 5, |
172 | .flags = CPUIDLE_FLAG_TIME_VALID, | 173 | .flags = CPUIDLE_FLAG_TIME_VALID, |
173 | .enter = omap4_enter_idle_simple, | 174 | .enter = omap_enter_idle_simple, |
174 | .name = "C1", | 175 | .name = "C1", |
175 | .desc = "CPUx ON, MPUSS ON" | 176 | .desc = "CPUx ON, MPUSS ON" |
176 | }, | 177 | }, |
@@ -180,7 +181,7 @@ static struct cpuidle_driver omap4_idle_driver = { | |||
180 | .target_residency = 960, | 181 | .target_residency = 960, |
181 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | | 182 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | |
182 | CPUIDLE_FLAG_TIMER_STOP, | 183 | CPUIDLE_FLAG_TIMER_STOP, |
183 | .enter = omap4_enter_idle_coupled, | 184 | .enter = omap_enter_idle_coupled, |
184 | .name = "C2", | 185 | .name = "C2", |
185 | .desc = "CPUx OFF, MPUSS CSWR", | 186 | .desc = "CPUx OFF, MPUSS CSWR", |
186 | }, | 187 | }, |
@@ -190,7 +191,7 @@ static struct cpuidle_driver omap4_idle_driver = { | |||
190 | .target_residency = 1100, | 191 | .target_residency = 1100, |
191 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | | 192 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | |
192 | CPUIDLE_FLAG_TIMER_STOP, | 193 | CPUIDLE_FLAG_TIMER_STOP, |
193 | .enter = omap4_enter_idle_coupled, | 194 | .enter = omap_enter_idle_coupled, |
194 | .name = "C3", | 195 | .name = "C3", |
195 | .desc = "CPUx OFF, MPUSS OSWR", | 196 | .desc = "CPUx OFF, MPUSS OSWR", |
196 | }, | 197 | }, |
@@ -202,9 +203,9 @@ static struct cpuidle_driver omap4_idle_driver = { | |||
202 | /* Public functions */ | 203 | /* Public functions */ |
203 | 204 | ||
204 | /** | 205 | /** |
205 | * omap4_idle_init - Init routine for OMAP4 idle | 206 | * omap4_idle_init - Init routine for OMAP4+ idle |
206 | * | 207 | * |
207 | * Registers the OMAP4 specific cpuidle driver to the cpuidle | 208 | * Registers the OMAP4+ specific cpuidle driver to the cpuidle |
208 | * framework with the valid set of states. | 209 | * framework with the valid set of states. |
209 | */ | 210 | */ |
210 | int __init omap4_idle_init(void) | 211 | int __init omap4_idle_init(void) |
@@ -229,7 +230,7 @@ int __init omap4_idle_init(void) | |||
229 | } | 230 | } |
230 | 231 | ||
231 | for_each_cpu(cpu_id, cpu_online_mask) { | 232 | for_each_cpu(cpu_id, cpu_online_mask) { |
232 | dev = &per_cpu(omap4_idle_dev, cpu_id); | 233 | dev = &per_cpu(omap_idle_dev, cpu_id); |
233 | dev->cpu = cpu_id; | 234 | dev->cpu = cpu_id; |
234 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED | 235 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED |
235 | dev->coupled_cpus = *cpu_online_mask; | 236 | dev->coupled_cpus = *cpu_online_mask; |