From 9f3706742934e9aa500185eb40b78497dc1ec7cb Mon Sep 17 00:00:00 2001 From: Inderpal Singh Date: Thu, 27 Dec 2012 10:40:16 -0800 Subject: ARM: EXYNOS: Add support for rtc wakeup Set the gic arch extension callback to support rtc wakeup. Signed-off-by: Inderpal Singh Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/common.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index d63d399c7bae..789d4e66c950 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -463,6 +463,8 @@ void __init exynos4_init_irq(void) * uses GIC instead of VIC. */ s5p_init_irq(NULL, 0); + + gic_arch_extn.irq_set_wake = s3c_irq_wake; } void __init exynos5_init_irq(void) -- cgit v1.2.3 From 672b6829e7290cb4e51987fdcb1078f4eee6546c Mon Sep 17 00:00:00 2001 From: Jonathan Kliegman Date: Thu, 4 Apr 2013 15:15:43 +0900 Subject: ARM: EXYNOS: Remove hardcode wakeup unmask for EINT_0 For legacy reasons EINT_0 was being forced on for all exynos systems as a wake interrupt. For boards that need EINT_0 they should probably enable it with enable_irq_wake Signed-off-by: Jonathan Kliegman Signed-off-by: Doug Anderson Reviewed-by: Doug Anderson Reviewed-by: Thomas Abraham Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/include/mach/pm-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h index a67ecfaf1216..9d8da51e35ca 100644 --- a/arch/arm/mach-exynos/include/mach/pm-core.h +++ b/arch/arm/mach-exynos/include/mach/pm-core.h @@ -33,7 +33,7 @@ static inline void s3c_pm_arch_prepare_irqs(void) __raw_writel(tmp, S5P_WAKEUP_MASK); __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK); - __raw_writel(s3c_irqwake_eintmask & 0xFFFFFFFE, S5P_EINT_WAKEUP_MASK); + __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK); } static inline void s3c_pm_arch_stop_clocks(void) -- cgit v1.2.3 From 8521420375d0e6824a76fda24677f428c1d3f598 Mon Sep 17 00:00:00 2001 From: Jonathan Kliegman Date: Thu, 4 Apr 2013 15:15:49 +0900 Subject: ARM: EXYNOS: Clear ENABLE_WAKEUP_SW bit when entering suspend Setting this bit to 0 causes the system to wait until suspended to use the wakeup masks. With it being set high previously, masked interrupts were being received and processed before the EINT_WAKEUP_MASK was configured. Signed-off-by: Jonathan Kliegman Signed-off-by: Doug Anderson Reviewed-by: Doug Anderson Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/include/mach/pm-core.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h index 9d8da51e35ca..7dbbfec13ea5 100644 --- a/arch/arm/mach-exynos/include/mach/pm-core.h +++ b/arch/arm/mach-exynos/include/mach/pm-core.h @@ -27,13 +27,8 @@ static inline void s3c_pm_debug_init_uart(void) static inline void s3c_pm_arch_prepare_irqs(void) { - unsigned int tmp; - tmp = __raw_readl(S5P_WAKEUP_MASK); - tmp &= ~(1 << 31); - __raw_writel(tmp, S5P_WAKEUP_MASK); - - __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK); __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK); + __raw_writel(s3c_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK); } static inline void s3c_pm_arch_stop_clocks(void) -- cgit v1.2.3 From 2eb89f893e44b1a9f48fa1cb6aa5e0d18ed66bb5 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 18 Jan 2013 21:57:58 -0800 Subject: ARM: EXYNOS: factor out the idle states The states are defined in the driver. We can get rid of the intermediate cpuidle states initialization and the memcpy by directly initializing the driver states. Signed-off-by: Daniel Lezcano Acked-by: Amit Daniel Kachhap Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/cpuidle.c | 45 ++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index fcfe0251aa3e..6ac4069f3c93 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -41,24 +41,25 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index); -static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { - [0] = ARM_CPUIDLE_WFI_STATE, - [1] = { - .enter = exynos4_enter_lowpower, - .exit_latency = 300, - .target_residency = 100000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "C1", - .desc = "ARM power down", - }, -}; - static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); static struct cpuidle_driver exynos4_idle_driver = { .name = "exynos4_idle", .owner = THIS_MODULE, .en_core_tk_irqen = 1, + .states = { + [0] = ARM_CPUIDLE_WFI_STATE, + [1] = { + .enter = exynos4_enter_lowpower, + .exit_latency = 300, + .target_residency = 100000, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "C1", + .desc = "ARM power down", + }, + }, + .state_count = 2, + .safe_state_index = 0, }; /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ @@ -193,33 +194,21 @@ static void __init exynos5_core_down_clk(void) static int __init exynos4_init_cpuidle(void) { - int i, max_cpuidle_state, cpu_id; + int cpu_id; struct cpuidle_device *device; - struct cpuidle_driver *drv = &exynos4_idle_driver; if (soc_is_exynos5250()) exynos5_core_down_clk(); - /* Setup cpuidle driver */ - drv->state_count = (sizeof(exynos4_cpuidle_set) / - sizeof(struct cpuidle_state)); - max_cpuidle_state = drv->state_count; - for (i = 0; i < max_cpuidle_state; i++) { - memcpy(&drv->states[i], &exynos4_cpuidle_set[i], - sizeof(struct cpuidle_state)); - } - drv->safe_state_index = 0; cpuidle_register_driver(&exynos4_idle_driver); for_each_cpu(cpu_id, cpu_online_mask) { device = &per_cpu(exynos4_cpuidle_device, cpu_id); device->cpu = cpu_id; - if (cpu_id == 0) - device->state_count = (sizeof(exynos4_cpuidle_set) / - sizeof(struct cpuidle_state)); - else - device->state_count = 1; /* Support IDLE only */ + /* Support IDLE only */ + if (cpu_id != 0) + device->state_count = 1; if (cpuidle_register_device(device)) { printk(KERN_ERR "CPUidle register device failed\n,"); -- cgit v1.2.3 From 5db9f436213d81f053e3f6d69d367637b02fe95e Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 18 Jan 2013 21:57:58 -0800 Subject: ARM: EXYNOS: handle properly the return values The cpuidle_register_driver return value is not checked. The init function returns always -EIO when cpuidle_register_device fails but the error could be different. This patch fixes that by checking the cpuidle_register_driver properly and returning the correct value when cpuidle_register_device fails. Signed-off-by: Daniel Lezcano Acked-by: Amit Daniel Kachhap Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/cpuidle.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 6ac4069f3c93..a4e50811c9c5 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -194,13 +194,17 @@ static void __init exynos5_core_down_clk(void) static int __init exynos4_init_cpuidle(void) { - int cpu_id; + int cpu_id, ret; struct cpuidle_device *device; if (soc_is_exynos5250()) exynos5_core_down_clk(); - cpuidle_register_driver(&exynos4_idle_driver); + ret = cpuidle_register_driver(&exynos4_idle_driver); + if (ret) { + printk(KERN_ERR "CPUidle failed to register driver\n"); + return ret; + } for_each_cpu(cpu_id, cpu_online_mask) { device = &per_cpu(exynos4_cpuidle_device, cpu_id); @@ -210,9 +214,10 @@ static int __init exynos4_init_cpuidle(void) if (cpu_id != 0) device->state_count = 1; - if (cpuidle_register_device(device)) { - printk(KERN_ERR "CPUidle register device failed\n,"); - return -EIO; + ret = cpuidle_register_device(device); + if (ret) { + printk(KERN_ERR "CPUidle register device failed\n"); + return ret; } } -- cgit v1.2.3 From 329afd264592f8d0e40fa063c089b35fba0014cc Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 18 Jan 2013 21:57:58 -0800 Subject: ARM: EXYNOS: replace cpumask by the corresponding macro A trivial patch to replace for_each_cpu(cpu_id, cpu_online_mask) by the corresponding macro. Signed-off-by: Daniel Lezcano Acked-by: Amit Daniel Kachhap Signed-off-by: Kukjin Kim --- arch/arm/mach-exynos/cpuidle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/mach-exynos') diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index a4e50811c9c5..e2689d1133b9 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -206,7 +206,7 @@ static int __init exynos4_init_cpuidle(void) return ret; } - for_each_cpu(cpu_id, cpu_online_mask) { + for_each_online_cpu(cpu_id) { device = &per_cpu(exynos4_cpuidle_device, cpu_id); device->cpu = cpu_id; -- cgit v1.2.3