diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-02-02 04:38:50 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2012-03-05 18:38:02 -0500 |
commit | 92206fd292da7632c039f6c4054bdaac08b030c0 (patch) | |
tree | 926bc332a99009f74ff355120c0b8811a1af696f | |
parent | e68e8093ed570f9272665112d13d4c5811536680 (diff) |
ARM: OMAP2+: PM: share clkdms_setup() across OMAP2, 3, 4
clkdms_setup() is identical across OMAP2, 3, and 4, so share it.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm44xx.c | 18 |
5 files changed, 14 insertions, 45 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index c3fe8eada2cc..f9e807958f3e 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -68,6 +68,16 @@ static void omap2_init_processor_devices(void) | |||
68 | #define FORCEWAKEUP_SWITCH 0 | 68 | #define FORCEWAKEUP_SWITCH 0 |
69 | #define LOWPOWERSTATE_SWITCH 1 | 69 | #define LOWPOWERSTATE_SWITCH 1 |
70 | 70 | ||
71 | int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) | ||
72 | { | ||
73 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | ||
74 | clkdm_allow_idle(clkdm); | ||
75 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | ||
76 | atomic_read(&clkdm->usecount) == 0) | ||
77 | clkdm_sleep(clkdm); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
71 | /* | 81 | /* |
72 | * This sets pwrdm state (other than mpu & core. Currently only ON & | 82 | * This sets pwrdm state (other than mpu & core. Currently only ON & |
73 | * RET are supported. | 83 | * RET are supported. |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index b737b11e4499..eef67f67872e 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -22,6 +22,7 @@ extern int omap3_can_sleep(void); | |||
22 | extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state); | 22 | extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state); |
23 | extern int omap3_idle_init(void); | 23 | extern int omap3_idle_init(void); |
24 | extern int omap4_idle_init(void); | 24 | extern int omap4_idle_init(void); |
25 | extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused); | ||
25 | 26 | ||
26 | #if defined(CONFIG_PM_OPP) | 27 | #if defined(CONFIG_PM_OPP) |
27 | extern int omap3_opp_init(void); | 28 | extern int omap3_opp_init(void); |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 36c587f4981b..c4fdde477421 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -283,17 +283,6 @@ static const struct platform_suspend_ops omap_pm_ops = { | |||
283 | static const struct platform_suspend_ops __initdata omap_pm_ops; | 283 | static const struct platform_suspend_ops __initdata omap_pm_ops; |
284 | #endif /* CONFIG_SUSPEND */ | 284 | #endif /* CONFIG_SUSPEND */ |
285 | 285 | ||
286 | /* XXX This function should be shareable between OMAP2xxx and OMAP3 */ | ||
287 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | ||
288 | { | ||
289 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | ||
290 | clkdm_allow_idle(clkdm); | ||
291 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | ||
292 | atomic_read(&clkdm->usecount) == 0) | ||
293 | clkdm_sleep(clkdm); | ||
294 | return 0; | ||
295 | } | ||
296 | |||
297 | static void __init prcm_setup_regs(void) | 286 | static void __init prcm_setup_regs(void) |
298 | { | 287 | { |
299 | int i, num_mem_banks; | 288 | int i, num_mem_banks; |
@@ -335,7 +324,7 @@ static void __init prcm_setup_regs(void) | |||
335 | clkdm_sleep(gfx_clkdm); | 324 | clkdm_sleep(gfx_clkdm); |
336 | 325 | ||
337 | /* Enable hardware-supervised idle for all clkdms */ | 326 | /* Enable hardware-supervised idle for all clkdms */ |
338 | clkdm_for_each(clkdms_setup, NULL); | 327 | clkdm_for_each(omap_pm_clkdms_setup, NULL); |
339 | clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); | 328 | clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); |
340 | 329 | ||
341 | /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk | 330 | /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 60279b3502d9..5fc1a987fccc 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -736,21 +736,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | |||
736 | } | 736 | } |
737 | 737 | ||
738 | /* | 738 | /* |
739 | * Enable hw supervised mode for all clockdomains if it's | ||
740 | * supported. Initiate sleep transition for other clockdomains, if | ||
741 | * they are not used | ||
742 | */ | ||
743 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | ||
744 | { | ||
745 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | ||
746 | clkdm_allow_idle(clkdm); | ||
747 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | ||
748 | atomic_read(&clkdm->usecount) == 0) | ||
749 | clkdm_sleep(clkdm); | ||
750 | return 0; | ||
751 | } | ||
752 | |||
753 | /* | ||
754 | * Push functions to SRAM | 739 | * Push functions to SRAM |
755 | * | 740 | * |
756 | * The minimum set of functions is pushed to SRAM for execution: | 741 | * The minimum set of functions is pushed to SRAM for execution: |
@@ -819,7 +804,7 @@ static int __init omap3_pm_init(void) | |||
819 | goto err2; | 804 | goto err2; |
820 | } | 805 | } |
821 | 806 | ||
822 | (void) clkdm_for_each(clkdms_setup, NULL); | 807 | (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); |
823 | 808 | ||
824 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); | 809 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); |
825 | if (mpu_pwrdm == NULL) { | 810 | if (mpu_pwrdm == NULL) { |
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index c840689df24a..84d52f729af4 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c | |||
@@ -120,22 +120,6 @@ static const struct platform_suspend_ops omap_pm_ops = { | |||
120 | }; | 120 | }; |
121 | #endif /* CONFIG_SUSPEND */ | 121 | #endif /* CONFIG_SUSPEND */ |
122 | 122 | ||
123 | /* | ||
124 | * Enable hardware supervised mode for all clockdomains if it's | ||
125 | * supported. Initiate sleep transition for other clockdomains, if | ||
126 | * they are not used | ||
127 | */ | ||
128 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | ||
129 | { | ||
130 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | ||
131 | clkdm_allow_idle(clkdm); | ||
132 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | ||
133 | atomic_read(&clkdm->usecount) == 0) | ||
134 | clkdm_sleep(clkdm); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | |||
139 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | 123 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) |
140 | { | 124 | { |
141 | struct power_state *pwrst; | 125 | struct power_state *pwrst; |
@@ -247,7 +231,7 @@ static int __init omap4_pm_init(void) | |||
247 | goto err2; | 231 | goto err2; |
248 | } | 232 | } |
249 | 233 | ||
250 | (void) clkdm_for_each(clkdms_setup, NULL); | 234 | (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); |
251 | 235 | ||
252 | #ifdef CONFIG_SUSPEND | 236 | #ifdef CONFIG_SUSPEND |
253 | suspend_set_ops(&omap_pm_ops); | 237 | suspend_set_ops(&omap_pm_ops); |