aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-08-14 07:35:39 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-08-25 09:33:45 -0400
commit111058c3ff29a6a25216b31789046c2a330baa7d (patch)
treea6a50e24203092695d36ed1bea16d3169e01dbd8
parentbc0403ff16e5305c3a14c2b0826616ceaabbf058 (diff)
ARM / shmobile: Make A3RV be a subdomain of A4LC on SH7372
Instead of coding the undocumented dependencies between power domains A3RV and A4LC on SH7372 directly into the low-level power up/down routines, make A3RV be a subdomain of A4LC, which will cause the same dependecies to hold. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Magnus Damm <damm@opensource.se>
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h3
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c48
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c3
3 files changed, 14 insertions, 40 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index ce595cee86cd..713cd2111e85 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -494,9 +494,12 @@ extern struct sh7372_pm_domain sh7372_a3sg;
494extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd); 494extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd);
495extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd, 495extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
496 struct platform_device *pdev); 496 struct platform_device *pdev);
497extern void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
498 struct sh7372_pm_domain *sh7372_sd);
497#else 499#else
498#define sh7372_init_pm_domain(pd) do { } while(0) 500#define sh7372_init_pm_domain(pd) do { } while(0)
499#define sh7372_add_device_to_domain(pd, pdev) do { } while(0) 501#define sh7372_add_device_to_domain(pd, pdev) do { } while(0)
502#define sh7372_pm_add_subdomain(pd, sd) do { } while(0)
500#endif /* CONFIG_PM */ 503#endif /* CONFIG_PM */
501 504
502#endif /* __ASM_SH7372_H__ */ 505#endif /* __ASM_SH7372_H__ */
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 933fb411be0f..b471b795dfc3 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -91,35 +91,6 @@ static int pd_power_up(struct generic_pm_domain *genpd)
91 return ret; 91 return ret;
92} 92}
93 93
94static int pd_power_up_a3rv(struct generic_pm_domain *genpd)
95{
96 int ret = pd_power_up(genpd);
97
98 /* force A4LC on after A3RV has been requested on */
99 pm_genpd_poweron(&sh7372_a4lc.genpd);
100
101 return ret;
102}
103
104static int pd_power_down_a3rv(struct generic_pm_domain *genpd)
105{
106 int ret = pd_power_down(genpd);
107
108 /* try to power down A4LC after A3RV is requested off */
109 genpd_queue_power_off_work(&sh7372_a4lc.genpd);
110
111 return ret;
112}
113
114static int pd_power_down_a4lc(struct generic_pm_domain *genpd)
115{
116 /* only power down A4LC if A3RV is off */
117 if (!(__raw_readl(PSTR) & (1 << sh7372_a3rv.bit_shift)))
118 return pd_power_down(genpd);
119
120 return -EBUSY;
121}
122
123static bool pd_active_wakeup(struct device *dev) 94static bool pd_active_wakeup(struct device *dev)
124{ 95{
125 return true; 96 return true;
@@ -133,17 +104,8 @@ void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
133 genpd->stop_device = pm_clk_suspend; 104 genpd->stop_device = pm_clk_suspend;
134 genpd->start_device = pm_clk_resume; 105 genpd->start_device = pm_clk_resume;
135 genpd->active_wakeup = pd_active_wakeup; 106 genpd->active_wakeup = pd_active_wakeup;
136 107 genpd->power_off = pd_power_down;
137 if (sh7372_pd == &sh7372_a4lc) { 108 genpd->power_on = pd_power_up;
138 genpd->power_off = pd_power_down_a4lc;
139 genpd->power_on = pd_power_up;
140 } else if (sh7372_pd == &sh7372_a3rv) {
141 genpd->power_off = pd_power_down_a3rv;
142 genpd->power_on = pd_power_up_a3rv;
143 } else {
144 genpd->power_off = pd_power_down;
145 genpd->power_on = pd_power_up;
146 }
147 genpd->power_on(&sh7372_pd->genpd); 109 genpd->power_on(&sh7372_pd->genpd);
148} 110}
149 111
@@ -159,6 +121,12 @@ void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
159 pm_genpd_add_device(&sh7372_pd->genpd, dev); 121 pm_genpd_add_device(&sh7372_pd->genpd, dev);
160} 122}
161 123
124void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
125 struct sh7372_pm_domain *sh7372_sd)
126{
127 pm_genpd_add_subdomain(&sh7372_pd->genpd, &sh7372_sd->genpd);
128}
129
162struct sh7372_pm_domain sh7372_a4lc = { 130struct sh7372_pm_domain sh7372_a4lc = {
163 .bit_shift = 1, 131 .bit_shift = 1,
164}; 132};
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 79f0413d8725..a12ee41f5c03 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -30,6 +30,7 @@
30#include <linux/sh_dma.h> 30#include <linux/sh_dma.h>
31#include <linux/sh_intc.h> 31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/pm_domain.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <mach/sh7372.h> 35#include <mach/sh7372.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -848,6 +849,8 @@ void __init sh7372_add_standard_devices(void)
848 sh7372_init_pm_domain(&sh7372_a3ri); 849 sh7372_init_pm_domain(&sh7372_a3ri);
849 sh7372_init_pm_domain(&sh7372_a3sg); 850 sh7372_init_pm_domain(&sh7372_a3sg);
850 851
852 sh7372_pm_add_subdomain(&sh7372_a4lc, &sh7372_a3rv);
853
851 platform_add_devices(sh7372_early_devices, 854 platform_add_devices(sh7372_early_devices,
852 ARRAY_SIZE(sh7372_early_devices)); 855 ARRAY_SIZE(sh7372_early_devices));
853 856