diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index 9a9c045dbf6a..0d7034e20d8d 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt @@ -190,6 +190,7 @@ nodes to be present and contain the properties described below. "allwinner,sun6i-a31" "allwinner,sun8i-a23" "arm,psci" + "psci" "brcm,brahma-b15" "marvell,armada-375-smp" "marvell,armada-380-smp" diff --git a/drivers/cpuidle/lpm-levels.c b/drivers/cpuidle/lpm-levels.c index 4224b594f1b8..b69e59eeeae1 100644 --- a/drivers/cpuidle/lpm-levels.c +++ b/drivers/cpuidle/lpm-levels.c @@ -363,6 +363,24 @@ static int lpm_cpu_callback(struct notifier_block *cpu_nb, return NOTIFY_OK; } +#ifdef CONFIG_ARM_PSCI + +static int __init set_cpuidle_ops(void) +{ + int ret = 0, cpu; + + for_each_possible_cpu(cpu) { + ret = arm_cpuidle_init(cpu); + if (ret) + goto exit; + } + +exit: + return ret; +} + +#endif + static enum hrtimer_restart lpm_hrtimer_cb(struct hrtimer *h) { return HRTIMER_NORESTART; @@ -1954,6 +1972,14 @@ static int __init lpm_levels_module_init(void) goto fail; } +#ifdef CONFIG_ARM_PSCI + rc = set_cpuidle_ops(); + if (rc) { + pr_err("%s(): Failed to set cpuidle ops\n", __func__); + goto fail; + } +#endif + fail: return rc; } diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index af0060d6a22a..d652f3b53635 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -230,6 +230,13 @@ static int __init psci_features(u32 psci_func_id) #ifdef CONFIG_CPU_IDLE static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); +#ifdef CONFIG_ARM_PSCI +static int psci_cpu_init(struct device_node *cpu_node, int cpu) +{ + return 0; +} +#endif + static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { int i, ret, count = 0; @@ -333,10 +340,14 @@ int psci_cpu_suspend_enter(unsigned long state_id) #ifdef CONFIG_ARM static struct cpuidle_ops psci_cpuidle_ops __initdata = { .suspend = psci_cpu_suspend_enter, +#ifdef CONFIG_ARM_PSCI + .init = psci_cpu_init, +#else .init = psci_dt_cpu_init_idle, +#endif }; -CPUIDLE_METHOD_OF_DECLARE(psci, "arm,psci", &psci_cpuidle_ops); +CPUIDLE_METHOD_OF_DECLARE(psci, "psci", &psci_cpuidle_ops); #endif #endif