mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
cbc41d0a76
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>
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/*
|
|
* Runtime PM support code
|
|
*
|
|
* Copyright (C) 2009-2010 Magnus Damm
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/io.h>
|
|
#include <linux/pm_runtime.h>
|
|
#include <linux/pm_domain.h>
|
|
#include <linux/pm_clock.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/sh_clk.h>
|
|
#include <linux/bitmap.h>
|
|
#include <linux/slab.h>
|
|
|
|
static struct dev_pm_domain default_pm_domain = {
|
|
.ops = {
|
|
USE_PM_CLK_RUNTIME_OPS
|
|
USE_PLATFORM_PM_SLEEP_OPS
|
|
},
|
|
};
|
|
|
|
static struct pm_clk_notifier_block platform_bus_notifier = {
|
|
.pm_domain = &default_pm_domain,
|
|
.con_ids = { NULL, },
|
|
};
|
|
|
|
static int __init sh_pm_runtime_init(void)
|
|
{
|
|
if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) {
|
|
if (!of_find_compatible_node(NULL, NULL,
|
|
"renesas,cpg-mstp-clocks"))
|
|
return 0;
|
|
if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS_OF) &&
|
|
of_find_node_with_property(NULL, "#power-domain-cells"))
|
|
return 0;
|
|
}
|
|
|
|
pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
|
|
return 0;
|
|
}
|
|
core_initcall(sh_pm_runtime_init);
|