aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/pm-sh7372.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2011-10-19 17:52:50 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-21 18:20:12 -0400
commit382414b93ac1e8ee7693be710e60c83eacc97c6f (patch)
tree2b57a165a295af5468c611c553a9401a81f4b300 /arch/arm/mach-shmobile/pm-sh7372.c
parentd93f5cdea968284f05aa9905ee9752874885a6fa (diff)
ARM: mach-shmobile: sh7372 A4R support (v4)
This change adds support for the sh7372 A4R power domain. The sh7372 A4R hardware power domain contains the SH CPU Core and a set of I/O devices including multimedia accelerators and I2C controllers. One special case about A4R is the INTCS interrupt controller that needs to be saved and restored to keep working as expected. Also the LCDC hardware blocks are in a different hardware power domain but have their IRQs routed only through INTCS. So as long as LCDCs are active we cannot power down INTCS because that would risk losing interrupts. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm/mach-shmobile/pm-sh7372.c')
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index fde619dd4c05..79612737c5b2 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -44,6 +44,7 @@
44#define SPDCR 0xe6180008 44#define SPDCR 0xe6180008
45#define SWUCR 0xe6180014 45#define SWUCR 0xe6180014
46#define SBAR 0xe6180020 46#define SBAR 0xe6180020
47#define WUPRMSK 0xe6180028
47#define WUPSMSK 0xe618002c 48#define WUPSMSK 0xe618002c
48#define WUPSMSK2 0xe6180048 49#define WUPSMSK2 0xe6180048
49#define PSTR 0xe6180080 50#define PSTR 0xe6180080
@@ -80,6 +81,12 @@ static int pd_power_down(struct generic_pm_domain *genpd)
80 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd); 81 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
81 unsigned int mask = 1 << sh7372_pd->bit_shift; 82 unsigned int mask = 1 << sh7372_pd->bit_shift;
82 83
84 if (sh7372_pd->suspend)
85 sh7372_pd->suspend();
86
87 if (sh7372_pd->stay_on)
88 return 0;
89
83 if (__raw_readl(PSTR) & mask) { 90 if (__raw_readl(PSTR) & mask) {
84 unsigned int retry_count; 91 unsigned int retry_count;
85 92
@@ -106,6 +113,9 @@ static int pd_power_up(struct generic_pm_domain *genpd)
106 unsigned int retry_count; 113 unsigned int retry_count;
107 int ret = 0; 114 int ret = 0;
108 115
116 if (sh7372_pd->stay_on)
117 goto out;
118
109 if (__raw_readl(PSTR) & mask) 119 if (__raw_readl(PSTR) & mask)
110 goto out; 120 goto out;
111 121
@@ -122,14 +132,23 @@ static int pd_power_up(struct generic_pm_domain *genpd)
122 if (__raw_readl(SWUCR) & mask) 132 if (__raw_readl(SWUCR) & mask)
123 ret = -EIO; 133 ret = -EIO;
124 134
125 out:
126 if (!sh7372_pd->no_debug) 135 if (!sh7372_pd->no_debug)
127 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n", 136 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n",
128 mask, __raw_readl(PSTR)); 137 mask, __raw_readl(PSTR));
129 138
139 out:
140 if (ret == 0 && sh7372_pd->resume)
141 sh7372_pd->resume();
142
130 return ret; 143 return ret;
131} 144}
132 145
146static void sh7372_a4r_suspend(void)
147{
148 sh7372_intcs_suspend();
149 __raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
150}
151
133static bool pd_active_wakeup(struct device *dev) 152static bool pd_active_wakeup(struct device *dev)
134{ 153{
135 return true; 154 return true;
@@ -186,6 +205,14 @@ struct sh7372_pm_domain sh7372_d4 = {
186 .bit_shift = 3, 205 .bit_shift = 3,
187}; 206};
188 207
208struct sh7372_pm_domain sh7372_a4r = {
209 .bit_shift = 5,
210 .gov = &sh7372_always_on_gov,
211 .suspend = sh7372_a4r_suspend,
212 .resume = sh7372_intcs_resume,
213 .stay_on = true,
214};
215
189struct sh7372_pm_domain sh7372_a3rv = { 216struct sh7372_pm_domain sh7372_a3rv = {
190 .bit_shift = 6, 217 .bit_shift = 6,
191}; 218};