linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 06/10] ARM: at91: pm select memory controler at runtime
Date: Tue, 17 Apr 2012 15:00:47 +0200	[thread overview]
Message-ID: <1334667647-8769-1-git-send-email-nicolas.ferre@atmel.com> (raw)
In-Reply-To: <1333899606-30518-6-git-send-email-plagnioj@jcrosoft.com>

From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
[nicolas.ferre at atmel.com: add cpuidle modification]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/cpuidle.c |    8 +++++++-
 arch/arm/mach-at91/pm.c      |   12 ++++++++----
 arch/arm/mach-at91/pm.h      |   13 -------------
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index ece1f9a..0c63815 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -21,6 +21,7 @@
 #include <linux/export.h>
 #include <asm/proc-fns.h>
 #include <asm/cpuidle.h>
+#include <mach/cpu.h>
 
 #include "pm.h"
 
@@ -33,7 +34,12 @@ static int at91_enter_idle(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			       int index)
 {
-	at91_standby();
+	if (cpu_is_at91rm9200())
+		at91rm9200_standby();
+	else if (cpu_is_at91sam9g45())
+		at91sam9g45_standby();
+	else
+		at91sam9_standby();
 
 	return index;
 }
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index f630250..1bfaad6 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)
 			 * For ARM 926 based chips, this requirement is weaker
 			 * as at91sam9 can access a RAM in self-refresh mode.
 			 */
-			at91_standby();
+			if (cpu_is_at91rm9200())
+				at91rm9200_standby();
+			else if (cpu_is_at91sam9g45())
+				at91sam9g45_standby();
+			else
+				at91sam9_standby();
 			break;
 
 		case PM_SUSPEND_ON:
@@ -307,10 +312,9 @@ static int __init at91_pm_init(void)
 
 	pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
 
-#ifdef CONFIG_ARCH_AT91RM9200
 	/* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
-	at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
-#endif
+	if (cpu_is_at91rm9200())
+		at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
 
 	suspend_set_ops(&at91_pm_ops);
 
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 89f56f3..1b4865e 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -12,7 +12,6 @@
 #define __ARCH_ARM_MACH_AT91_PM
 
 #include <mach/at91_ramc.h>
-#ifdef CONFIG_ARCH_AT91RM9200
 #include <mach/at91rm9200_sdramc.h>
 
 /*
@@ -43,10 +42,6 @@ static inline void at91rm9200_standby(void)
 		  "r" (lpr));
 }
 
-#define at91_standby at91rm9200_standby
-
-#elif defined(CONFIG_ARCH_AT91SAM9G45)
-
 /* We manage both DDRAM/SDRAM controllers, we need more than one value to
  * remember.
  */
@@ -75,10 +70,6 @@ static inline void at91sam9g45_standby(void)
 	at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
 }
 
-#define at91_standby at91sam9g45_standby
-
-#else
-
 #ifdef CONFIG_ARCH_AT91SAM9263
 /*
  * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
@@ -102,8 +93,4 @@ static inline void at91sam9_standby(void)
 	at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr);
 }
 
-#define at91_standby at91sam9_standby
-
-#endif
-
 #endif
-- 
1.7.10

  reply	other threads:[~2012-04-17 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-08 15:12 [PATCH 00/10] ARM: at91: finnaly add multi soc in the same kernel support Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:39 ` [PATCH 01/10] ARM: at91: uncompress Store UART address in a variable Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:39 ` [PATCH 02/10] ARM: at91: uncompress: autodetect the uart to use Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:39 ` [PATCH 03/10] ARM: at91: drop at91_set_serial_console Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 04/10] ARM: at91: do not pin mux the UARTs in init_early Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 05/10] ARM: at91: move at91_init_leds to board init Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 06/10] ARM: at91: pm select memory controler at runtime Jean-Christophe PLAGNIOL-VILLARD
2012-04-17 13:00   ` Nicolas Ferre [this message]
2012-04-08 15:40 ` [PATCH 07/10] ARM: at91: add SOC_AT91SAM9 kconfig option to factorise select Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 08/10] ARN: at91: introduce SOC_AT91xxx define to allow to compile SoC core support Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 09/10] ARM: at91/dt: do not specify the board any more Jean-Christophe PLAGNIOL-VILLARD
2012-04-08 15:40 ` [PATCH 10/10] ARM: at91: add defconfig for device tree Jean-Christophe PLAGNIOL-VILLARD
2012-04-17  8:55 ` [PATCH 00/10] ARM: at91: finnaly add multi soc in the same kernel support Nicolas Ferre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334667647-8769-1-git-send-email-nicolas.ferre@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).