aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2015-01-12 03:41:34 -0500
committerKukjin Kim <kgene@kernel.org>2015-01-14 10:24:26 -0500
commita4f582f5c5fe3e8eaef7ce637c894619bdee650e (patch)
tree2657bf4c502b3287095fcd6cea99f2aa0f902fe6 /arch/arm
parentadacba58199871919956603aa51002d683484182 (diff)
ARM: EXYNOS: Add exynos3250 suspend-to-ram support
This patch supports suspend-to-ram for Exynos3250 SoC and the SoC doesn't contain L2 cache. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene@kernel.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h3
-rw-r--r--arch/arm/mach-exynos/suspend.c77
2 files changed, 80 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index b5f4406fc1b5..eb461e1c325a 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -160,12 +160,14 @@
160#define EXYNOS5_L2RSTDISABLE_VALUE BIT(3) 160#define EXYNOS5_L2RSTDISABLE_VALUE BIT(3)
161 161
162#define S5P_PAD_RET_MAUDIO_OPTION 0x3028 162#define S5P_PAD_RET_MAUDIO_OPTION 0x3028
163#define S5P_PAD_RET_MMC2_OPTION 0x30c8
163#define S5P_PAD_RET_GPIO_OPTION 0x3108 164#define S5P_PAD_RET_GPIO_OPTION 0x3108
164#define S5P_PAD_RET_UART_OPTION 0x3128 165#define S5P_PAD_RET_UART_OPTION 0x3128
165#define S5P_PAD_RET_MMCA_OPTION 0x3148 166#define S5P_PAD_RET_MMCA_OPTION 0x3148
166#define S5P_PAD_RET_MMCB_OPTION 0x3168 167#define S5P_PAD_RET_MMCB_OPTION 0x3168
167#define S5P_PAD_RET_EBIA_OPTION 0x3188 168#define S5P_PAD_RET_EBIA_OPTION 0x3188
168#define S5P_PAD_RET_EBIB_OPTION 0x31A8 169#define S5P_PAD_RET_EBIB_OPTION 0x31A8
170#define S5P_PAD_RET_SPI_OPTION 0x31c8
169 171
170#define S5P_PS_HOLD_CONTROL 0x330C 172#define S5P_PS_HOLD_CONTROL 0x330C
171#define S5P_PS_HOLD_EN (1 << 31) 173#define S5P_PS_HOLD_EN (1 << 31)
@@ -326,6 +328,7 @@
326 (EXYNOS3_ARM_CORE0_OPTION + ((_nr) * 0x80)) 328 (EXYNOS3_ARM_CORE0_OPTION + ((_nr) * 0x80))
327 329
328#define EXYNOS3_ARM_COMMON_OPTION 0x2408 330#define EXYNOS3_ARM_COMMON_OPTION 0x2408
331#define EXYNOS3_ARM_L2_OPTION 0x2608
329#define EXYNOS3_TOP_PWR_OPTION 0x2C48 332#define EXYNOS3_TOP_PWR_OPTION 0x2C48
330#define EXYNOS3_CORE_TOP_PWR_OPTION 0x2CA8 333#define EXYNOS3_CORE_TOP_PWR_OPTION 0x2CA8
331#define EXYNOS3_XUSBXTI_DURATION 0x341C 334#define EXYNOS3_XUSBXTI_DURATION 0x341C
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index f8e7dcd17055..d6feef31b468 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -91,6 +91,12 @@ static unsigned int exynos_pmu_spare3;
91 91
92static u32 exynos_irqwake_intmask = 0xffffffff; 92static u32 exynos_irqwake_intmask = 0xffffffff;
93 93
94static const struct exynos_wkup_irq exynos3250_wkup_irq[] = {
95 { 73, BIT(1) }, /* RTC alarm */
96 { 74, BIT(2) }, /* RTC tick */
97 { /* sentinel */ },
98};
99
94static const struct exynos_wkup_irq exynos4_wkup_irq[] = { 100static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
95 { 76, BIT(1) }, /* RTC alarm */ 101 { 76, BIT(1) }, /* RTC alarm */
96 { 77, BIT(2) }, /* RTC tick */ 102 { 77, BIT(2) }, /* RTC tick */
@@ -114,6 +120,19 @@ unsigned int exynos_release_ret_regs[] = {
114 REG_TABLE_END, 120 REG_TABLE_END,
115}; 121};
116 122
123unsigned int exynos3250_release_ret_regs[] = {
124 S5P_PAD_RET_MAUDIO_OPTION,
125 S5P_PAD_RET_GPIO_OPTION,
126 S5P_PAD_RET_UART_OPTION,
127 S5P_PAD_RET_MMCA_OPTION,
128 S5P_PAD_RET_MMCB_OPTION,
129 S5P_PAD_RET_EBIA_OPTION,
130 S5P_PAD_RET_EBIB_OPTION,
131 S5P_PAD_RET_MMC2_OPTION,
132 S5P_PAD_RET_SPI_OPTION,
133 REG_TABLE_END,
134};
135
117unsigned int exynos5420_release_ret_regs[] = { 136unsigned int exynos5420_release_ret_regs[] = {
118 EXYNOS_PAD_RET_DRAM_OPTION, 137 EXYNOS_PAD_RET_DRAM_OPTION,
119 EXYNOS_PAD_RET_MAUDIO_OPTION, 138 EXYNOS_PAD_RET_MAUDIO_OPTION,
@@ -173,6 +192,12 @@ static int exynos_cpu_suspend(unsigned long arg)
173 return exynos_cpu_do_idle(); 192 return exynos_cpu_do_idle();
174} 193}
175 194
195static int exynos3250_cpu_suspend(unsigned long arg)
196{
197 flush_cache_all();
198 return exynos_cpu_do_idle();
199}
200
176static int exynos5420_cpu_suspend(unsigned long arg) 201static int exynos5420_cpu_suspend(unsigned long arg)
177{ 202{
178 /* MCPM works with HW CPU identifiers */ 203 /* MCPM works with HW CPU identifiers */
@@ -230,6 +255,23 @@ static void exynos_pm_prepare(void)
230 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0); 255 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
231} 256}
232 257
258static void exynos3250_pm_prepare(void)
259{
260 unsigned int tmp;
261
262 /* Set wake-up mask registers */
263 exynos_pm_set_wakeup_mask();
264
265 tmp = pmu_raw_readl(EXYNOS3_ARM_L2_OPTION);
266 tmp &= ~EXYNOS5_OPTION_USE_RETENTION;
267 pmu_raw_writel(tmp, EXYNOS3_ARM_L2_OPTION);
268
269 exynos_pm_enter_sleep_mode();
270
271 /* ensure at least INFORM0 has the resume address */
272 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
273}
274
233static void exynos5420_pm_prepare(void) 275static void exynos5420_pm_prepare(void)
234{ 276{
235 unsigned int tmp; 277 unsigned int tmp;
@@ -344,6 +386,28 @@ early_wakeup:
344 pmu_raw_writel(0x0, S5P_INFORM1); 386 pmu_raw_writel(0x0, S5P_INFORM1);
345} 387}
346 388
389static void exynos3250_pm_resume(void)
390{
391 u32 cpuid = read_cpuid_part();
392
393 if (exynos_pm_central_resume())
394 goto early_wakeup;
395
396 /* For release retention */
397 exynos_pm_release_retention();
398
399 pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
400
401 if (call_firmware_op(resume) == -ENOSYS
402 && cpuid == ARM_CPU_PART_CORTEX_A9)
403 exynos_cpu_restore_register();
404
405early_wakeup:
406
407 /* Clear SLEEP mode set in INFORM1 */
408 pmu_raw_writel(0x0, S5P_INFORM1);
409}
410
347static void exynos5420_prepare_pm_resume(void) 411static void exynos5420_prepare_pm_resume(void)
348{ 412{
349 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) 413 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
@@ -483,6 +547,16 @@ static const struct platform_suspend_ops exynos_suspend_ops = {
483 .valid = suspend_valid_only_mem, 547 .valid = suspend_valid_only_mem,
484}; 548};
485 549
550static const struct exynos_pm_data exynos3250_pm_data = {
551 .wkup_irq = exynos3250_wkup_irq,
552 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
553 .release_ret_regs = exynos3250_release_ret_regs,
554 .pm_suspend = exynos_pm_suspend,
555 .pm_resume = exynos3250_pm_resume,
556 .pm_prepare = exynos3250_pm_prepare,
557 .cpu_suspend = exynos3250_cpu_suspend,
558};
559
486static const struct exynos_pm_data exynos4_pm_data = { 560static const struct exynos_pm_data exynos4_pm_data = {
487 .wkup_irq = exynos4_wkup_irq, 561 .wkup_irq = exynos4_wkup_irq,
488 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)), 562 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
@@ -518,6 +592,9 @@ static struct exynos_pm_data exynos5420_pm_data = {
518 592
519static struct of_device_id exynos_pmu_of_device_ids[] = { 593static struct of_device_id exynos_pmu_of_device_ids[] = {
520 { 594 {
595 .compatible = "samsung,exynos3250-pmu",
596 .data = &exynos3250_pm_data,
597 }, {
521 .compatible = "samsung,exynos4210-pmu", 598 .compatible = "samsung,exynos4210-pmu",
522 .data = &exynos4_pm_data, 599 .data = &exynos4_pm_data,
523 }, { 600 }, {