diff options
author | Andrew Lunn <andrew@lunn.ch> | 2013-01-09 13:22:15 +0100 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-01-31 18:01:37 +0100 |
commit | 9cfc94eb0f4843af5d1141a37d7b7ca5d3b27220 (patch) | |
tree | 10a852a3b4717423a0186ba0d47f0e85b39bbc13 /drivers/cpuidle/cpuidle-kirkwood.c | |
parent | rtc: Add support of rtc-mv for MVEBU SoCs (diff) | |
download | linux-9cfc94eb0f4843af5d1141a37d7b7ca5d3b27220.tar.xz linux-9cfc94eb0f4843af5d1141a37d7b7ca5d3b27220.zip |
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 '')
-rw-r--r-- | drivers/cpuidle/cpuidle-kirkwood.c (renamed from arch/arm/mach-kirkwood/cpuidle.c) | 45 |
1 files changed, 39 insertions, 6 deletions
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 @@ */ #include <linux/kernel.h> +#include <linux/module.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/cpuidle.h> @@ -21,16 +22,17 @@ #include <linux/export.h> #include <asm/proc-fns.h> #include <asm/cpuidle.h> -#include <mach/kirkwood.h> #define KIRKWOOD_MAX_STATES 2 +static void __iomem *ddr_operation_base; + /* Actual code that puts the SoC in different idle states */ static int kirkwood_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, + struct cpuidle_driver *drv, int index) { - writel(0x7, DDR_OPERATION_BASE); + writel(0x7, ddr_operation_base); cpu_do_idle(); return index; @@ -51,13 +53,22 @@ static struct cpuidle_driver kirkwood_idle_driver = { }, .state_count = KIRKWOOD_MAX_STATES, }; +static struct cpuidle_device *device; static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device); /* Initialize CPU idle by registering the idle states */ -static int kirkwood_init_cpuidle(void) +static int kirkwood_cpuidle_probe(struct platform_device *pdev) { - struct cpuidle_device *device; + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res == NULL) + return -EINVAL; + + ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res); + if (!ddr_operation_base) + return -EADDRNOTAVAIL; device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); device->state_count = KIRKWOOD_MAX_STATES; @@ -70,4 +81,26 @@ static int kirkwood_init_cpuidle(void) return 0; } -device_initcall(kirkwood_init_cpuidle); +int kirkwood_cpuidle_remove(struct platform_device *pdev) +{ + cpuidle_unregister_device(device); + cpuidle_unregister_driver(&kirkwood_idle_driver); + + return 0; +} + +static struct platform_driver kirkwood_cpuidle_driver = { + .probe = kirkwood_cpuidle_probe, + .remove = kirkwood_cpuidle_remove, + .driver = { + .name = "kirkwood_cpuidle", + .owner = THIS_MODULE, + }, +}; + +module_platform_driver(kirkwood_cpuidle_driver); + +MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>"); +MODULE_DESCRIPTION("Kirkwood cpu idle driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:kirkwood-cpuidle"); |