aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-02-13 01:58:30 -0500
committerNicolas Ferre <nicolas.ferre@atmel.com>2012-04-17 08:46:43 -0400
commitefd09165aa554f84a42565d5ae6a1af58b06a97a (patch)
tree3ca981db0ec5b7882f8e07f2ef204e97ea1b63f9
parent7eb1dbb3beb982a7d72514abff96ebc08a22e5cd (diff)
ARM: at91: pm select memory controler at runtime
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> [nicolas.ferre@atmel.com: add cpuidle modification] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r--arch/arm/mach-at91/cpuidle.c8
-rw-r--r--arch/arm/mach-at91/pm.c12
-rw-r--r--arch/arm/mach-at91/pm.h13
3 files changed, 15 insertions, 18 deletions
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index ece1f9aefb47..0c6381516a5a 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -21,6 +21,7 @@
21#include <linux/export.h> 21#include <linux/export.h>
22#include <asm/proc-fns.h> 22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h> 23#include <asm/cpuidle.h>
24#include <mach/cpu.h>
24 25
25#include "pm.h" 26#include "pm.h"
26 27
@@ -33,7 +34,12 @@ static int at91_enter_idle(struct cpuidle_device *dev,
33 struct cpuidle_driver *drv, 34 struct cpuidle_driver *drv,
34 int index) 35 int index)
35{ 36{
36 at91_standby(); 37 if (cpu_is_at91rm9200())
38 at91rm9200_standby();
39 else if (cpu_is_at91sam9g45())
40 at91sam9g45_standby();
41 else
42 at91sam9_standby();
37 43
38 return index; 44 return index;
39} 45}
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index f630250c6b87..1bfaad628731 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -261,7 +261,12 @@ static int at91_pm_enter(suspend_state_t state)
261 * For ARM 926 based chips, this requirement is weaker 261 * For ARM 926 based chips, this requirement is weaker
262 * as at91sam9 can access a RAM in self-refresh mode. 262 * as at91sam9 can access a RAM in self-refresh mode.
263 */ 263 */
264 at91_standby(); 264 if (cpu_is_at91rm9200())
265 at91rm9200_standby();
266 else if (cpu_is_at91sam9g45())
267 at91sam9g45_standby();
268 else
269 at91sam9_standby();
265 break; 270 break;
266 271
267 case PM_SUSPEND_ON: 272 case PM_SUSPEND_ON:
@@ -307,10 +312,9 @@ static int __init at91_pm_init(void)
307 312
308 pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); 313 pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
309 314
310#ifdef CONFIG_ARCH_AT91RM9200
311 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ 315 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
312 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); 316 if (cpu_is_at91rm9200())
313#endif 317 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
314 318
315 suspend_set_ops(&at91_pm_ops); 319 suspend_set_ops(&at91_pm_ops);
316 320
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 89f56f3a802e..1b4865e7571d 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -12,7 +12,6 @@
12#define __ARCH_ARM_MACH_AT91_PM 12#define __ARCH_ARM_MACH_AT91_PM
13 13
14#include <mach/at91_ramc.h> 14#include <mach/at91_ramc.h>
15#ifdef CONFIG_ARCH_AT91RM9200
16#include <mach/at91rm9200_sdramc.h> 15#include <mach/at91rm9200_sdramc.h>
17 16
18/* 17/*
@@ -43,10 +42,6 @@ static inline void at91rm9200_standby(void)
43 "r" (lpr)); 42 "r" (lpr));
44} 43}
45 44
46#define at91_standby at91rm9200_standby
47
48#elif defined(CONFIG_ARCH_AT91SAM9G45)
49
50/* We manage both DDRAM/SDRAM controllers, we need more than one value to 45/* We manage both DDRAM/SDRAM controllers, we need more than one value to
51 * remember. 46 * remember.
52 */ 47 */
@@ -75,10 +70,6 @@ static inline void at91sam9g45_standby(void)
75 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); 70 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
76} 71}
77 72
78#define at91_standby at91sam9g45_standby
79
80#else
81
82#ifdef CONFIG_ARCH_AT91SAM9263 73#ifdef CONFIG_ARCH_AT91SAM9263
83/* 74/*
84 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 75 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
@@ -102,8 +93,4 @@ static inline void at91sam9_standby(void)
102 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr); 93 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr);
103} 94}
104 95
105#define at91_standby at91sam9_standby
106
107#endif
108
109#endif 96#endif