Re: [PATCH] at91 pm: Compilation fix for at91sam926x

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Victor
Date: Friday, August 24, 2007 - 12:11 am

hi,


I think we will go with the following change for now.
We need to pull in different header files anyway.

(This file will need to be re-looked at if we ever allow compiling a
single kernel image that supports multiple AT91 processors)


--- pm.c	6 Jul 2007 09:18:01 -0000	1.5
+++ pm.c	24 Aug 2007 07:22:13 -0000
@@ -27,12 +27,24 @@
 #include <asm/mach-types.h>
 
 #include <asm/arch/at91_pmc.h>
-#include <asm/arch/at91rm9200_mc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/cpu.h>
 
 #include "generic.h"
 
+#ifdef CONFIG_ARCH_AT91RM9200
+#include <asm/arch/at91rm9200_mc.h>
+
+#define sdram_selfrefresh_enable()	at91_sys_write(AT91_SDRAMC_SRR, 1)
+#define sdram_selfrefresh_disable()
+
+#else
+#include <asm/arch/at91sam926x_mc.h>
+
+#define sdram_selfrefresh_enable()	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_SELF_REFRESH)
+#define sdram_selfrefresh_disable()	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_DISABLE)
+
+#endif
 
 static int at91_pm_valid_state(suspend_state_t state)
 {
@@ -172,7 +184,7 @@
 			 */
 			asm("b 1f; .align 5; 1:");
 			asm("mcr p15, 0, r0, c7, c10, 4");	/* drain write buffer */
-			at91_sys_write(AT91_SDRAMC_SRR, 1);	/* self-refresh mode */
+			sdram_selfrefresh_enable();		/* self-refresh mode */
 			/* fall though to next state */
 
 		case PM_SUSPEND_ON:
@@ -188,6 +200,7 @@
 			at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
 
 error:
+	sdram_selfrefresh_disable();
 	target_state = PM_SUSPEND_ON;
 	at91_irq_resume();
 	at91_gpio_resume();


Regards,
  Andrew Victor


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] at91 pm: Compilation fix for at91sam926x, Michel Benoit, (Fri Aug 10, 3:00 am)
Re: [PATCH] at91 pm: Compilation fix for at91sam926x, Andrew Victor, (Fri Aug 24, 12:11 am)