All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] drivers: sh: compile drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI
Date: Tue, 06 May 2014 10:45:32 +0000	[thread overview]
Message-ID: <5368BD4C.1000002@codethink.co.uk> (raw)
In-Reply-To: <1398906582-29888-1-git-send-email-geert+renesas@glider.be>

On 01/05/14 02:09, Geert Uytterhoeven wrote:
> If the kernel is built to support multi-ARM configuration with shmobile
> support built in, then drivers/sh is not built. This contains the PM
> runtime code in drivers/sh/pm_runtime.c, which implicitly enables the
> module clocks for all devices, and thus is quite essential.
> Without this, the state of clocks depends on implicit reset state, or on
> the bootloader.
>
> If ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that
> bits that may conflict (drivers/sh/clk if the common clock framework is
> enabled) or are not used (drivers/sh/intc), are not built.
> Also, only enable the PM runtime code when actually running on a shmobile
> SoCs that needs it.
>
> ARCH_SHMOBILE_MULTI was added a while ago by commit
> efacfce5f8a523457e9419a25d52fe39db00b26a ("ARM: shmobile: Introduce
> ARCH_SHMOBILE_MULTI"), but drivers/sh was compiled for both
> ARCH_SHMOBILE_LEGACY and ARCH_SHMOBILE_MULTI until commit
> bf98c1eac1d4a6bcf00532e4fa41d8126cd6c187 ("ARM: Rename ARCH_SHMOBILE to
> ARCH_SHMOBILE_LEGACY").
>
> Inspired by a patch from Ben Dooks <ben.dooks@codethink.co.uk>.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is a minimal solution to fix the issue for multi-platform shmobile
> kernels in a multi-platform-friendly way.
> As it touches drivers/sh-specific code only, Simom should still be able to
> get it in v3.15, and backported to v3.14-stable.
>
> This is an RFC for several reasons:
>    1. I'm at ELC, and away from my hardware to test it properly (also on
>       non-shmobile).
>    2. Can we already reduce the list of SoCs to check for?
>       E.g. is this needed for emev2, which doesn't have MSTP clocks?

 From what I remember the EMEV2 does have hardware clock gates for
IP, just not the same way as the newer SoCs have. I have not tried
any newer kernels with this as the project I was on which used this
device is no-longer going.

> v3:
>    - Add of_machine_is_compatible() checks for multi-platform
>    - Remove Reviewed-by, Tested-by, as too much has changed,
>    - Assumed authorship, as not much is left from the original patch from
>      Ben (Ben: is that OK?),

Yes, that would fine. It looks like there is enough changes to
drop that. Thanks for sorting this out.

> -static int __init sh_pm_runtime_init(void)
> +static bool default_pm_on;
> +
> +int __init sh_pm_runtime_init(void)
>   {
> +#ifdef CONFIG_ARCH_SHMOBILE_MULTI
> +	if (!of_machine_is_compatible("renesas,emev2") &&
> +	    !of_machine_is_compatible("renesas,r7s72100") &&
> +	    !of_machine_is_compatible("renesas,r8a73a4") &&
> +	    !of_machine_is_compatible("renesas,r8a7740") &&
> +	    !of_machine_is_compatible("renesas,r8a7778") &&
> +	    !of_machine_is_compatible("renesas,r8a7779") &&
> +	    !of_machine_is_compatible("renesas,r8a7790") &&
> +	    !of_machine_is_compatible("renesas,r8a7791") &&
> +	    !of_machine_is_compatible("renesas,sh7372") &&
> +	    !of_machine_is_compatible("renesas,sh73a0"))
> +		return 0;
> +#endif

Is there a more generic compatible that could be matched on?

Could we do an if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) instead
of an #ifdef block?

> +
> +	default_pm_on = true;
>   	pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
>   	return 0;
>   }
> @@ -59,7 +76,9 @@ core_initcall(sh_pm_runtime_init);
>
>   static int __init sh_pm_runtime_late_init(void)
>   {
> -	pm_genpd_poweroff_unused();
> +	if (default_pm_on)
> +		pm_genpd_poweroff_unused();
>   	return 0;
>   }
> +
>   late_initcall(sh_pm_runtime_late_init);
>


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

  parent reply	other threads:[~2014-05-06 10:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01  1:09 [PATCH] drivers: sh: compile drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI Geert Uytterhoeven
2014-05-01  4:27 ` Simon Horman
2014-05-01  4:42 ` Geert Uytterhoeven
2014-05-01  4:58 ` Simon Horman
2014-05-03 19:29 ` Magnus Damm
2014-05-06 10:45 ` Ben Dooks [this message]
2014-05-06 21:15 ` Geert Uytterhoeven
2014-05-06 21:17 ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2014-05-13  7:42 [GIT PULL] SH Driver Updates for v3.15 Simon Horman
2014-05-13  7:42 ` [PATCH] drivers: sh: compile drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI Simon Horman
2014-05-13  7:42   ` 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=5368BD4C.1000002@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.