* [PATCH 1/4] clk: renesas: mstp: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF
2016-03-09 19:18 [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
@ 2016-03-09 19:18 ` Geert Uytterhoeven
2016-03-09 19:18 ` [PATCH 2/4] clk: renesas: cpg-mssr: " Geert Uytterhoeven
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-03-09 19:18 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Simon Horman, Magnus Damm, Laurent Pinchart, linux-clk,
linux-renesas-soc, Geert Uytterhoeven
As of commit 71d076ceb245f0d9 ("ARM: shmobile: Enable PM and
PM_GENERIC_DOMAINS for SoCs with PM Domains"),
CONFIG_PM_GENERIC_DOMAINS_OF is always enabled for SoCs with MSTP
clocks.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/clk/renesas/clk-mstp.c | 2 --
include/linux/clk/renesas.h | 4 ----
2 files changed, 6 deletions(-)
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 3d44e183aedd61c7..91eed7ced08d8fe6 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -244,7 +244,6 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init);
-#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev)
{
struct device_node *np = dev->of_node;
@@ -326,4 +325,3 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np)
of_genpd_add_provider_simple(np, pd);
}
-#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h
index 7adfd80fbf55d484..2a3379cf13304837 100644
--- a/include/linux/clk/renesas.h
+++ b/include/linux/clk/renesas.h
@@ -24,12 +24,8 @@ void r8a7778_clocks_init(u32 mode);
void r8a7779_clocks_init(u32 mode);
void rcar_gen2_clocks_init(u32 mode);
-#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
void cpg_mstp_add_clk_domain(struct device_node *np);
int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev);
void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev);
-#else
-static inline void cpg_mstp_add_clk_domain(struct device_node *np) {}
-#endif
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] clk: renesas: cpg-mssr: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF
2016-03-09 19:18 [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
2016-03-09 19:18 ` [PATCH 1/4] clk: renesas: mstp: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF Geert Uytterhoeven
@ 2016-03-09 19:18 ` Geert Uytterhoeven
2016-03-10 2:21 ` Laurent Pinchart
2016-03-09 19:18 ` [PATCH 3/4] clk: renesas: mstp: Clarify cpg_mstp_{at,de}tach_dev() domain parameter Geert Uytterhoeven
` (2 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-03-09 19:18 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Simon Horman, Magnus Damm, Laurent Pinchart, linux-clk,
linux-renesas-soc, Geert Uytterhoeven
As of commit 71d076ceb245f0d9 ("ARM: shmobile: Enable PM and
PM_GENERIC_DOMAINS for SoCs with PM Domains"),
CONFIG_PM_GENERIC_DOMAINS_OF is always enabled for SoCs with a CPG/MSSR
block.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/clk/renesas/renesas-cpg-mssr.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 58e24b326a48bb81..7482e7f6d37fbe22 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -376,7 +376,6 @@ fail:
}
-#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
struct cpg_mssr_clk_domain {
struct generic_pm_domain genpd;
struct device_node *np;
@@ -491,14 +490,6 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev,
of_genpd_add_provider_simple(np, genpd);
return 0;
}
-#else
-static inline int cpg_mssr_add_clk_domain(struct device *dev,
- const unsigned int *core_pm_clks,
- unsigned int num_core_pm_clks)
-{
- return 0;
-}
-#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
static const struct of_device_id cpg_mssr_match[] = {
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/4] clk: renesas: cpg-mssr: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF
2016-03-09 19:18 ` [PATCH 2/4] clk: renesas: cpg-mssr: " Geert Uytterhoeven
@ 2016-03-10 2:21 ` Laurent Pinchart
0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2016-03-10 2:21 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Simon Horman, Magnus Damm,
linux-clk, linux-renesas-soc
Hi Geert,
Thank you for the patch.
On Wednesday 09 March 2016 20:18:32 Geert Uytterhoeven wrote:
> As of commit 71d076ceb245f0d9 ("ARM: shmobile: Enable PM and
> PM_GENERIC_DOMAINS for SoCs with PM Domains"),
> CONFIG_PM_GENERIC_DOMAINS_OF is always enabled for SoCs with a CPG/MSSR
> block.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/clk/renesas/renesas-cpg-mssr.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c
> b/drivers/clk/renesas/renesas-cpg-mssr.c index
> 58e24b326a48bb81..7482e7f6d37fbe22 100644
> --- a/drivers/clk/renesas/renesas-cpg-mssr.c
> +++ b/drivers/clk/renesas/renesas-cpg-mssr.c
> @@ -376,7 +376,6 @@ fail:
> }
>
>
While at it you can remove one of the blank lines here...
> -#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
> struct cpg_mssr_clk_domain {
> struct generic_pm_domain genpd;
> struct device_node *np;
> @@ -491,14 +490,6 @@ static int __init cpg_mssr_add_clk_domain(struct device
> *dev, of_genpd_add_provider_simple(np, genpd);
> return 0;
> }
> -#else
> -static inline int cpg_mssr_add_clk_domain(struct device *dev,
> - const unsigned int *core_pm_clks,
> - unsigned int num_core_pm_clks)
> -{
> - return 0;
> -}
> -#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
>
>
... and here too.
(Same comment applies to patch 1/4)
Apart from that,
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
for 1/4 and 2/4.
> static const struct of_device_id cpg_mssr_match[] = {
--
Regards,
Laurent Pinchart
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] clk: renesas: mstp: Clarify cpg_mstp_{at,de}tach_dev() domain parameter
2016-03-09 19:18 [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
2016-03-09 19:18 ` [PATCH 1/4] clk: renesas: mstp: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF Geert Uytterhoeven
2016-03-09 19:18 ` [PATCH 2/4] clk: renesas: cpg-mssr: " Geert Uytterhoeven
@ 2016-03-09 19:18 ` Geert Uytterhoeven
2016-03-09 19:18 ` [PATCH 4/4] clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev() Geert Uytterhoeven
2016-04-07 15:28 ` [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
4 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-03-09 19:18 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Simon Horman, Magnus Damm, Laurent Pinchart, linux-clk,
linux-renesas-soc, Geert Uytterhoeven
Make it clear that the "domain" parameter of the cpg_mstp_attach_dev()
and cpg_mstp_detach_dev() functions is not used.
The cpg_mstp_attach_dev() and cpg_mstp_detach_dev() callbacks are not
only used by the CPG/MSTP Clock Domain driver, but also by the R-Mobile
SYSC PM Domain driver.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/clk/renesas/clk-mstp.c | 4 ++--
include/linux/clk/renesas.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 91eed7ced08d8fe6..0144d54351a6953b 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -244,7 +244,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init);
-int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev)
+int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev)
{
struct device_node *np = dev->of_node;
struct of_phandle_args clkspec;
@@ -296,7 +296,7 @@ fail_put:
return error;
}
-void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev)
+void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev)
{
if (!list_empty(&dev->power.subsys_data->clock_list))
pm_clk_destroy(dev);
diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h
index 2a3379cf13304837..095b1681daf46faf 100644
--- a/include/linux/clk/renesas.h
+++ b/include/linux/clk/renesas.h
@@ -25,7 +25,7 @@ void r8a7779_clocks_init(u32 mode);
void rcar_gen2_clocks_init(u32 mode);
void cpg_mstp_add_clk_domain(struct device_node *np);
-int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev);
-void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev);
+int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev);
+void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev);
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
2016-03-09 19:18 [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
` (2 preceding siblings ...)
2016-03-09 19:18 ` [PATCH 3/4] clk: renesas: mstp: Clarify cpg_mstp_{at,de}tach_dev() domain parameter Geert Uytterhoeven
@ 2016-03-09 19:18 ` Geert Uytterhoeven
2016-04-07 11:26 ` Geert Uytterhoeven
2016-04-07 15:28 ` [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
4 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-03-09 19:18 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Simon Horman, Magnus Damm, Laurent Pinchart, linux-clk,
linux-renesas-soc, Geert Uytterhoeven
The R-Car SYSC PM Domain driver has to power manage devices in power
areas using clocks. To reuse code and to share knowledge of clocks
suitable for power management, this is ideally done through the existing
cpg_mssr_attach_dev() and cpg_mssr_detach_dev() callbacks.
Hence these callbacks can no longer rely on their "domain" parameter
pointing to the CPG/MSSR Clock Domain. To handle this, keep a pointer to
the clock domain in a static variable. cpg_mssr_attach_dev() has to
support probe deferral, as the R-Car SYSC PM Domain may be initialized,
and devices may be added to it, before the CPG/MSSR Clock Domain is
initialized.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
The probe deferral path was tested by initializing the renesas,fcpv
driver from an arch_initcall.
---
drivers/clk/renesas/renesas-cpg-mssr.c | 18 ++++++++++++------
include/linux/clk/renesas.h | 2 ++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 7482e7f6d37fbe22..dfdeb7d9f602011b 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -15,6 +15,7 @@
#include <linux/clk.h>
#include <linux/clk-provider.h>
+#include <linux/clk/renesas.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
@@ -383,6 +384,8 @@ struct cpg_mssr_clk_domain {
unsigned int core_pm_clks[0];
};
+static struct cpg_mssr_clk_domain *cpg_mssr_clk_domain;
+
static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec,
struct cpg_mssr_clk_domain *pd)
{
@@ -406,17 +409,20 @@ static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec,
}
}
-static int cpg_mssr_attach_dev(struct generic_pm_domain *genpd,
- struct device *dev)
+int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev)
{
- struct cpg_mssr_clk_domain *pd =
- container_of(genpd, struct cpg_mssr_clk_domain, genpd);
+ struct cpg_mssr_clk_domain *pd = cpg_mssr_clk_domain;
struct device_node *np = dev->of_node;
struct of_phandle_args clkspec;
struct clk *clk;
int i = 0;
int error;
+ if (!pd) {
+ dev_dbg(dev, "CPG/MSSR clock domain not yet available\n");
+ return -EPROBE_DEFER;
+ }
+
while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
&clkspec)) {
if (cpg_mssr_is_pm_clk(&clkspec, pd))
@@ -456,8 +462,7 @@ fail_put:
return error;
}
-static void cpg_mssr_detach_dev(struct generic_pm_domain *genpd,
- struct device *dev)
+void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev)
{
if (!list_empty(&dev->power.subsys_data->clock_list))
pm_clk_destroy(dev);
@@ -486,6 +491,7 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev,
pm_genpd_init(genpd, &simple_qos_governor, false);
genpd->attach_dev = cpg_mssr_attach_dev;
genpd->detach_dev = cpg_mssr_detach_dev;
+ cpg_mssr_clk_domain = pd;
of_genpd_add_provider_simple(np, genpd);
return 0;
diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h
index 095b1681daf46faf..69ec7f5f20910d08 100644
--- a/include/linux/clk/renesas.h
+++ b/include/linux/clk/renesas.h
@@ -28,4 +28,6 @@ void cpg_mstp_add_clk_domain(struct device_node *np);
int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev);
void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev);
+int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev);
+void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev);
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/4] clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
2016-03-09 19:18 ` [PATCH 4/4] clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev() Geert Uytterhoeven
@ 2016-04-07 11:26 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-04-07 11:26 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Simon Horman, Magnus Damm,
Laurent Pinchart, linux-clk, linux-renesas-soc
On Wed, Mar 9, 2016 at 8:18 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> The R-Car SYSC PM Domain driver has to power manage devices in power
> areas using clocks. To reuse code and to share knowledge of clocks
> suitable for power management, this is ideally done through the existing
> cpg_mssr_attach_dev() and cpg_mssr_detach_dev() callbacks.
>
> Hence these callbacks can no longer rely on their "domain" parameter
> pointing to the CPG/MSSR Clock Domain. To handle this, keep a pointer to
> the clock domain in a static variable. cpg_mssr_attach_dev() has to
> support probe deferral, as the R-Car SYSC PM Domain may be initialized,
> and devices may be added to it, before the CPG/MSSR Clock Domain is
> initialized.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
I'd like to withdraw this patch, as I found a much cleaner solution.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation
2016-03-09 19:18 [PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation Geert Uytterhoeven
` (3 preceding siblings ...)
2016-03-09 19:18 ` [PATCH 4/4] clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev() Geert Uytterhoeven
@ 2016-04-07 15:28 ` Geert Uytterhoeven
4 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-04-07 15:28 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Simon Horman, Magnus Damm,
Laurent Pinchart, linux-clk, linux-renesas-soc
On Wed, Mar 9, 2016 at 8:18 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> This patch series performs some cleanups related to PM Domains on the
> Renesas clock drivers, and prepares the CPG/MSSR driver for the advent
> of R-Car SYSC PM Domains.
>
> Support for the latter will be introduced in 3 patch series:
> - "[PATCH v3 0/7] PM / Domains: Add DT bindings for the R-Car System
> Controller",
> - "[PATCH v3 00/11] soc: renesas: Add R-Car SYSC PM Domain Support",
> - "[PATCH v3 0/6] ARM/arm64: dts: rcar: Add SYSC PM domains".
>
> This patch series is against clk/clk-next with "[PATCH v2] clk: renesas:
> Rename header file renesas.h" applied.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (4):
> clk: renesas: mstp: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF
> clk: renesas: cpg-mssr: Drop check for CONFIG_PM_GENERIC_DOMAINS_OF
> clk: renesas: mstp: Clarify cpg_mstp_{at,de}tach_dev() domain
> parameter
I've queue up these three patches in clk-renesas-for-v4.7.
> clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
I've dropped this one, as it's no longer needed.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread