--- linux/kernel26/arch/arm/mach-s3c2410/s3c2410-pm.c	2006-12-17 14:21:12.000000000 +0100
+++ linux.mine/kernel26/arch/arm/mach-s3c2410/s3c2410-pm.c	2006-12-17 19:17:21.000000000 +0100
@@ -32,6 +32,7 @@
 #include <asm/mach-types.h>
 
 #include <asm/arch/regs-gpio.h>
+#include <asm/arch/g500.h>
 
 #include "cpu.h"
 #include "pm.h"
@@ -43,6 +44,11 @@ extern void pm_dbg(const char *fmt, ...)
 #define DBG(fmt...) printk(KERN_DEBUG fmt)
 #endif
 
+// space for saving memory location where we copy resume code 
+// (a few instructions for now, see sleep.S, should be dynamically
+// computed)
+static unsigned long s3c24xx_resume_addr_save[4];
+
 static void s3c2410_pm_prepare(void)
 {
 	/* ensure at least GSTATUS3 has the resume address */
@@ -55,6 +61,14 @@ static void s3c2410_pm_prepare(void)
 	if ( machine_is_aml_m5900() )
 		s3c2410_gpio_setpin(S3C2410_GPF2, 1);
 
+
+#ifdef CONFIG_MACH_G500 
+		// save previous memory area before to overwrite it with the resume code
+		memcpy(s3c24xx_resume_addr_save, phys_to_virt(G500_SUSPEND_RESUMEAT), 16);
+
+		// now write the resume code
+    memcpy(phys_to_virt(G500_SUSPEND_RESUMEAT), s3c24xx_pm_return, 16);
+#endif
 }
 
 int s3c2410_pm_resume(struct sys_device *dev)
@@ -70,6 +84,11 @@ int s3c2410_pm_resume(struct sys_device 
 	if ( machine_is_aml_m5900() )
 		s3c2410_gpio_setpin(S3C2410_GPF2, 0);
 
+#ifdef CONFIG_MACH_G500 
+	// put back the previous data to the address where we copied the resume code
+	memcpy(phys_to_virt(G500_SUSPEND_RESUMEAT), s3c24xx_resume_addr_save, 16);
+#endif
+
 	return 0;
 }
 

