From: Simon Horman <horms@verge.net.au>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] [RFC] ARM: shmobile: Enable shmobile Runtime PM from MSTP clock driver
Date: Mon, 28 Apr 2014 00:10:59 +0000 [thread overview]
Message-ID: <20140428001058.GM32087@verge.net.au> (raw)
In-Reply-To: <1398445124-16828-1-git-send-email-geert+renesas@glider.be>
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
>
next prev parent reply other threads:[~2014-04-28 0:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2014-04-28 5:45 ` Geert Uytterhoeven
2014-04-28 6:55 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140428001058.GM32087@verge.net.au \
--to=horms@verge.net.au \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox