* [Patch v7 0/6] add cpuidle support for Exynos5420
@ 2014-06-16 10:26 Chander Kashyap
2014-06-16 10:26 ` [Patch v7 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap
Exynos5420 is a big-little Soc from Samsung. It has 4 A15 and 4 A7 cores.
This patchset adds cpuidle support for Exynos5420 SoC based on
generic big.little cpuidle driver.
Tested on SMDK5420.
Rebased on 3.16-rc1
Changelog is in respective patches.
Chander Kashyap (5):
driver: cpuidle-big-little: add of_device_id structure
arm: exynos: add generic function to calculate cpu number
cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little
driver
driver: cpuidle: cpuidle-big-little: init driver for Exynos5420
exynos: cpuidle: do not allow cpuidle registration for Exynos5420
mcpm: exynos: populate suspend and powered_up callbacks
arch/arm/mach-exynos/exynos.c | 4 +++-
arch/arm/mach-exynos/mcpm-exynos.c | 36 ++++++++++++++++++++++++++++++++++
arch/arm/mach-exynos/regs-pmu.h | 9 +++++++++
drivers/cpuidle/Kconfig.arm | 2 +-
drivers/cpuidle/cpuidle-big_little.c | 12 +++++++++++-
5 files changed, 60 insertions(+), 3 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Patch v7 1/6] driver: cpuidle-big-little: add of_device_id structure
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-06-16 10:26 ` [Patch v7 2/6] arm: exynos: add generic function to calculate cpu number Chander Kashyap
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
This driver will be used by many big.Little Soc's. As of now it does
string matching of hardcoded compatible string to init the driver. This
comparison list will keep on growing with addition of new SoC's.
Hence add of_device_id structure to collect the compatible strings of
SoC's using this driver.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/cpuidle/cpuidle-big_little.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
index b45fc62..4cd02bd 100644
--- a/drivers/cpuidle/cpuidle-big_little.c
+++ b/drivers/cpuidle/cpuidle-big_little.c
@@ -163,14 +163,23 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id)
return 0;
}
+static const struct of_device_id compatible_machine_match[] = {
+ { .compatible = "arm,vexpress,v2p-ca15_a7" },
+ {},
+};
+
static int __init bl_idle_init(void)
{
int ret;
+ struct device_node *root = of_find_node_by_path("/");
+
+ if (!root)
+ return -ENODEV;
/*
* Initialize the driver just for a compliant set of machines
*/
- if (!of_machine_is_compatible("arm,vexpress,v2p-ca15_a7"))
+ if (!of_match_node(compatible_machine_match, root))
return -ENODEV;
/*
* For now the differentiation between little and big cores
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch v7 2/6] arm: exynos: add generic function to calculate cpu number
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
2014-06-16 10:26 ` [Patch v7 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-06-16 10:26 ` [Patch v7 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver Chander Kashyap
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
The address of cpu power registers in pmu is based on cpu number
offsets. This function calculate the same. This is essentially
required in case of multi-cluster SoC's e.g Exynos5420.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
---
arch/arm/mach-exynos/regs-pmu.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 1d13b08..aff23bd 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -323,4 +323,13 @@
#define EXYNOS5420_SWRESET_KFC_SEL 0x3
+#include <asm/cputype.h>
+#define MAX_CPUS_IN_CLUSTER 4
+
+static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
+{
+ return ((MPIDR_AFFINITY_LEVEL(mpidr, 1) * MAX_CPUS_IN_CLUSTER)
+ + MPIDR_AFFINITY_LEVEL(mpidr, 0));
+}
+
#endif /* __ASM_ARCH_REGS_PMU_H */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch v7 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
2014-06-16 10:26 ` [Patch v7 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
2014-06-16 10:26 ` [Patch v7 2/6] arm: exynos: add generic function to calculate cpu number Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-06-16 10:26 ` [Patch v7 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 Chander Kashyap
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
Add support to select generic big-little cpuidle driver for Samsung Exynos
series SoC's. This is required for Exynos big-llittle SoC's eg, Exynos5420.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
Changes in v4:
1. Typo fixed from SOC_EXYNOS5420 to ARCH_EXYNOS
2. Commit message updated
Changes in v3: None
Changes in v2:
1. Changed config macro from SOC_EXYNOS5420 to ARCH_EXYNOS
drivers/cpuidle/Kconfig.arm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index b6d69e8..2f6b33e 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -9,7 +9,7 @@ config ARM_ARMADA_370_XP_CPUIDLE
config ARM_BIG_LITTLE_CPUIDLE
bool "Support for ARM big.LITTLE processors"
- depends on ARCH_VEXPRESS_TC2_PM
+ depends on ARCH_VEXPRESS_TC2_PM || ARCH_EXYNOS
select ARM_CPU_SUSPEND
select CPU_IDLE_MULTIPLE_DRIVERS
help
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch v7 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
` (2 preceding siblings ...)
2014-06-16 10:26 ` [Patch v7 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-06-16 10:26 ` [Patch v7 5/6] exynos: cpuidle: do not allow cpuidle registration " Chander Kashyap
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
Add "samsung,exynos5420" compatible string to initialize generic
big-little cpuidle driver for Exynos5420.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
Changes in v5: None
Changes in v4: None
Changes in v3:
1. Add compatible string to of_device_id table insted comparing directoly
Changes in v2: none
drivers/cpuidle/cpuidle-big_little.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
index 4cd02bd..344d79fa 100644
--- a/drivers/cpuidle/cpuidle-big_little.c
+++ b/drivers/cpuidle/cpuidle-big_little.c
@@ -165,6 +165,7 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id)
static const struct of_device_id compatible_machine_match[] = {
{ .compatible = "arm,vexpress,v2p-ca15_a7" },
+ { .compatible = "samsung,exynos5420" },
{},
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch v7 5/6] exynos: cpuidle: do not allow cpuidle registration for Exynos5420
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
` (3 preceding siblings ...)
2014-06-16 10:26 ` [Patch v7 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-06-16 10:26 ` [Patch v7 6/6] mcpm: exynos: populate suspend and powered_up callbacks Chander Kashyap
2014-07-01 11:52 ` [Patch v7 0/6] add cpuidle support for Exynos5420 Kukjin Kim
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
Exynos5420 is big.Little Soc. It uses cpuidle-big-litle generic cpuidle driver.
Hence do not allow exynos cpuidle driver registration for Exynos5420.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
Changes in v6:
1. Move cpuidle registration check to exynos.c from cpuidle.c and
use "samsung,exynos5420" compatible string to avvoid registration
arch/arm/mach-exynos/exynos.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 90aab4d..f4c08d6 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -271,7 +271,9 @@ static void __init exynos_dt_machine_init(void)
}
}
- exynos_cpuidle_init();
+ if (!of_machine_is_compatible("samsung,exynos5420"))
+ exynos_cpuidle_init();
+
exynos_cpufreq_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch v7 6/6] mcpm: exynos: populate suspend and powered_up callbacks
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
` (4 preceding siblings ...)
2014-06-16 10:26 ` [Patch v7 5/6] exynos: cpuidle: do not allow cpuidle registration " Chander Kashyap
@ 2014-06-16 10:26 ` Chander Kashyap
2014-07-01 11:52 ` [Patch v7 0/6] add cpuidle support for Exynos5420 Kukjin Kim
6 siblings, 0 replies; 8+ messages in thread
From: Chander Kashyap @ 2014-06-16 10:26 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-samsung-soc
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
kgene.kim, tomasz.figa, Chander Kashyap, Chander Kashyap
From: Chander Kashyap <chander.kashyap@linaro.org>
In order to support cpuidle through mcpm, suspend and powered-up
callbacks are required in mcpm platform code.
Hence populate the same callbacks.
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
---
Changes in v6: None
Changes in v5:
1. Add comment to address cache access while c-bit is cleared in SCLTR
2. Make exynos_powered_up static
Changes in v4: None
Changes in v3:
1. Removed coherency enablement after suspend failure.
2. Use generic function to poweron cpu.
changes in v2:
1. Fixed typo: enynos_pmu_cpunr to exynos_pmu_cpunr
arch/arm/mach-exynos/mcpm-exynos.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 0498d0b..fc47e68 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -258,10 +258,46 @@ static int exynos_wait_for_powerdown(unsigned int cpu, unsigned int cluster)
return -ETIMEDOUT; /* timeout */
}
+static void exynos_powered_up(void)
+{
+ unsigned int mpidr, cpu, cluster;
+
+ mpidr = read_cpuid_mpidr();
+ cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+ cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+
+ arch_spin_lock(&exynos_mcpm_lock);
+ if (cpu_use_count[cpu][cluster] == 0)
+ cpu_use_count[cpu][cluster] = 1;
+ arch_spin_unlock(&exynos_mcpm_lock);
+}
+
+static void exynos_suspend(u64 residency)
+{
+ unsigned int mpidr, cpunr;
+
+ exynos_power_down();
+
+ /*
+ * Execution reaches here only if cpu did not power down.
+ * Hence roll back the changes done in exynos_power_down function.
+ *
+ * CAUTION: "This function requires the stack data to be visible through
+ * power down and can only be executed on processors like A15 and A7
+ * that hit the cache with the C bit clear in the SCTLR register."
+ */
+ mpidr = read_cpuid_mpidr();
+ cpunr = exynos_pmu_cpunr(mpidr);
+
+ exynos_cpu_power_up(cpunr);
+}
+
static const struct mcpm_platform_ops exynos_power_ops = {
.power_up = exynos_power_up,
.power_down = exynos_power_down,
.wait_for_powerdown = exynos_wait_for_powerdown,
+ .suspend = exynos_suspend,
+ .powered_up = exynos_powered_up,
};
static void __init exynos_mcpm_usage_count_init(void)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [Patch v7 0/6] add cpuidle support for Exynos5420
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
` (5 preceding siblings ...)
2014-06-16 10:26 ` [Patch v7 6/6] mcpm: exynos: populate suspend and powered_up callbacks Chander Kashyap
@ 2014-07-01 11:52 ` Kukjin Kim
6 siblings, 0 replies; 8+ messages in thread
From: Kukjin Kim @ 2014-07-01 11:52 UTC (permalink / raw)
To: 'Chander Kashyap', linux-pm, linux-kernel,
linux-samsung-soc, nicolas.pitre
Cc: linux-arm-kernel, daniel.lezcano, lorenzo.pieralisi, rjw,
tomasz.figa
Chander Kashyap wrote:
>
> Exynos5420 is a big-little Soc from Samsung. It has 4 A15 and 4 A7 cores.
>
> This patchset adds cpuidle support for Exynos5420 SoC based on
> generic big.little cpuidle driver.
>
> Tested on SMDK5420.
> Rebased on 3.16-rc1
>
> Changelog is in respective patches.
> Chander Kashyap (5):
> driver: cpuidle-big-little: add of_device_id structure
> arm: exynos: add generic function to calculate cpu number
> cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little
> driver
> driver: cpuidle: cpuidle-big-little: init driver for Exynos5420
> exynos: cpuidle: do not allow cpuidle registration for Exynos5420
> mcpm: exynos: populate suspend and powered_up callbacks
>
> arch/arm/mach-exynos/exynos.c | 4 +++-
> arch/arm/mach-exynos/mcpm-exynos.c | 36 ++++++++++++++++++++++++++++++++++
> arch/arm/mach-exynos/regs-pmu.h | 9 +++++++++
> drivers/cpuidle/Kconfig.arm | 2 +-
> drivers/cpuidle/cpuidle-big_little.c | 12 +++++++++++-
> 5 files changed, 60 insertions(+), 3 deletions(-)
>
+ Nicolas
Hi,
This series looks good to me and I asked Chander to test this series with
Nico's mcpm patches on smdk5420 and he said it works fine. So I will apply
this into samsung tree if Nicolas has no objection on 6/6.
BTW, one more, there are duplicated sign-off from Chander with different
e-mail address, I'm not sure it should be fine or not because I didn't see
same thing before.
Thanks,
Kukjin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-07-01 11:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 10:26 [Patch v7 0/6] add cpuidle support for Exynos5420 Chander Kashyap
2014-06-16 10:26 ` [Patch v7 1/6] driver: cpuidle-big-little: add of_device_id structure Chander Kashyap
2014-06-16 10:26 ` [Patch v7 2/6] arm: exynos: add generic function to calculate cpu number Chander Kashyap
2014-06-16 10:26 ` [Patch v7 3/6] cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little driver Chander Kashyap
2014-06-16 10:26 ` [Patch v7 4/6] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 Chander Kashyap
2014-06-16 10:26 ` [Patch v7 5/6] exynos: cpuidle: do not allow cpuidle registration " Chander Kashyap
2014-06-16 10:26 ` [Patch v7 6/6] mcpm: exynos: populate suspend and powered_up callbacks Chander Kashyap
2014-07-01 11:52 ` [Patch v7 0/6] add cpuidle support for Exynos5420 Kukjin Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox