diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2015-08-04 08:28:17 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2015-09-17 20:12:51 -0400 |
commit | 8b98d74780ab70147d40400c36059c16c1aea4da (patch) | |
tree | a2ec94095b7e4bec6e5f06b2c6a95118901c85a9 | |
parent | e233d74c30f48108b7affb4e76bfc8f3c76b68ce (diff) |
ARM: shmobile: R-Mobile: Use CPG/MSTP Clock Domain attach/detach helpers
The R-Mobile PM Domain driver manages both power domains and a clock
domain.
The clock domain part is very similar to the CPG/MSTP Clock Domain,
which is used on shmobile SoCs without device power domains, except for
the way how clocks suitable for power management are selected:
- The former uses the first clock tied to the device through the NULL
con_id, which is a relic from the legacy pm_clk_notifier-based
method in drivers/sh/pm_runtime.c,
- The latter looks for suitable clocks in DT, which is more
future-proof.
All platforms using this driver are now supported in DT-based ARM
multi-platform builds only, hence switch to using the CPG/MSTP Clock
Domain helpers.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/pm-rmobile.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index a5b96b990aea..89068c8ec50f 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * License. See the file "COPYING" in the main directory of this archive | 12 | * License. See the file "COPYING" in the main directory of this archive |
13 | * for more details. | 13 | * for more details. |
14 | */ | 14 | */ |
15 | #include <linux/clk/shmobile.h> | ||
15 | #include <linux/console.h> | 16 | #include <linux/console.h> |
16 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
17 | #include <linux/of.h> | 18 | #include <linux/of.h> |
@@ -124,36 +125,6 @@ static bool rmobile_pd_active_wakeup(struct device *dev) | |||
124 | return true; | 125 | return true; |
125 | } | 126 | } |
126 | 127 | ||
127 | static int rmobile_pd_attach_dev(struct generic_pm_domain *domain, | ||
128 | struct device *dev) | ||
129 | { | ||
130 | int error; | ||
131 | |||
132 | error = pm_clk_create(dev); | ||
133 | if (error) { | ||
134 | dev_err(dev, "pm_clk_create failed %d\n", error); | ||
135 | return error; | ||
136 | } | ||
137 | |||
138 | error = pm_clk_add(dev, NULL); | ||
139 | if (error) { | ||
140 | dev_err(dev, "pm_clk_add failed %d\n", error); | ||
141 | goto fail; | ||
142 | } | ||
143 | |||
144 | return 0; | ||
145 | |||
146 | fail: | ||
147 | pm_clk_destroy(dev); | ||
148 | return error; | ||
149 | } | ||
150 | |||
151 | static void rmobile_pd_detach_dev(struct generic_pm_domain *domain, | ||
152 | struct device *dev) | ||
153 | { | ||
154 | pm_clk_destroy(dev); | ||
155 | } | ||
156 | |||
157 | static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | 128 | static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) |
158 | { | 129 | { |
159 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; | 130 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; |
@@ -164,8 +135,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | |||
164 | genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; | 135 | genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; |
165 | genpd->power_off = rmobile_pd_power_down; | 136 | genpd->power_off = rmobile_pd_power_down; |
166 | genpd->power_on = rmobile_pd_power_up; | 137 | genpd->power_on = rmobile_pd_power_up; |
167 | genpd->attach_dev = rmobile_pd_attach_dev; | 138 | genpd->attach_dev = cpg_mstp_attach_dev; |
168 | genpd->detach_dev = rmobile_pd_detach_dev; | 139 | genpd->detach_dev = cpg_mstp_detach_dev; |
169 | __rmobile_pd_power_up(rmobile_pd, false); | 140 | __rmobile_pd_power_up(rmobile_pd, false); |
170 | } | 141 | } |
171 | 142 | ||