diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2015-03-26 13:35:48 -0400 |
---|---|---|
committer | Kukjin Kim <kgene@kernel.org> | 2015-03-26 13:35:48 -0400 |
commit | 89366409748c2de0521cf4303bfb1247676882df (patch) | |
tree | 152d2c0d10f767ba382b7b10468dd1ef662ea99c /arch/arm/mach-exynos | |
parent | dc1b9448d23deb51ad74a873392402560955dbc2 (diff) |
ARM: EXYNOS: add AFTR mode support for Exynos3250
AFTR mode support brings reduced energy consumption and is
a prerequisite for more advanced W-AFTR/LPA power saving modes.
AFTR mode has been already supported on other Exynos SoCs for
few years and this patch adds its support for Exynos3250 SoC.
The differences in Exynos3250 SoC AFTR mode support when compared
to Exynos4x12 SoCs are:
- different secure firmware calls are used
- different S5P_WAKEUP_MASK wakeup mask is used
- S5P_WAKEUP_MASK2 wakeup mask needs to be set in addition to
the standard S5P_WAKEUP_MASK one
- C2_STATE BOOT mode flag needs to be set/cleared pre/post AFTR
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
Diffstat (limited to 'arch/arm/mach-exynos')
-rw-r--r-- | arch/arm/mach-exynos/firmware.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-exynos/pm.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-exynos/regs-pmu.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-exynos/smc.h | 9 |
4 files changed, 28 insertions, 2 deletions
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c index 27b8ae3e1f89..1bd35763f12e 100644 --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c | |||
@@ -48,7 +48,13 @@ static int exynos_do_idle(unsigned long mode) | |||
48 | __raw_writel(virt_to_phys(exynos_cpu_resume_ns), | 48 | __raw_writel(virt_to_phys(exynos_cpu_resume_ns), |
49 | sysram_ns_base_addr + 0x24); | 49 | sysram_ns_base_addr + 0x24); |
50 | __raw_writel(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20); | 50 | __raw_writel(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20); |
51 | exynos_smc(SMC_CMD_CPU0AFTR, 0, 0, 0); | 51 | if (soc_is_exynos3250()) { |
52 | exynos_smc(SMC_CMD_SAVE, OP_TYPE_CORE, | ||
53 | SMC_POWERSTATE_IDLE, 0); | ||
54 | exynos_smc(SMC_CMD_SHUTDOWN, OP_TYPE_CLUSTER, | ||
55 | SMC_POWERSTATE_IDLE, 0); | ||
56 | } else | ||
57 | exynos_smc(SMC_CMD_CPU0AFTR, 0, 0, 0); | ||
52 | break; | 58 | break; |
53 | case FW_DO_IDLE_SLEEP: | 59 | case FW_DO_IDLE_SLEEP: |
54 | exynos_smc(SMC_CMD_SLEEP, 0, 0, 0); | 60 | exynos_smc(SMC_CMD_SLEEP, 0, 0, 0); |
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index e6209dadc00d..0a7e3afd6fc7 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c | |||
@@ -127,6 +127,8 @@ int exynos_pm_central_resume(void) | |||
127 | static void exynos_set_wakeupmask(long mask) | 127 | static void exynos_set_wakeupmask(long mask) |
128 | { | 128 | { |
129 | pmu_raw_writel(mask, S5P_WAKEUP_MASK); | 129 | pmu_raw_writel(mask, S5P_WAKEUP_MASK); |
130 | if (soc_is_exynos3250()) | ||
131 | pmu_raw_writel(0x0, S5P_WAKEUP_MASK2); | ||
130 | } | 132 | } |
131 | 133 | ||
132 | static void exynos_cpu_set_boot_vector(long flags) | 134 | static void exynos_cpu_set_boot_vector(long flags) |
@@ -140,7 +142,7 @@ static int exynos_aftr_finisher(unsigned long flags) | |||
140 | { | 142 | { |
141 | int ret; | 143 | int ret; |
142 | 144 | ||
143 | exynos_set_wakeupmask(0x0000ff3e); | 145 | exynos_set_wakeupmask(soc_is_exynos3250() ? 0x40003ffe : 0x0000ff3e); |
144 | /* Set value of power down register for aftr mode */ | 146 | /* Set value of power down register for aftr mode */ |
145 | exynos_sys_powerdown_conf(SYS_AFTR); | 147 | exynos_sys_powerdown_conf(SYS_AFTR); |
146 | 148 | ||
@@ -157,8 +159,13 @@ static int exynos_aftr_finisher(unsigned long flags) | |||
157 | 159 | ||
158 | void exynos_enter_aftr(void) | 160 | void exynos_enter_aftr(void) |
159 | { | 161 | { |
162 | unsigned int cpuid = smp_processor_id(); | ||
163 | |||
160 | cpu_pm_enter(); | 164 | cpu_pm_enter(); |
161 | 165 | ||
166 | if (soc_is_exynos3250()) | ||
167 | exynos_set_boot_flag(cpuid, C2_STATE); | ||
168 | |||
162 | exynos_pm_central_suspend(); | 169 | exynos_pm_central_suspend(); |
163 | 170 | ||
164 | if (of_machine_is_compatible("samsung,exynos4212") || | 171 | if (of_machine_is_compatible("samsung,exynos4212") || |
@@ -178,6 +185,9 @@ void exynos_enter_aftr(void) | |||
178 | 185 | ||
179 | exynos_pm_central_resume(); | 186 | exynos_pm_central_resume(); |
180 | 187 | ||
188 | if (soc_is_exynos3250()) | ||
189 | exynos_clear_boot_flag(cpuid, C2_STATE); | ||
190 | |||
181 | cpu_pm_exit(); | 191 | cpu_pm_exit(); |
182 | } | 192 | } |
183 | 193 | ||
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 84ddce142ab1..b7614333d296 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #define S5P_WAKEUP_STAT 0x0600 | 43 | #define S5P_WAKEUP_STAT 0x0600 |
44 | #define S5P_EINT_WAKEUP_MASK 0x0604 | 44 | #define S5P_EINT_WAKEUP_MASK 0x0604 |
45 | #define S5P_WAKEUP_MASK 0x0608 | 45 | #define S5P_WAKEUP_MASK 0x0608 |
46 | #define S5P_WAKEUP_MASK2 0x0614 | ||
46 | 47 | ||
47 | #define S5P_INFORM0 0x0800 | 48 | #define S5P_INFORM0 0x0800 |
48 | #define S5P_INFORM1 0x0804 | 49 | #define S5P_INFORM1 0x0804 |
diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h index f7b82f9c1e21..c2845717bc8f 100644 --- a/arch/arm/mach-exynos/smc.h +++ b/arch/arm/mach-exynos/smc.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #define SMC_CMD_SLEEP (-3) | 17 | #define SMC_CMD_SLEEP (-3) |
18 | #define SMC_CMD_CPU1BOOT (-4) | 18 | #define SMC_CMD_CPU1BOOT (-4) |
19 | #define SMC_CMD_CPU0AFTR (-5) | 19 | #define SMC_CMD_CPU0AFTR (-5) |
20 | #define SMC_CMD_SAVE (-6) | ||
21 | #define SMC_CMD_SHUTDOWN (-7) | ||
20 | /* For CP15 Access */ | 22 | /* For CP15 Access */ |
21 | #define SMC_CMD_C15RESUME (-11) | 23 | #define SMC_CMD_C15RESUME (-11) |
22 | /* For L2 Cache Access */ | 24 | /* For L2 Cache Access */ |
@@ -32,4 +34,11 @@ extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3); | |||
32 | 34 | ||
33 | #endif /* __ASSEMBLY__ */ | 35 | #endif /* __ASSEMBLY__ */ |
34 | 36 | ||
37 | /* op type for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */ | ||
38 | #define OP_TYPE_CORE 0x0 | ||
39 | #define OP_TYPE_CLUSTER 0x1 | ||
40 | |||
41 | /* Power State required for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */ | ||
42 | #define SMC_POWERSTATE_IDLE 0x1 | ||
43 | |||
35 | #endif | 44 | #endif |