**************************************************************
*Power management support for the at9260 core.
*support idle state with the core clock disabled.
*09/25/2007
*EMAC.Inc
************************************************************
diff -uprN linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/at91rm9200_devices.c linux-2.6.20.snap/arch/arm/mach-at91rm9200/at91rm9200_devices.c
--- linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/at91rm9200_devices.c	2007-09-25 13:09:17.000000000 -0400
+++ linux-2.6.20.snap/arch/arm/mach-at91rm9200/at91rm9200_devices.c	2007-09-24 17:53:39.000000000 -0400
@@ -913,4 +913,21 @@ static int __init at91_add_standard_devi
 	return 0;
 }
 
+/**
+ * cpu specific method for setting SDRAM self refresh mode 
+ */
+int at91_self_refresh(unsigned state){
+	at91_sys_write(AT91_SDRAMC_SRR, 1);	/* self-refresh mode */
+}
+
+/**
+ * cpu specific method for turning off SDRAM low power mode. 
+ */
+int at91_lp_disable(unsigned state){
+	at91_sys_write(AT91_SDRAMC_LPR, 0);
+}
+
+int at91_stopclock(unsigned state){}
+
+
 arch_initcall(at91_add_standard_devices);
diff -uprN linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/at91sam9260_devices.c linux-2.6.20.snap/arch/arm/mach-at91rm9200/at91sam9260_devices.c
--- linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/at91sam9260_devices.c	2007-09-25 13:09:18.000000000 -0400
+++ linux-2.6.20.snap/arch/arm/mach-at91rm9200/at91sam9260_devices.c	2007-09-24 17:53:39.000000000 -0400
@@ -20,6 +20,8 @@
 #include <asm/arch/at91sam926x_mc.h>
 #include <asm/arch/at91sam9260_matrix.h>
 
+#include <asm/arch/at91_pmc.h>
+
 #include "generic.h"
 
 #define SZ_512	0x00000200
@@ -914,4 +916,23 @@ static int __init at91_add_standard_devi
   return 0;
 }
 
+/**
+ * cpu specific method for setting SDRAM self refresh mode 
+ */
+int at91_self_refresh(unsigned state){
+	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_SELF_REFRESH);
+}
+
+/**
+ * cpu specific method for turning off SDRAM low power mode. 
+ */
+int at91_lp_disable(unsigned state){
+	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_DISABLE);
+}
+
+int at91_stopclock(unsigned state){
+	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
+}
+
+	
 arch_initcall(at91_add_standard_devices);
diff -uprN linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/generic.h linux-2.6.20.snap/arch/arm/mach-at91rm9200/generic.h
--- linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/generic.h	2007-09-25 13:09:17.000000000 -0400
+++ linux-2.6.20.snap/arch/arm/mach-at91rm9200/generic.h	2007-09-24 17:53:39.000000000 -0400
@@ -30,10 +30,13 @@ extern struct sys_timer at91sam926x_time
 extern int __init at91_clock_init(unsigned long main_clock);
 struct device;
 extern void __init at91_clock_associate(const char *id, struct device *dev, const char *func);
+extern int at91_stopclock(unsigned state);
 
  /* Power Management */
 extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
+extern int at91_self_refresh(unsigned state);//NZG
+extern int at91_lp_disable(unsigned state);
 
  /* GPIO */
 #define AT91RM9200_PQFP		3	/* AT91RM9200 PQFP package has 3 banks */
diff -uprN linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/pm.c linux-2.6.20.snap/arch/arm/mach-at91rm9200/pm.c
--- linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/pm.c	2007-09-25 13:09:17.000000000 -0400
+++ linux-2.6.20.snap/arch/arm/mach-at91rm9200/pm.c	2007-09-24 17:53:39.000000000 -0400
@@ -129,7 +129,7 @@ static int at91_pm_enter(suspend_state_t
 	at91_gpio_suspend();
 	at91_irq_suspend();
 
-	pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
+	pr_info("AT91: PM - wake mask %08x, pm state %d\n",
 			/* remember all the always-wake irqs */
 			(at91_sys_read(AT91_PMC_PCSR)
 					| (1 << AT91_ID_FIQ)
@@ -178,21 +178,25 @@ static int at91_pm_enter(suspend_state_t
 			 */
 			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 */
+			at91_self_refresh(1);//make this more generic to encompass the 9260
 			/* fall though to next state */
 
+		at91_stopclock(1);//if supported,stop the cpu clock on wfi instruction.
+			
 		case PM_SUSPEND_ON:
-			asm("mcr p15, 0, r0, c7, c0, 4");	/* wait for interrupt */
+			asm("mcr p15, 0, r0, c7, c0, 4");	// wait for interrupt 
 			break;
 
+			
+			
 		default:
 			pr_debug("AT91: PM - bogus suspend state %d\n", state);
 			goto error;
 	}
 
 	pr_debug("AT91: PM - wakeup %08x\n",
-			at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
-
+	at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
+	
 error:
 	target_state = PM_SUSPEND_ON;
 	at91_irq_resume();
@@ -228,7 +232,7 @@ static int __init at91_pm_init(void)
 #endif
 
 	/* Disable SDRAM low-power mode.  Cannot be used with self-refresh. */
-	at91_sys_write(AT91_SDRAMC_LPR, 0);
+	at91_lp_disable(1);
 
 	pm_set_ops(&at91_pm_ops);
 

