diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-04-13 19:50:21 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2015-04-13 19:50:21 -0400 |
commit | 89522f0f8bd5056dec21bb7de073cbd5886e435c (patch) | |
tree | f4755458dbff71851af23675417173a95271491f | |
parent | e8621d83c10ee95798bdb5e04f54439a7c1c9a2b (diff) | |
parent | 2e57dc087c27b8b0bd4a9e5f2c6f28f3cd0b47ff (diff) |
Merge tag 'at91-cleanup4_bis' of git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91 into next/multiplatform
Pull "Fourth batch of cleanup for 4.1" from Nicolas Ferre:
- 1 issues revealed by the kbuild test robot fixed
- move of some functions and macros into relevant files to be able to
streamline the at91 specific header afterwards
* tag 'at91-cleanup4_bis' of git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91:
ARM: at91/pm: move AT91_MEMCTRL_* to pm.h
ARM: at91/pm: move the standby functions to pm.c
ARM: at91: fix pm_suspend.S compilation when ARMv6 is selected
-rw-r--r-- | arch/arm/mach-at91/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91_ramc.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.c | 89 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.h | 96 |
4 files changed, 96 insertions, 96 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 06a4cefd33a0..4fa8b4541e64 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -17,6 +17,9 @@ obj-$(CONFIG_SOC_SAMA5) += sama5.o | |||
17 | obj-$(CONFIG_PM) += pm.o | 17 | obj-$(CONFIG_PM) += pm.o |
18 | obj-$(CONFIG_PM) += pm_suspend.o | 18 | obj-$(CONFIG_PM) += pm_suspend.o |
19 | 19 | ||
20 | ifeq ($(CONFIG_CPU_V7),y) | ||
21 | AFLAGS_pm_suspend.o := -march=armv7-a | ||
22 | endif | ||
20 | ifeq ($(CONFIG_PM_DEBUG),y) | 23 | ifeq ($(CONFIG_PM_DEBUG),y) |
21 | CFLAGS_pm.o += -DDEBUG | 24 | CFLAGS_pm.o += -DDEBUG |
22 | endif | 25 | endif |
diff --git a/arch/arm/mach-at91/include/mach/at91_ramc.h b/arch/arm/mach-at91/include/mach/at91_ramc.h index e4492b151fee..493bc486e858 100644 --- a/arch/arm/mach-at91/include/mach/at91_ramc.h +++ b/arch/arm/mach-at91/include/mach/at91_ramc.h | |||
@@ -21,10 +21,6 @@ extern void __iomem *at91_ramc_base[]; | |||
21 | .extern at91_ramc_base | 21 | .extern at91_ramc_base |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #define AT91_MEMCTRL_MC 0 | ||
25 | #define AT91_MEMCTRL_SDRAMC 1 | ||
26 | #define AT91_MEMCTRL_DDRSDR 2 | ||
27 | |||
28 | #include <soc/at91/at91rm9200_sdramc.h> | 24 | #include <soc/at91/at91rm9200_sdramc.h> |
29 | #include <soc/at91/at91sam9_ddrsdr.h> | 25 | #include <soc/at91/at91sam9_ddrsdr.h> |
30 | #include <soc/at91/at91sam9_sdramc.h> | 26 | #include <soc/at91/at91sam9_sdramc.h> |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index f93a735ba327..5062699cbb12 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -222,6 +222,95 @@ static void at91_pm_set_standby(void (*at91_standby)(void)) | |||
222 | at91_cpuidle_device.dev.platform_data = at91_standby; | 222 | at91_cpuidle_device.dev.platform_data = at91_standby; |
223 | } | 223 | } |
224 | 224 | ||
225 | /* | ||
226 | * The AT91RM9200 goes into self-refresh mode with this command, and will | ||
227 | * terminate self-refresh automatically on the next SDRAM access. | ||
228 | * | ||
229 | * Self-refresh mode is exited as soon as a memory access is made, but we don't | ||
230 | * know for sure when that happens. However, we need to restore the low-power | ||
231 | * mode if it was enabled before going idle. Restoring low-power mode while | ||
232 | * still in self-refresh is "not recommended", but seems to work. | ||
233 | */ | ||
234 | static void at91rm9200_standby(void) | ||
235 | { | ||
236 | u32 lpr = at91_ramc_read(0, AT91RM9200_SDRAMC_LPR); | ||
237 | |||
238 | asm volatile( | ||
239 | "b 1f\n\t" | ||
240 | ".align 5\n\t" | ||
241 | "1: mcr p15, 0, %0, c7, c10, 4\n\t" | ||
242 | " str %0, [%1, %2]\n\t" | ||
243 | " str %3, [%1, %4]\n\t" | ||
244 | " mcr p15, 0, %0, c7, c0, 4\n\t" | ||
245 | " str %5, [%1, %2]" | ||
246 | : | ||
247 | : "r" (0), "r" (at91_ramc_base[0]), "r" (AT91RM9200_SDRAMC_LPR), | ||
248 | "r" (1), "r" (AT91RM9200_SDRAMC_SRR), | ||
249 | "r" (lpr)); | ||
250 | } | ||
251 | |||
252 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to | ||
253 | * remember. | ||
254 | */ | ||
255 | static void at91_ddr_standby(void) | ||
256 | { | ||
257 | /* Those two values allow us to delay self-refresh activation | ||
258 | * to the maximum. */ | ||
259 | u32 lpr0, lpr1 = 0; | ||
260 | u32 saved_lpr0, saved_lpr1 = 0; | ||
261 | |||
262 | if (at91_ramc_base[1]) { | ||
263 | saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); | ||
264 | lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; | ||
265 | lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
266 | } | ||
267 | |||
268 | saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR); | ||
269 | lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB; | ||
270 | lpr0 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
271 | |||
272 | /* self-refresh mode now */ | ||
273 | at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); | ||
274 | if (at91_ramc_base[1]) | ||
275 | at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); | ||
276 | |||
277 | cpu_do_idle(); | ||
278 | |||
279 | at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); | ||
280 | if (at91_ramc_base[1]) | ||
281 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); | ||
282 | } | ||
283 | |||
284 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to | ||
285 | * remember. | ||
286 | */ | ||
287 | static void at91sam9_sdram_standby(void) | ||
288 | { | ||
289 | u32 lpr0, lpr1 = 0; | ||
290 | u32 saved_lpr0, saved_lpr1 = 0; | ||
291 | |||
292 | if (at91_ramc_base[1]) { | ||
293 | saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); | ||
294 | lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; | ||
295 | lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
296 | } | ||
297 | |||
298 | saved_lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR); | ||
299 | lpr0 = saved_lpr0 & ~AT91_SDRAMC_LPCB; | ||
300 | lpr0 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
301 | |||
302 | /* self-refresh mode now */ | ||
303 | at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); | ||
304 | if (at91_ramc_base[1]) | ||
305 | at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); | ||
306 | |||
307 | cpu_do_idle(); | ||
308 | |||
309 | at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); | ||
310 | if (at91_ramc_base[1]) | ||
311 | at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); | ||
312 | } | ||
313 | |||
225 | static const struct of_device_id ramc_ids[] __initconst = { | 314 | static const struct of_device_id ramc_ids[] __initconst = { |
226 | { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, | 315 | { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, |
227 | { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, | 316 | { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, |
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index dcacfa1ad3fa..ecd875a91d52 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -15,6 +15,10 @@ | |||
15 | 15 | ||
16 | #include <mach/at91_ramc.h> | 16 | #include <mach/at91_ramc.h> |
17 | 17 | ||
18 | #define AT91_MEMCTRL_MC 0 | ||
19 | #define AT91_MEMCTRL_SDRAMC 1 | ||
20 | #define AT91_MEMCTRL_DDRSDR 2 | ||
21 | |||
18 | #define AT91_PM_MEMTYPE_MASK 0x0f | 22 | #define AT91_PM_MEMTYPE_MASK 0x0f |
19 | 23 | ||
20 | #define AT91_PM_MODE_OFFSET 4 | 24 | #define AT91_PM_MODE_OFFSET 4 |
@@ -23,96 +27,4 @@ | |||
23 | 27 | ||
24 | #define AT91_PM_SLOW_CLOCK 0x01 | 28 | #define AT91_PM_SLOW_CLOCK 0x01 |
25 | 29 | ||
26 | /* | ||
27 | * The AT91RM9200 goes into self-refresh mode with this command, and will | ||
28 | * terminate self-refresh automatically on the next SDRAM access. | ||
29 | * | ||
30 | * Self-refresh mode is exited as soon as a memory access is made, but we don't | ||
31 | * know for sure when that happens. However, we need to restore the low-power | ||
32 | * mode if it was enabled before going idle. Restoring low-power mode while | ||
33 | * still in self-refresh is "not recommended", but seems to work. | ||
34 | */ | ||
35 | |||
36 | #ifndef __ASSEMBLY__ | ||
37 | static inline void at91rm9200_standby(void) | ||
38 | { | ||
39 | u32 lpr = at91_ramc_read(0, AT91RM9200_SDRAMC_LPR); | ||
40 | |||
41 | asm volatile( | ||
42 | "b 1f\n\t" | ||
43 | ".align 5\n\t" | ||
44 | "1: mcr p15, 0, %0, c7, c10, 4\n\t" | ||
45 | " str %0, [%1, %2]\n\t" | ||
46 | " str %3, [%1, %4]\n\t" | ||
47 | " mcr p15, 0, %0, c7, c0, 4\n\t" | ||
48 | " str %5, [%1, %2]" | ||
49 | : | ||
50 | : "r" (0), "r" (at91_ramc_base[0]), "r" (AT91RM9200_SDRAMC_LPR), | ||
51 | "r" (1), "r" (AT91RM9200_SDRAMC_SRR), | ||
52 | "r" (lpr)); | ||
53 | } | ||
54 | |||
55 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to | ||
56 | * remember. | ||
57 | */ | ||
58 | static inline void at91_ddr_standby(void) | ||
59 | { | ||
60 | /* Those two values allow us to delay self-refresh activation | ||
61 | * to the maximum. */ | ||
62 | u32 lpr0, lpr1 = 0; | ||
63 | u32 saved_lpr0, saved_lpr1 = 0; | ||
64 | |||
65 | if (at91_ramc_base[1]) { | ||
66 | saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); | ||
67 | lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; | ||
68 | lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
69 | } | ||
70 | |||
71 | saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR); | ||
72 | lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB; | ||
73 | lpr0 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
74 | |||
75 | /* self-refresh mode now */ | ||
76 | at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); | ||
77 | if (at91_ramc_base[1]) | ||
78 | at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); | ||
79 | |||
80 | cpu_do_idle(); | ||
81 | |||
82 | at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); | ||
83 | if (at91_ramc_base[1]) | ||
84 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); | ||
85 | } | ||
86 | |||
87 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to | ||
88 | * remember. | ||
89 | */ | ||
90 | static inline void at91sam9_sdram_standby(void) | ||
91 | { | ||
92 | u32 lpr0, lpr1 = 0; | ||
93 | u32 saved_lpr0, saved_lpr1 = 0; | ||
94 | |||
95 | if (at91_ramc_base[1]) { | ||
96 | saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); | ||
97 | lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; | ||
98 | lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
99 | } | ||
100 | |||
101 | saved_lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR); | ||
102 | lpr0 = saved_lpr0 & ~AT91_SDRAMC_LPCB; | ||
103 | lpr0 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
104 | |||
105 | /* self-refresh mode now */ | ||
106 | at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); | ||
107 | if (at91_ramc_base[1]) | ||
108 | at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); | ||
109 | |||
110 | cpu_do_idle(); | ||
111 | |||
112 | at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); | ||
113 | if (at91_ramc_base[1]) | ||
114 | at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); | ||
115 | } | ||
116 | |||
117 | #endif | ||
118 | #endif | 30 | #endif |