Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: sh: Disable PM runtime for multi-platform ARM with genpd

If the default PM Domain using PM_CLK is used for PM runtime, the real
Clock Domain cannot be registered from DT later.

Hence do not enable it when running a multi-platform kernel with genpd
support on R-Car or RZ. The CPG/MSTP Clock Domain driver will take care
of PM runtime management of the module clocks.

Now most multi-platform ARM shmobile platforms (SH-Mobile, R-Mobile,
R-Car, RZ) use DT-based PM Domains to take care of PM runtime management
of the module clocks, simplify the platform logic by replacing the
explicit SoC checks by a single check for the presence of MSTP clocks in
DT.

Backwards-compatiblity with old DTs (mainly for R-Car Gen2) is provided
by checking for the presence of a "#power-domain-cells" property in DT.

The default PM Domain is still needed for:
- backwards-compatibility with old DTs that lack PM Domain properties,
- the CONFIG_PM=n case,
- legacy (non-DT) ARM/shmobile platforms without genpd support
(r8a7778, r8a7779),
- legacy SuperH.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

authored by

Geert Uytterhoeven and committed by
Simon Horman
cbc41d0a 9b302c1a

+5 -13
+5 -13
drivers/sh/pm_runtime.c
··· 35 35 static int __init sh_pm_runtime_init(void) 36 36 { 37 37 if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) { 38 - if (!of_machine_is_compatible("renesas,r7s72100") && 39 - #ifndef CONFIG_PM_GENERIC_DOMAINS_OF 40 - !of_machine_is_compatible("renesas,r8a73a4") && 41 - !of_machine_is_compatible("renesas,r8a7740") && 42 - !of_machine_is_compatible("renesas,sh73a0") && 43 - #endif 44 - !of_machine_is_compatible("renesas,r8a7778") && 45 - !of_machine_is_compatible("renesas,r8a7779") && 46 - !of_machine_is_compatible("renesas,r8a7790") && 47 - !of_machine_is_compatible("renesas,r8a7791") && 48 - !of_machine_is_compatible("renesas,r8a7792") && 49 - !of_machine_is_compatible("renesas,r8a7793") && 50 - !of_machine_is_compatible("renesas,r8a7794")) 38 + if (!of_find_compatible_node(NULL, NULL, 39 + "renesas,cpg-mstp-clocks")) 40 + return 0; 41 + if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS_OF) && 42 + of_find_node_with_property(NULL, "#power-domain-cells")) 51 43 return 0; 52 44 } 53 45