ARM: EXYNOS: convert cpuidle driver to be a platform driver

ARM EXYNOS cpuidle driver is currently not multiplatform support
ready (as it uses device_initcall() for initialization and doesn't
check on what platform it is running). Fix it by converting the
driver to be a platform driver and registering exynos_cpuidle
platform device from exynos[4,5]_dt_machine_init().

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2013-08-30 12:15:04 +02:00 committed by Rafael J. Wysocki
parent 00f3e75551
commit 35baa3369d
5 changed files with 28 additions and 2 deletions

View File

@ -30,6 +30,7 @@
#include <linux/clk-provider.h>
#include <linux/irqchip/arm-gic.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/platform_device.h>
#include <asm/proc-fns.h>
#include <asm/exception.h>
@ -294,6 +295,16 @@ void exynos5_restart(enum reboot_mode mode, const char *cmd)
__raw_writel(val, addr);
}
static struct platform_device exynos_cpuidle = {
.name = "exynos_cpuidle",
.id = -1,
};
void __init exynos_cpuidle_init(void)
{
platform_device_register(&exynos_cpuidle);
}
void __init exynos_init_late(void)
{
if (of_machine_is_compatible("samsung,exynos5440"))

View File

@ -22,6 +22,7 @@ struct map_desc;
void exynos_init_io(void);
void exynos4_restart(enum reboot_mode mode, const char *cmd);
void exynos5_restart(enum reboot_mode mode, const char *cmd);
void exynos_cpuidle_init(void);
void exynos_init_late(void);
void exynos_firmware_init(void);

View File

@ -15,6 +15,7 @@
#include <linux/io.h>
#include <linux/export.h>
#include <linux/time.h>
#include <linux/platform_device.h>
#include <asm/proc-fns.h>
#include <asm/smp_scu.h>
@ -192,7 +193,7 @@ static void __init exynos5_core_down_clk(void)
__raw_writel(tmp, EXYNOS5_PWR_CTRL2);
}
static int __init exynos4_init_cpuidle(void)
static int __init exynos_cpuidle_probe(struct platform_device *pdev)
{
int cpu_id, ret;
struct cpuidle_device *device;
@ -226,4 +227,13 @@ static int __init exynos4_init_cpuidle(void)
return 0;
}
device_initcall(exynos4_init_cpuidle);
static struct platform_driver exynos_cpuidle_driver = {
.probe = exynos_cpuidle_probe,
.driver = {
.name = "exynos_cpuidle",
.owner = THIS_MODULE,
},
};
module_platform_driver(exynos_cpuidle_driver);

View File

@ -25,6 +25,8 @@
static void __init exynos4_dt_machine_init(void)
{
exynos_cpuidle_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}

View File

@ -47,6 +47,8 @@ static void __init exynos5_dt_machine_init(void)
}
}
exynos_cpuidle_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}