aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/configs/kirkwood_defconfig1
-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/include/mach/kirkwood.h3
-rw-r--r--drivers/cpuidle/Kconfig6
-rw-r--r--drivers/cpuidle/Makefile1
-rw-r--r--drivers/cpuidle/cpuidle-kirkwood.c (renamed from arch/arm/mach-kirkwood/cpuidle.c)45
9 files changed, 75 insertions, 8 deletions
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 93f3794ba5cb..13482ea58b09 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -56,6 +56,7 @@ CONFIG_AEABI=y
56CONFIG_ZBOOT_ROM_TEXT=0x0 56CONFIG_ZBOOT_ROM_TEXT=0x0
57CONFIG_ZBOOT_ROM_BSS=0x0 57CONFIG_ZBOOT_ROM_BSS=0x0
58CONFIG_CPU_IDLE=y 58CONFIG_CPU_IDLE=y
59CONFIG_CPU_IDLE_KIRKWOOD=y
59CONFIG_NET=y 60CONFIG_NET=y
60CONFIG_PACKET=y 61CONFIG_PACKET=y
61CONFIG_UNIX=y 62CONFIG_UNIX=y
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/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)
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index c4cc27e5c8a5..071e2c3eec4f 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -39,4 +39,10 @@ config CPU_IDLE_CALXEDA
39 help 39 help
40 Select this to enable cpuidle on Calxeda processors. 40 Select this to enable cpuidle on Calxeda processors.
41 41
42config CPU_IDLE_KIRKWOOD
43 bool "CPU Idle Driver for Kirkwood processors"
44 depends on ARCH_KIRKWOOD
45 help
46 Select this to enable cpuidle on Kirkwood processors.
47
42endif 48endif
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 03ee87482c71..24c6e7d945ed 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -6,3 +6,4 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
6obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o 6obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
7 7
8obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o 8obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
9obj-$(CONFIG_CPU_IDLE_KIRKWOOD) += cpuidle-kirkwood.o
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/drivers/cpuidle/cpuidle-kirkwood.c
index f7304670f2f8..670aa1e55cd6 100644
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ b/drivers/cpuidle/cpuidle-kirkwood.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/cpuidle.h> 20#include <linux/cpuidle.h>
@@ -21,16 +22,17 @@
21#include <linux/export.h> 22#include <linux/export.h>
22#include <asm/proc-fns.h> 23#include <asm/proc-fns.h>
23#include <asm/cpuidle.h> 24#include <asm/cpuidle.h>
24#include <mach/kirkwood.h>
25 25
26#define KIRKWOOD_MAX_STATES 2 26#define KIRKWOOD_MAX_STATES 2
27 27
28static void __iomem *ddr_operation_base;
29
28/* Actual code that puts the SoC in different idle states */ 30/* Actual code that puts the SoC in different idle states */
29static int kirkwood_enter_idle(struct cpuidle_device *dev, 31static int kirkwood_enter_idle(struct cpuidle_device *dev,
30 struct cpuidle_driver *drv, 32 struct cpuidle_driver *drv,
31 int index) 33 int index)
32{ 34{
33 writel(0x7, DDR_OPERATION_BASE); 35 writel(0x7, ddr_operation_base);
34 cpu_do_idle(); 36 cpu_do_idle();
35 37
36 return index; 38 return index;
@@ -51,13 +53,22 @@ static struct cpuidle_driver kirkwood_idle_driver = {
51 }, 53 },
52 .state_count = KIRKWOOD_MAX_STATES, 54 .state_count = KIRKWOOD_MAX_STATES,
53}; 55};
56static struct cpuidle_device *device;
54 57
55static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device); 58static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
56 59
57/* Initialize CPU idle by registering the idle states */ 60/* Initialize CPU idle by registering the idle states */
58static int kirkwood_init_cpuidle(void) 61static int kirkwood_cpuidle_probe(struct platform_device *pdev)
59{ 62{
60 struct cpuidle_device *device; 63 struct resource *res;
64
65 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
66 if (res == NULL)
67 return -EINVAL;
68
69 ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
70 if (!ddr_operation_base)
71 return -EADDRNOTAVAIL;
61 72
62 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); 73 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
63 device->state_count = KIRKWOOD_MAX_STATES; 74 device->state_count = KIRKWOOD_MAX_STATES;
@@ -70,4 +81,26 @@ static int kirkwood_init_cpuidle(void)
70 return 0; 81 return 0;
71} 82}
72 83
73device_initcall(kirkwood_init_cpuidle); 84int kirkwood_cpuidle_remove(struct platform_device *pdev)
85{
86 cpuidle_unregister_device(device);
87 cpuidle_unregister_driver(&kirkwood_idle_driver);
88
89 return 0;
90}
91
92static struct platform_driver kirkwood_cpuidle_driver = {
93 .probe = kirkwood_cpuidle_probe,
94 .remove = kirkwood_cpuidle_remove,
95 .driver = {
96 .name = "kirkwood_cpuidle",
97 .owner = THIS_MODULE,
98 },
99};
100
101module_platform_driver(kirkwood_cpuidle_driver);
102
103MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
104MODULE_DESCRIPTION("Kirkwood cpu idle driver");
105MODULE_LICENSE("GPL v2");
106MODULE_ALIAS("platform:kirkwood-cpuidle");