aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2013-01-09 07:22:15 -0500
committerJason Cooper <jason@lakedaemon.net>2013-01-31 12:01:37 -0500
commit9cfc94eb0f4843af5d1141a37d7b7ca5d3b27220 (patch)
tree10a852a3b4717423a0186ba0d47f0e85b39bbc13 /arch/arm/mach-kirkwood
parenta1671da560df1f6bd20d8c6934d1cfa2aacc4f32 (diff)
cpuidle: kirkwood: Move out of mach directory
Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and into drivers/cpuidle. Convert the driver into a platform driver. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c2
-rw-r--r--arch/arm/mach-kirkwood/common.c23
-rw-r--r--arch/arm/mach-kirkwood/common.h1
-rw-r--r--arch/arm/mach-kirkwood/cpuidle.c73
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h3
6 files changed, 28 insertions, 75 deletions
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 8d2e5a96247c..d6653095a1eb 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
20obj-$(CONFIG_MACH_T5325) += t5325-setup.o 20obj-$(CONFIG_MACH_T5325) += t5325-setup.o
21 21
22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 23obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o 24obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index de4fd2bb1e27..f964cdc44b1a 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -98,6 +98,8 @@ static void __init kirkwood_dt_init(void)
98 /* Setup root of clk tree */ 98 /* Setup root of clk tree */
99 kirkwood_of_clk_init(); 99 kirkwood_of_clk_init();
100 100
101 kirkwood_cpuidle_init();
102
101#ifdef CONFIG_KEXEC 103#ifdef CONFIG_KEXEC
102 kexec_reinit = kirkwood_enable_pcie; 104 kexec_reinit = kirkwood_enable_pcie;
103#endif 105#endif
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index bac21a554c91..5ed1f2e8c5f8 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -499,6 +499,28 @@ void __init kirkwood_wdt_init(void)
499 orion_wdt_init(); 499 orion_wdt_init();
500} 500}
501 501
502/*****************************************************************************
503 * CPU idle
504 ****************************************************************************/
505static struct resource kirkwood_cpuidle_resource[] = {
506 {
507 .flags = IORESOURCE_MEM,
508 .start = DDR_OPERATION_BASE,
509 .end = DDR_OPERATION_BASE + 3,
510 },
511};
512
513static struct platform_device kirkwood_cpuidle = {
514 .name = "kirkwood_cpuidle",
515 .id = -1,
516 .resource = kirkwood_cpuidle_resource,
517 .num_resources = 1,
518};
519
520void __init kirkwood_cpuidle_init(void)
521{
522 platform_device_register(&kirkwood_cpuidle);
523}
502 524
503/***************************************************************************** 525/*****************************************************************************
504 * Time handling 526 * Time handling
@@ -671,6 +693,7 @@ void __init kirkwood_init(void)
671 kirkwood_xor1_init(); 693 kirkwood_xor1_init();
672 kirkwood_crypto_init(); 694 kirkwood_crypto_init();
673 695
696 kirkwood_cpuidle_init();
674#ifdef CONFIG_KEXEC 697#ifdef CONFIG_KEXEC
675 kexec_reinit = kirkwood_enable_pcie; 698 kexec_reinit = kirkwood_enable_pcie;
676#endif 699#endif
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 5ffa57f08c80..320aa61ff505 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -50,6 +50,7 @@ void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay);
50void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, 50void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
51 int (*dev_ready)(struct mtd_info *)); 51 int (*dev_ready)(struct mtd_info *));
52void kirkwood_audio_init(void); 52void kirkwood_audio_init(void);
53void kirkwood_cpuidle_init(void);
53void kirkwood_restart(char, const char *); 54void kirkwood_restart(char, const char *);
54void kirkwood_clk_init(void); 55void kirkwood_clk_init(void);
55 56
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
deleted file mode 100644
index f7304670f2f8..000000000000
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/cpuidle.c
3 *
4 * CPU idle Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 *
10 * The cpu idle uses wait-for-interrupt and DDR self refresh in order
11 * to implement two idle states -
12 * #1 wait-for-interrupt
13 * #2 wait-for-interrupt and DDR self refresh
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/cpuidle.h>
20#include <linux/io.h>
21#include <linux/export.h>
22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h>
24#include <mach/kirkwood.h>
25
26#define KIRKWOOD_MAX_STATES 2
27
28/* Actual code that puts the SoC in different idle states */
29static int kirkwood_enter_idle(struct cpuidle_device *dev,
30 struct cpuidle_driver *drv,
31 int index)
32{
33 writel(0x7, DDR_OPERATION_BASE);
34 cpu_do_idle();
35
36 return index;
37}
38
39static struct cpuidle_driver kirkwood_idle_driver = {
40 .name = "kirkwood_idle",
41 .owner = THIS_MODULE,
42 .en_core_tk_irqen = 1,
43 .states[0] = ARM_CPUIDLE_WFI_STATE,
44 .states[1] = {
45 .enter = kirkwood_enter_idle,
46 .exit_latency = 10,
47 .target_residency = 100000,
48 .flags = CPUIDLE_FLAG_TIME_VALID,
49 .name = "DDR SR",
50 .desc = "WFI and DDR Self Refresh",
51 },
52 .state_count = KIRKWOOD_MAX_STATES,
53};
54
55static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
56
57/* Initialize CPU idle by registering the idle states */
58static int kirkwood_init_cpuidle(void)
59{
60 struct cpuidle_device *device;
61
62 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
63 device->state_count = KIRKWOOD_MAX_STATES;
64
65 cpuidle_register_driver(&kirkwood_idle_driver);
66 if (cpuidle_register_device(device)) {
67 pr_err("kirkwood_init_cpuidle: Failed registering\n");
68 return -EIO;
69 }
70 return 0;
71}
72
73device_initcall(kirkwood_init_cpuidle);
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index 041653a04a9c..a05563a31c95 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -60,8 +60,9 @@
60 * Register Map 60 * Register Map
61 */ 61 */
62#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000) 62#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
63#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
63#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500) 64#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
64#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418) 65#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
65 66
66#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000) 67#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
67#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000) 68#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)