* [PATCH 01/05] ARM: mach-shmobile: sh7372 D4 support
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
@ 2011-07-07 13:32 ` Magnus Damm
2011-07-07 13:32 ` [PATCH 02/05] ARM: mach-shmobile: Runtime PM late init callback Magnus Damm
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2011-07-07 13:32 UTC (permalink / raw)
To: linux-sh; +Cc: linux-pm
From: Magnus Damm <damm@opensource.se>
Add support for the sh7372 D4 power domain. This power domain
contains the Coresight-ETM hardware block.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/include/mach/sh7372.h | 1 +
arch/arm/mach-shmobile/pm-sh7372.c | 4 ++++
arch/arm/mach-shmobile/setup-sh7372.c | 1 +
3 files changed, 6 insertions(+)
--- 0002/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ work/arch/arm/mach-shmobile/include/mach/sh7372.h 2011-07-07 19:20:09.000000000 +0900
@@ -486,6 +486,7 @@ static inline struct sh7372_pm_domain *t
#ifdef CONFIG_PM
extern struct sh7372_pm_domain sh7372_a4lc;
extern struct sh7372_pm_domain sh7372_a4mp;
+extern struct sh7372_pm_domain sh7372_d4;
extern struct sh7372_pm_domain sh7372_a3rv;
extern struct sh7372_pm_domain sh7372_a3ri;
extern struct sh7372_pm_domain sh7372_a3sg;
--- 0002/arch/arm/mach-shmobile/pm-sh7372.c
+++ work/arch/arm/mach-shmobile/pm-sh7372.c 2011-07-07 19:24:26.000000000 +0900
@@ -129,6 +129,10 @@ struct sh7372_pm_domain sh7372_a4mp = {
.bit_shift = 2,
};
+struct sh7372_pm_domain sh7372_d4 = {
+ .bit_shift = 3,
+};
+
struct sh7372_pm_domain sh7372_a3rv = {
.bit_shift = 6,
};
--- 0002/arch/arm/mach-shmobile/setup-sh7372.c
+++ work/arch/arm/mach-shmobile/setup-sh7372.c 2011-07-07 19:20:33.000000000 +0900
@@ -843,6 +843,7 @@ void __init sh7372_add_standard_devices(
{
sh7372_init_pm_domain(&sh7372_a4lc);
sh7372_init_pm_domain(&sh7372_a4mp);
+ sh7372_init_pm_domain(&sh7372_d4);
sh7372_init_pm_domain(&sh7372_a3rv);
sh7372_init_pm_domain(&sh7372_a3ri);
sh7372_init_pm_domain(&sh7372_a3sg);
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 02/05] ARM: mach-shmobile: Runtime PM late init callback
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
2011-07-07 13:32 ` [PATCH 01/05] ARM: mach-shmobile: sh7372 D4 support Magnus Damm
@ 2011-07-07 13:32 ` Magnus Damm
2011-07-07 13:32 ` [PATCH 03/05] ARM: mach-shmobile: sh7372 late pm domain off Magnus Damm
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2011-07-07 13:32 UTC (permalink / raw)
To: linux-sh; +Cc: linux-pm
From: Magnus Damm <damm@opensource.se>
Add a mach-shmobile specific callback for SoC-specific code
to hook into. By having the late_initcall() in a common place
we can have multi-SoC/board support in the same kernel binary.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/include/mach/common.h | 1 +
arch/arm/mach-shmobile/pm_runtime.c | 10 ++++++++++
2 files changed, 11 insertions(+)
--- 0001/arch/arm/mach-shmobile/include/mach/common.h
+++ work/arch/arm/mach-shmobile/include/mach/common.h 2011-07-07 19:39:49.000000000 +0900
@@ -12,6 +12,7 @@ extern struct platform_suspend_ops shmob
struct cpuidle_device;
extern void (*shmobile_cpuidle_modes[])(void);
extern void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev);
+extern void (*shmobile_runtime_pm_late_init)(void);
extern void sh7367_init_irq(void);
extern void sh7367_add_early_devices(void);
--- 0001/arch/arm/mach-shmobile/pm_runtime.c
+++ work/arch/arm/mach-shmobile/pm_runtime.c 2011-07-07 19:39:28.000000000 +0900
@@ -56,3 +56,13 @@ static int __init sh_pm_runtime_init(voi
return 0;
}
core_initcall(sh_pm_runtime_init);
+
+void (*shmobile_runtime_pm_late_init)(void);
+
+static int __init sh_pm_runtime_late_init(void)
+{
+ if (shmobile_runtime_pm_late_init)
+ shmobile_runtime_pm_late_init();
+ return 0;
+}
+late_initcall(sh_pm_runtime_late_init);
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 03/05] ARM: mach-shmobile: sh7372 late pm domain off
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
2011-07-07 13:32 ` [PATCH 01/05] ARM: mach-shmobile: sh7372 D4 support Magnus Damm
2011-07-07 13:32 ` [PATCH 02/05] ARM: mach-shmobile: Runtime PM late init callback Magnus Damm
@ 2011-07-07 13:32 ` Magnus Damm
2011-07-07 13:32 ` [PATCH 04/05] PM: export pm_genpd_poweron() in header Magnus Damm
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2011-07-07 13:32 UTC (permalink / raw)
To: linux-sh; +Cc: linux-pm
From: Magnus Damm <damm@opensource.se>
Add sh7372 specific code to power down unused pm domains.
This should really be replaced by some generic PM core
code IMO, but until that happens this patch makes sure
we don't waste power by leaving unused power domains on.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/pm-sh7372.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- 0005/arch/arm/mach-shmobile/pm-sh7372.c
+++ work/arch/arm/mach-shmobile/pm-sh7372.c 2011-07-07 20:15:19.000000000 +0900
@@ -96,6 +96,17 @@ static bool pd_active_wakeup(struct devi
return true;
}
+static void sh7372_late_pm_domain_off(void)
+{
+ /* request power down of unused pm domains */
+ queue_work(pm_wq, &sh7372_a4lc.genpd.power_off_work);
+ queue_work(pm_wq, &sh7372_a4mp.genpd.power_off_work);
+ queue_work(pm_wq, &sh7372_d4.genpd.power_off_work);
+ queue_work(pm_wq, &sh7372_a3rv.genpd.power_off_work);
+ queue_work(pm_wq, &sh7372_a3ri.genpd.power_off_work);
+ queue_work(pm_wq, &sh7372_a3sg.genpd.power_off_work);
+}
+
void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
{
struct generic_pm_domain *genpd = &sh7372_pd->genpd;
@@ -107,6 +118,8 @@ void sh7372_init_pm_domain(struct sh7372
genpd->power_off = pd_power_down;
genpd->power_on = pd_power_up;
pd_power_up(&sh7372_pd->genpd);
+
+ shmobile_runtime_pm_late_init = sh7372_late_pm_domain_off;
}
void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 04/05] PM: export pm_genpd_poweron() in header
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
` (2 preceding siblings ...)
2011-07-07 13:32 ` [PATCH 03/05] ARM: mach-shmobile: sh7372 late pm domain off Magnus Damm
@ 2011-07-07 13:32 ` Magnus Damm
2011-07-07 13:32 ` [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC Magnus Damm
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2011-07-07 13:32 UTC (permalink / raw)
To: linux-sh; +Cc: linux-pm
From: Magnus Damm <damm@opensource.se>
Allow SoC-specific code to call pm_genpd_poweron().
Signed-off-by: Magnus Damm <damm@opensource.se>
---
Perhaps there are better ways to deal with this?
drivers/base/power/domain.c | 2 +-
include/linux/pm_domain.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
--- 0001/drivers/base/power/domain.c
+++ work/drivers/base/power/domain.c 2011-07-07 21:37:49.000000000 +0900
@@ -37,7 +37,7 @@ static void genpd_sd_counter_dec(struct
* Restore power to @genpd and all of its parents so that it is possible to
* resume a device belonging to it.
*/
-static int pm_genpd_poweron(struct generic_pm_domain *genpd)
+int pm_genpd_poweron(struct generic_pm_domain *genpd)
{
int ret = 0;
--- 0001/include/linux/pm_domain.h
+++ work/include/linux/pm_domain.h 2011-07-07 21:37:49.000000000 +0900
@@ -63,6 +63,7 @@ extern int pm_genpd_remove_subdomain(str
struct generic_pm_domain *target);
extern void pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off);
+extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
#else
static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
struct device *dev)
@@ -86,6 +87,10 @@ static inline int pm_genpd_remove_subdom
}
static inline void pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off) {}
+static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
+{
+ return -ENOSYS;
+}
#endif
#endif /* _LINUX_PM_DOMAIN_H */
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
` (3 preceding siblings ...)
2011-07-07 13:32 ` [PATCH 04/05] PM: export pm_genpd_poweron() in header Magnus Damm
@ 2011-07-07 13:32 ` Magnus Damm
2011-07-10 8:46 ` [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Rafael J. Wysocki
2011-07-10 8:46 ` Rafael J. Wysocki
6 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2011-07-07 13:32 UTC (permalink / raw)
To: linux-sh; +Cc: linux-pm
From: Magnus Damm <damm@opensource.se>
Add a power domain workaround for the VPU and A3RV on sh7372.
The sh7372 data sheet mentions that the VPU is located in the
A3RV power domain. The A3RV power domain is not related to A4LC
in any way, but testing shows that unless A3RV _and_ A4LC are
powered on the VPU test program will bomb out.
This issue may be caused by a more or less undocumented dependency
on the MERAM block that happens to be located in A4LC. So now we
know that the out-of-reset requirement of the VPU is that the MERAM
is powered on.
This patch adds a workaround for A3RV to make sure A4LC is powered
on - this so we can use the VPU even though the LCDCs are in blanking
state and A4LC is supposed to be off.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/pm-sh7372.c | 45 +++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
--- 0006/arch/arm/mach-shmobile/pm-sh7372.c
+++ work/arch/arm/mach-shmobile/pm-sh7372.c 2011-07-07 21:57:14.000000000 +0900
@@ -91,6 +91,36 @@ static int pd_power_up(struct generic_pm
return ret;
}
+static int pd_power_up_a3rv(struct generic_pm_domain *genpd)
+{
+ int ret = pd_power_up(genpd);
+
+ /* force A4LC on after A3RV has been requested on */
+ pm_genpd_poweron(&sh7372_a4lc.genpd);
+
+ return ret;
+}
+
+static int pd_power_down_a3rv(struct generic_pm_domain *genpd)
+{
+ int ret = pd_power_down(genpd);
+
+ /* try to power down A4LC after A3RV is requested off */
+ pm_genpd_poweron(&sh7372_a4lc.genpd);
+ queue_work(pm_wq, &sh7372_a4lc.genpd.power_off_work);
+
+ return ret;
+}
+
+static int pd_power_down_a4lc(struct generic_pm_domain *genpd)
+{
+ /* only power down A4LC if A3RV is off */
+ if (!(__raw_readl(PSTR) & (1 << sh7372_a3rv.bit_shift)))
+ return pd_power_down(genpd);
+
+ return 0;
+}
+
static bool pd_active_wakeup(struct device *dev)
{
return true;
@@ -115,9 +145,18 @@ void sh7372_init_pm_domain(struct sh7372
genpd->stop_device = pm_clk_suspend;
genpd->start_device = pm_clk_resume;
genpd->active_wakeup = pd_active_wakeup;
- genpd->power_off = pd_power_down;
- genpd->power_on = pd_power_up;
- pd_power_up(&sh7372_pd->genpd);
+
+ if (sh7372_pd == &sh7372_a4lc) {
+ genpd->power_off = pd_power_down_a4lc;
+ genpd->power_on = pd_power_up;
+ } else if (sh7372_pd == &sh7372_a3rv) {
+ genpd->power_off = pd_power_down_a3rv;
+ genpd->power_on = pd_power_up_a3rv;
+ } else {
+ genpd->power_off = pd_power_down;
+ genpd->power_on = pd_power_up;
+ }
+ genpd->power_on(&sh7372_pd->genpd);
shmobile_runtime_pm_late_init = sh7372_late_pm_domain_off;
}
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
` (4 preceding siblings ...)
2011-07-07 13:32 ` [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC Magnus Damm
@ 2011-07-10 8:46 ` Rafael J. Wysocki
2011-07-10 8:46 ` Rafael J. Wysocki
6 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2011-07-10 8:46 UTC (permalink / raw)
To: Magnus Damm; +Cc: linux-pm, linux-sh
On Thursday, July 07, 2011, Magnus Damm wrote:
> ARM: mach-shmobile: another sh7372 power domain update
>
> [PATCH 01/05] ARM: mach-shmobile: sh7372 D4 support
> [PATCH 02/05] ARM: mach-shmobile: Runtime PM late init callback
> [PATCH 03/05] ARM: mach-shmobile: sh7372 late pm domain off
> [PATCH 04/05] PM: export pm_genpd_poweron() in header
> [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC
>
> These patches update the partial hardware power domain support
> included in the pm-domains branch of the suspend-2.6 git tree.
All patches applied to suspend-2.6/pm-domains.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update
2011-07-07 13:32 [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Magnus Damm
` (5 preceding siblings ...)
2011-07-10 8:46 ` [PATCH 00/05] ARM: mach-shmobile: another sh7372 power domain update Rafael J. Wysocki
@ 2011-07-10 8:46 ` Rafael J. Wysocki
6 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2011-07-10 8:46 UTC (permalink / raw)
To: linux-sh
On Thursday, July 07, 2011, Magnus Damm wrote:
> ARM: mach-shmobile: another sh7372 power domain update
>
> [PATCH 01/05] ARM: mach-shmobile: sh7372 D4 support
> [PATCH 02/05] ARM: mach-shmobile: Runtime PM late init callback
> [PATCH 03/05] ARM: mach-shmobile: sh7372 late pm domain off
> [PATCH 04/05] PM: export pm_genpd_poweron() in header
> [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC
>
> These patches update the partial hardware power domain support
> included in the pm-domains branch of the suspend-2.6 git tree.
All patches applied to suspend-2.6/pm-domains.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 9+ messages in thread