* [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver
@ 2014-04-25 16:58 Geert Uytterhoeven
2014-04-28 0:10 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2014-04-25 16:58 UTC (permalink / raw)
To: linux-sh
On shmobile multi-platform using the Common Clock Framework, enable
shmobile Runtime PM from the MSTP clock driver, to make sure the bus clocks
are enabled for all devices.
On ARCH_SHMOBILE_LEGACY, this is done unconditionally, from the shmobile
Runtime PM code itself.
On ARCH_SHMOBILE_MULTI, this was missing, leading to disabled clocks,
depending on implicit reset state or on the bootloader.
The external declaration of sh_pm_runtime_enable() in clk-mstp.c is
needed because arch/arm/mach-shmobile/include/mach/common.h can't be
included from driver code.
More calls to sh_pm_runtime_enable() will have to be added to other gate
clock drivers, when the corresponding SoC platform code is converted to
multi-platform and CCF.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This applies on top of patches 4-7 (1-3 have been applied by Simon) of
series "[PATCH v2 00/17] ARM: shmobile: Enable drivers/sh/pm_runtime.c on
multi-platform]".
drivers/clk/shmobile/clk-mstp.c | 3 +++
drivers/sh/pm_runtime.c | 20 ++++++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index 2e3c08fff173..da2e6dcf8fed 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -161,6 +161,9 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
struct mstp_clock_group *group;
struct clk **clks;
unsigned int i;
+ extern void sh_pm_runtime_enable(void);
+
+ sh_pm_runtime_enable();
group = kzalloc(sizeof(*group), GFP_KERNEL);
clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index 3ec047ac1ff4..59d8b5fd558e 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -75,20 +75,24 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
.con_ids = { NULL, },
};
-static bool default_pm_on;
+#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
+bool default_pm_on = true;
+#else
+bool default_pm_on;
+#endif
-int __init sh_pm_runtime_init(void)
+void __init sh_pm_runtime_enable(void)
{
- if (default_pm_on)
- return 0;
-
default_pm_on = true;
- pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
+}
+
+static int __init sh_pm_runtime_init(void)
+{
+ if (default_pm_on)
+ pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
return 0;
}
-#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
core_initcall(sh_pm_runtime_init);
-#endif
static int __init sh_pm_runtime_late_init(void)
{
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver
2014-04-25 16:58 [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver Geert Uytterhoeven
@ 2014-04-28 0:10 ` Simon Horman
2014-04-28 5:45 ` Geert Uytterhoeven
2014-04-28 6:55 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2014-04-28 0:10 UTC (permalink / raw)
To: linux-sh
On Fri, Apr 25, 2014 at 06:58:44PM +0200, Geert Uytterhoeven wrote:
> On shmobile multi-platform using the Common Clock Framework, enable
> shmobile Runtime PM from the MSTP clock driver, to make sure the bus clocks
> are enabled for all devices.
>
> On ARCH_SHMOBILE_LEGACY, this is done unconditionally, from the shmobile
> Runtime PM code itself.
> On ARCH_SHMOBILE_MULTI, this was missing, leading to disabled clocks,
> depending on implicit reset state or on the bootloader.
>
> The external declaration of sh_pm_runtime_enable() in clk-mstp.c is
> needed because arch/arm/mach-shmobile/include/mach/common.h can't be
> included from driver code.
>
> More calls to sh_pm_runtime_enable() will have to be added to other gate
> clock drivers, when the corresponding SoC platform code is converted to
> multi-platform and CCF.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This applies on top of patches 4-7 (1-3 have been applied by Simon) of
> series "[PATCH v2 00/17] ARM: shmobile: Enable drivers/sh/pm_runtime.c on
> multi-platform]".
>
> drivers/clk/shmobile/clk-mstp.c | 3 +++
> drivers/sh/pm_runtime.c | 20 ++++++++++++--------
> 2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2e3c08fff173..da2e6dcf8fed 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -161,6 +161,9 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
> struct mstp_clock_group *group;
> struct clk **clks;
> unsigned int i;
> + extern void sh_pm_runtime_enable(void);
> +
> + sh_pm_runtime_enable();
>
> group = kzalloc(sizeof(*group), GFP_KERNEL);
> clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
> diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
> index 3ec047ac1ff4..59d8b5fd558e 100644
> --- a/drivers/sh/pm_runtime.c
> +++ b/drivers/sh/pm_runtime.c
> @@ -75,20 +75,24 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
> .con_ids = { NULL, },
> };
>
> -static bool default_pm_on;
> +#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
> +bool default_pm_on = true;
> +#else
> +bool default_pm_on;
> +#endif
I wonder if there is some way we can get the compiler
to optimise out code in the case of default_pm_on = false,
perhaps by using IS_ENABLED() in conjunction with a Kconfig variable.
> -int __init sh_pm_runtime_init(void)
> +void __init sh_pm_runtime_enable(void)
> {
> - if (default_pm_on)
> - return 0;
> -
> default_pm_on = true;
> - pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
> +}
> +
> +static int __init sh_pm_runtime_init(void)
> +{
> + if (default_pm_on)
> + pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
> return 0;
> }
> -#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
> core_initcall(sh_pm_runtime_init);
> -#endif
>
> static int __init sh_pm_runtime_late_init(void)
> {
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver
2014-04-25 16:58 [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver Geert Uytterhoeven
2014-04-28 0:10 ` Simon Horman
@ 2014-04-28 5:45 ` Geert Uytterhoeven
2014-04-28 6:55 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2014-04-28 5:45 UTC (permalink / raw)
To: linux-sh
Hi Simon,
On Mon, Apr 28, 2014 at 2:10 AM, Simon Horman <horms@verge.net.au> wrote:
>> --- a/drivers/sh/pm_runtime.c
>> +++ b/drivers/sh/pm_runtime.c
>> @@ -75,20 +75,24 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
>> .con_ids = { NULL, },
>> };
>>
>> -static bool default_pm_on;
>> +#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
>> +bool default_pm_on = true;
>> +#else
>> +bool default_pm_on;
>> +#endif
>
> I wonder if there is some way we can get the compiler
> to optimise out code in the case of default_pm_on = false,
> perhaps by using IS_ENABLED() in conjunction with a Kconfig variable.
What's the use case of that?
This code is compiled only if SUPERH || ARCH_SHMOBILE_LEGACY ||
ARCH_SHMOBILE_MULTIPLATORM.
If should always be used when running on shmobile.
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] 4+ messages in thread
* Re: [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver
2014-04-25 16:58 [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver Geert Uytterhoeven
2014-04-28 0:10 ` Simon Horman
2014-04-28 5:45 ` Geert Uytterhoeven
@ 2014-04-28 6:55 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2014-04-28 6:55 UTC (permalink / raw)
To: linux-sh
On Mon, Apr 28, 2014 at 07:45:38AM +0200, Geert Uytterhoeven wrote:
> Hi Simon,
>
> On Mon, Apr 28, 2014 at 2:10 AM, Simon Horman <horms@verge.net.au> wrote:
> >> --- a/drivers/sh/pm_runtime.c
> >> +++ b/drivers/sh/pm_runtime.c
> >> @@ -75,20 +75,24 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
> >> .con_ids = { NULL, },
> >> };
> >>
> >> -static bool default_pm_on;
> >> +#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE_LEGACY)
> >> +bool default_pm_on = true;
> >> +#else
> >> +bool default_pm_on;
> >> +#endif
> >
> > I wonder if there is some way we can get the compiler
> > to optimise out code in the case of default_pm_on = false,
> > perhaps by using IS_ENABLED() in conjunction with a Kconfig variable.
>
> What's the use case of that?
>
> This code is compiled only if SUPERH || ARCH_SHMOBILE_LEGACY ||
> ARCH_SHMOBILE_MULTIPLATORM.
> If should always be used when running on shmobile.
Sorry, I missed that point.
Please ignore my previous comment.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-28 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 16:58 [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver Geert Uytterhoeven
2014-04-28 0:10 ` Simon Horman
2014-04-28 5:45 ` Geert Uytterhoeven
2014-04-28 6:55 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox