diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2016-04-20 08:02:40 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2016-04-25 19:56:27 -0400 |
commit | 1c8c77f52d1037c61468539e1d68c44f9e710536 (patch) | |
tree | 23b0bcd29bed16d2a25977bf2f8732733b3bd298 | |
parent | 2f024cef5b064d5498fe466dfe9492d46b5b12a4 (diff) |
soc: renesas: rcar-sysc: Enable Clock Domain for I/O devices
On R-Car H3, some power areas (e.g. A3VP) contain I/O devices, which are
also part of the CPG/MSSR Clock Domain.
On all R-Car SoCs, devices in the "always-on" PM Domain are part of the
Clock Domain served by the CPG/MSSR or CPG/MSTP driver.
Hook up the CPG/MSTP or CPG/MSSR Clock Domain attach/detach callbacks to
enable power management using module clocks. Which callback to hook up
depends on the presence of device nodes compatible with
"renesas,cpg-mstp-clocks". This clears the path for a future migration
from the CPG/MSTP to the CPG/MSSR driver on R-Car H1 and
Gen2.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | drivers/soc/renesas/rcar-sysc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c index 4e760d63f2ab..0d49a25de740 100644 --- a/drivers/soc/renesas/rcar-sysc.c +++ b/drivers/soc/renesas/rcar-sysc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * for more details. | 9 | * for more details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/clk/renesas.h> | ||
12 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
13 | #include <linux/err.h> | 14 | #include <linux/err.h> |
14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
@@ -217,6 +218,8 @@ static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd) | |||
217 | return rcar_sysc_power_up(&pd->ch); | 218 | return rcar_sysc_power_up(&pd->ch); |
218 | } | 219 | } |
219 | 220 | ||
221 | static bool has_cpg_mstp; | ||
222 | |||
220 | static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) | 223 | static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) |
221 | { | 224 | { |
222 | struct generic_pm_domain *genpd = &pd->genpd; | 225 | struct generic_pm_domain *genpd = &pd->genpd; |
@@ -248,6 +251,18 @@ static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) | |||
248 | gov = &pm_domain_always_on_gov; | 251 | gov = &pm_domain_always_on_gov; |
249 | } | 252 | } |
250 | 253 | ||
254 | if (!(pd->flags & (PD_CPU | PD_SCU))) { | ||
255 | /* Enable Clock Domain for I/O devices */ | ||
256 | genpd->flags = GENPD_FLAG_PM_CLK; | ||
257 | if (has_cpg_mstp) { | ||
258 | genpd->attach_dev = cpg_mstp_attach_dev; | ||
259 | genpd->detach_dev = cpg_mstp_detach_dev; | ||
260 | } else { | ||
261 | genpd->attach_dev = cpg_mssr_attach_dev; | ||
262 | genpd->detach_dev = cpg_mssr_detach_dev; | ||
263 | } | ||
264 | } | ||
265 | |||
251 | genpd->power_off = rcar_sysc_pd_power_off; | 266 | genpd->power_off = rcar_sysc_pd_power_off; |
252 | genpd->power_on = rcar_sysc_pd_power_on; | 267 | genpd->power_on = rcar_sysc_pd_power_on; |
253 | 268 | ||
@@ -294,6 +309,9 @@ static int __init rcar_sysc_pd_init(void) | |||
294 | 309 | ||
295 | info = match->data; | 310 | info = match->data; |
296 | 311 | ||
312 | has_cpg_mstp = of_find_compatible_node(NULL, NULL, | ||
313 | "renesas,cpg-mstp-clocks"); | ||
314 | |||
297 | base = of_iomap(np, 0); | 315 | base = of_iomap(np, 0); |
298 | if (!base) { | 316 | if (!base) { |
299 | pr_warn("%s: Cannot map regs\n", np->full_name); | 317 | pr_warn("%s: Cannot map regs\n", np->full_name); |