summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 14:14:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 14:14:29 -0400
commitb3345d7c57d70e6cb6749af25cdbe80515582e99 (patch)
tree04cce706bc7e944ad1fb257108a8ae735948f97f /drivers/cpuidle
parent44c916d58b9ef1f2c4aec2def57fa8289c716a60 (diff)
parentc2fff85e21818952aa0ee5778926beee6c03e579 (diff)
Merge tag 'soc-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform changes from Olof Johansson: "This is the bulk of new SoC enablement and other platform changes for 3.17: - Samsung S5PV210 has been converted to DT and multiplatform - Clock drivers and bindings for some of the lower-end i.MX 1/2 platforms - Kirkwood, one of the popular Marvell platforms, is folded into the mvebu platform code, removing mach-kirkwood - Hwmod data for TI AM43xx and DRA7 platforms - More additions of Renesas shmobile platform support - Removal of plat-samsung contents that can be removed with S5PV210 being multiplatform/DT-enabled and the other two old platforms being removed New platforms (most with only basic support right now): - Hisilicon X5HD2 settop box chipset is introduced - Mediatek MT6589 (mobile chipset) is introduced - Broadcom BCM7xxx settop box chipset is introduced + as usual a lot other pieces all over the platform code" * tag 'soc-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (240 commits) ARM: hisi: remove smp from machine descriptor power: reset: move hisilicon reboot code ARM: dts: Add hix5hd2-dkb dts file. ARM: debug: Rename Hi3716 to HIX5HD2 ARM: hisi: enable hix5hd2 SoC ARM: hisi: add ARCH_HISI MAINTAINERS: add entry for Broadcom ARM STB architecture ARM: brcmstb: select GISB arbiter and interrupt drivers ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs ARM: configs: enable SMP in bcm_defconfig ARM: add SMP support for Broadcom mobile SoCs Documentation: arm: misc updates to Marvell EBU SoC status Documentation: arm: add URLs to public datasheets for the Marvell Armada XP SoC ARM: mvebu: fix build without platforms selected ARM: mvebu: add cpuidle support for Armada 38x ARM: mvebu: add cpuidle support for Armada 370 cpuidle: mvebu: add Armada 38x support cpuidle: mvebu: add Armada 370 support cpuidle: mvebu: rename the driver from armada-370-xp to mvebu-v7 ARM: mvebu: export the SCU address ...
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/Kconfig.arm14
-rw-r--r--drivers/cpuidle/Makefile2
-rw-r--r--drivers/cpuidle/cpuidle-armada-370-xp.c93
-rw-r--r--drivers/cpuidle/cpuidle-big_little.c12
-rw-r--r--drivers/cpuidle/cpuidle-mvebu-v7.c150
5 files changed, 169 insertions, 102 deletions
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index a186dec8e5df..38cff69ffe06 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -1,15 +1,9 @@
1# 1#
2# ARM CPU Idle drivers 2# ARM CPU Idle drivers
3# 3#
4config ARM_ARMADA_370_XP_CPUIDLE
5 bool "CPU Idle Driver for Armada 370/XP family processors"
6 depends on ARCH_MVEBU
7 help
8 Select this to enable cpuidle on Armada 370/XP processors.
9
10config ARM_BIG_LITTLE_CPUIDLE 4config ARM_BIG_LITTLE_CPUIDLE
11 bool "Support for ARM big.LITTLE processors" 5 bool "Support for ARM big.LITTLE processors"
12 depends on ARCH_VEXPRESS_TC2_PM 6 depends on ARCH_VEXPRESS_TC2_PM || ARCH_EXYNOS
13 depends on MCPM 7 depends on MCPM
14 select ARM_CPU_SUSPEND 8 select ARM_CPU_SUSPEND
15 select CPU_IDLE_MULTIPLE_DRIVERS 9 select CPU_IDLE_MULTIPLE_DRIVERS
@@ -62,3 +56,9 @@ config ARM_EXYNOS_CPUIDLE
62 depends on ARCH_EXYNOS 56 depends on ARCH_EXYNOS
63 help 57 help
64 Select this to enable cpuidle for Exynos processors 58 Select this to enable cpuidle for Exynos processors
59
60config ARM_MVEBU_V7_CPUIDLE
61 bool "CPU Idle Driver for mvebu v7 family processors"
62 depends on ARCH_MVEBU
63 help
64 Select this to enable cpuidle on Armada 370, 38x and XP processors.
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index d8bb1ff72561..11edb31c55e9 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -7,7 +7,7 @@ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
7 7
8################################################################################## 8##################################################################################
9# ARM SoC drivers 9# ARM SoC drivers
10obj-$(CONFIG_ARM_ARMADA_370_XP_CPUIDLE) += cpuidle-armada-370-xp.o 10obj-$(CONFIG_ARM_MVEBU_V7_CPUIDLE) += cpuidle-mvebu-v7.o
11obj-$(CONFIG_ARM_BIG_LITTLE_CPUIDLE) += cpuidle-big_little.o 11obj-$(CONFIG_ARM_BIG_LITTLE_CPUIDLE) += cpuidle-big_little.o
12obj-$(CONFIG_ARM_CLPS711X_CPUIDLE) += cpuidle-clps711x.o 12obj-$(CONFIG_ARM_CLPS711X_CPUIDLE) += cpuidle-clps711x.o
13obj-$(CONFIG_ARM_HIGHBANK_CPUIDLE) += cpuidle-calxeda.o 13obj-$(CONFIG_ARM_HIGHBANK_CPUIDLE) += cpuidle-calxeda.o
diff --git a/drivers/cpuidle/cpuidle-armada-370-xp.c b/drivers/cpuidle/cpuidle-armada-370-xp.c
deleted file mode 100644
index a5fba0287bfb..000000000000
--- a/drivers/cpuidle/cpuidle-armada-370-xp.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Marvell Armada 370 and Armada XP SoC cpuidle driver
3 *
4 * Copyright (C) 2014 Marvell
5 *
6 * Nadav Haklai <nadavh@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 *
13 * Maintainer: Gregory CLEMENT <gregory.clement@free-electrons.com>
14 */
15
16#include <linux/cpu_pm.h>
17#include <linux/cpuidle.h>
18#include <linux/module.h>
19#include <linux/of.h>
20#include <linux/suspend.h>
21#include <linux/platform_device.h>
22#include <asm/cpuidle.h>
23
24#define ARMADA_370_XP_MAX_STATES 3
25#define ARMADA_370_XP_FLAG_DEEP_IDLE 0x10000
26
27static int (*armada_370_xp_cpu_suspend)(int);
28
29static int armada_370_xp_enter_idle(struct cpuidle_device *dev,
30 struct cpuidle_driver *drv,
31 int index)
32{
33 int ret;
34 bool deepidle = false;
35 cpu_pm_enter();
36
37 if (drv->states[index].flags & ARMADA_370_XP_FLAG_DEEP_IDLE)
38 deepidle = true;
39
40 ret = armada_370_xp_cpu_suspend(deepidle);
41 if (ret)
42 return ret;
43
44 cpu_pm_exit();
45
46 return index;
47}
48
49static struct cpuidle_driver armada_370_xp_idle_driver = {
50 .name = "armada_370_xp_idle",
51 .states[0] = ARM_CPUIDLE_WFI_STATE,
52 .states[1] = {
53 .enter = armada_370_xp_enter_idle,
54 .exit_latency = 10,
55 .power_usage = 50,
56 .target_residency = 100,
57 .flags = CPUIDLE_FLAG_TIME_VALID,
58 .name = "Idle",
59 .desc = "CPU power down",
60 },
61 .states[2] = {
62 .enter = armada_370_xp_enter_idle,
63 .exit_latency = 100,
64 .power_usage = 5,
65 .target_residency = 1000,
66 .flags = CPUIDLE_FLAG_TIME_VALID |
67 ARMADA_370_XP_FLAG_DEEP_IDLE,
68 .name = "Deep idle",
69 .desc = "CPU and L2 Fabric power down",
70 },
71 .state_count = ARMADA_370_XP_MAX_STATES,
72};
73
74static int armada_370_xp_cpuidle_probe(struct platform_device *pdev)
75{
76
77 armada_370_xp_cpu_suspend = (void *)(pdev->dev.platform_data);
78 return cpuidle_register(&armada_370_xp_idle_driver, NULL);
79}
80
81static struct platform_driver armada_370_xp_cpuidle_plat_driver = {
82 .driver = {
83 .name = "cpuidle-armada-370-xp",
84 .owner = THIS_MODULE,
85 },
86 .probe = armada_370_xp_cpuidle_probe,
87};
88
89module_platform_driver(armada_370_xp_cpuidle_plat_driver);
90
91MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
92MODULE_DESCRIPTION("Armada 370/XP cpu idle driver");
93MODULE_LICENSE("GPL");
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
index b45fc6249041..344d79fa3407 100644
--- a/drivers/cpuidle/cpuidle-big_little.c
+++ b/drivers/cpuidle/cpuidle-big_little.c
@@ -163,14 +163,24 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id)
163 return 0; 163 return 0;
164} 164}
165 165
166static const struct of_device_id compatible_machine_match[] = {
167 { .compatible = "arm,vexpress,v2p-ca15_a7" },
168 { .compatible = "samsung,exynos5420" },
169 {},
170};
171
166static int __init bl_idle_init(void) 172static int __init bl_idle_init(void)
167{ 173{
168 int ret; 174 int ret;
175 struct device_node *root = of_find_node_by_path("/");
176
177 if (!root)
178 return -ENODEV;
169 179
170 /* 180 /*
171 * Initialize the driver just for a compliant set of machines 181 * Initialize the driver just for a compliant set of machines
172 */ 182 */
173 if (!of_machine_is_compatible("arm,vexpress,v2p-ca15_a7")) 183 if (!of_match_node(compatible_machine_match, root))
174 return -ENODEV; 184 return -ENODEV;
175 /* 185 /*
176 * For now the differentiation between little and big cores 186 * For now the differentiation between little and big cores
diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c
new file mode 100644
index 000000000000..45371bb16214
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-mvebu-v7.c
@@ -0,0 +1,150 @@
1/*
2 * Marvell Armada 370, 38x and XP SoC cpuidle driver
3 *
4 * Copyright (C) 2014 Marvell
5 *
6 * Nadav Haklai <nadavh@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 *
13 * Maintainer: Gregory CLEMENT <gregory.clement@free-electrons.com>
14 */
15
16#include <linux/cpu_pm.h>
17#include <linux/cpuidle.h>
18#include <linux/module.h>
19#include <linux/of.h>
20#include <linux/suspend.h>
21#include <linux/platform_device.h>
22#include <asm/cpuidle.h>
23
24#define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
25
26static int (*mvebu_v7_cpu_suspend)(int);
27
28static int mvebu_v7_enter_idle(struct cpuidle_device *dev,
29 struct cpuidle_driver *drv,
30 int index)
31{
32 int ret;
33 bool deepidle = false;
34 cpu_pm_enter();
35
36 if (drv->states[index].flags & MVEBU_V7_FLAG_DEEP_IDLE)
37 deepidle = true;
38
39 ret = mvebu_v7_cpu_suspend(deepidle);
40 if (ret)
41 return ret;
42
43 cpu_pm_exit();
44
45 return index;
46}
47
48static struct cpuidle_driver armadaxp_idle_driver = {
49 .name = "armada_xp_idle",
50 .states[0] = ARM_CPUIDLE_WFI_STATE,
51 .states[1] = {
52 .enter = mvebu_v7_enter_idle,
53 .exit_latency = 10,
54 .power_usage = 50,
55 .target_residency = 100,
56 .flags = CPUIDLE_FLAG_TIME_VALID,
57 .name = "MV CPU IDLE",
58 .desc = "CPU power down",
59 },
60 .states[2] = {
61 .enter = mvebu_v7_enter_idle,
62 .exit_latency = 100,
63 .power_usage = 5,
64 .target_residency = 1000,
65 .flags = CPUIDLE_FLAG_TIME_VALID |
66 MVEBU_V7_FLAG_DEEP_IDLE,
67 .name = "MV CPU DEEP IDLE",
68 .desc = "CPU and L2 Fabric power down",
69 },
70 .state_count = 3,
71};
72
73static struct cpuidle_driver armada370_idle_driver = {
74 .name = "armada_370_idle",
75 .states[0] = ARM_CPUIDLE_WFI_STATE,
76 .states[1] = {
77 .enter = mvebu_v7_enter_idle,
78 .exit_latency = 100,
79 .power_usage = 5,
80 .target_residency = 1000,
81 .flags = (CPUIDLE_FLAG_TIME_VALID |
82 MVEBU_V7_FLAG_DEEP_IDLE),
83 .name = "Deep Idle",
84 .desc = "CPU and L2 Fabric power down",
85 },
86 .state_count = 2,
87};
88
89static struct cpuidle_driver armada38x_idle_driver = {
90 .name = "armada_38x_idle",
91 .states[0] = ARM_CPUIDLE_WFI_STATE,
92 .states[1] = {
93 .enter = mvebu_v7_enter_idle,
94 .exit_latency = 10,
95 .power_usage = 5,
96 .target_residency = 100,
97 .flags = CPUIDLE_FLAG_TIME_VALID,
98 .name = "Idle",
99 .desc = "CPU and SCU power down",
100 },
101 .state_count = 2,
102};
103
104static int mvebu_v7_cpuidle_probe(struct platform_device *pdev)
105{
106 mvebu_v7_cpu_suspend = pdev->dev.platform_data;
107
108 if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-xp"))
109 return cpuidle_register(&armadaxp_idle_driver, NULL);
110 else if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-370"))
111 return cpuidle_register(&armada370_idle_driver, NULL);
112 else if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-38x"))
113 return cpuidle_register(&armada38x_idle_driver, NULL);
114 else
115 return -EINVAL;
116}
117
118static struct platform_driver armadaxp_cpuidle_plat_driver = {
119 .driver = {
120 .name = "cpuidle-armada-xp",
121 .owner = THIS_MODULE,
122 },
123 .probe = mvebu_v7_cpuidle_probe,
124};
125
126module_platform_driver(armadaxp_cpuidle_plat_driver);
127
128static struct platform_driver armada370_cpuidle_plat_driver = {
129 .driver = {
130 .name = "cpuidle-armada-370",
131 .owner = THIS_MODULE,
132 },
133 .probe = mvebu_v7_cpuidle_probe,
134};
135
136module_platform_driver(armada370_cpuidle_plat_driver);
137
138static struct platform_driver armada38x_cpuidle_plat_driver = {
139 .driver = {
140 .name = "cpuidle-armada-38x",
141 .owner = THIS_MODULE,
142 },
143 .probe = mvebu_v7_cpuidle_probe,
144};
145
146module_platform_driver(armada38x_cpuidle_plat_driver);
147
148MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
149MODULE_DESCRIPTION("Marvell EBU v7 cpuidle driver");
150MODULE_LICENSE("GPL");