aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-10-06 10:42:07 -0400
committerArnd Bergmann <arnd@arndb.de>2015-10-06 10:42:07 -0400
commit64685273186b71b75734771ca21823cec2d994c3 (patch)
tree7639c3e38c374b7d0fa5d8322213afb5ea53c32e
parent049e6dde7e57f0054fdc49102e7ef4830c698b46 (diff)
parent8b98d74780ab70147d40400c36059c16c1aea4da (diff)
Merge tag 'renesas-soc-for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/soc
Merge "Renesas ARM Based SoC Updates for v4.4" from Simon Horman: * ARM: shmobile: R-Mobile: Use CPG/MSTP Clock Domain attach/detach helpers This part of a multi-stage effort by Geert Uytterhoeven to add: "Clock Domain support to the Clock Pulse Generator (CPG) Module Stop (MSTP) Clocks driver using the generic PM Domain, to be used on shmobile SoCs without device power domains (R-Car Gen1 and Gen2, RZ). This allows to power-manage the module clocks of SoC devices that are part of the CPG/MSTP Clock Domain using Runtime PM, or for system suspend/resume, similar to SoCs with device power domains (SH-Mobile and R-Mobile)." * tag 'renesas-soc-for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: R-Mobile: Use CPG/MSTP Clock Domain attach/detach helpers clk: shmobile: mstp: Consider "zb_clk" suitable for power management
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c35
-rw-r--r--drivers/clk/shmobile/clk-mstp.c4
2 files changed, 7 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
127static 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
146fail:
147 pm_clk_destroy(dev);
148 return error;
149}
150
151static void rmobile_pd_detach_dev(struct generic_pm_domain *domain,
152 struct device *dev)
153{
154 pm_clk_destroy(dev);
155}
156
157static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) 128static 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
diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index b1df7b2f1e97..a0a56e99882a 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -259,6 +259,10 @@ int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev)
259 "renesas,cpg-mstp-clocks")) 259 "renesas,cpg-mstp-clocks"))
260 goto found; 260 goto found;
261 261
262 /* BSC on r8a73a4/sh73a0 uses zb_clk instead of an mstp clock */
263 if (!strcmp(clkspec.np->name, "zb_clk"))
264 goto found;
265
262 of_node_put(clkspec.np); 266 of_node_put(clkspec.np);
263 i++; 267 i++;
264 } 268 }