Pull button into test branch
[linux-drm-fsl-dcu.git] / arch / arm / mach-s3c2410 / s3c2410-pm.c
index e51d76669512ced432e3df2bf5f5147cfbdaa702..77c6814c0f0507599c650e72d35bfd3d071b6c58 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/mach-types.h>
 
 #include <asm/arch/regs-gpio.h>
+#include <asm/arch/h1940.h>
 
 #include "cpu.h"
 #include "pm.h"
@@ -52,6 +53,35 @@ static void s3c2410_pm_prepare(void)
        DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
        DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
 
+       if (machine_is_h1940()) {
+               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
+               unsigned long ptr;
+               unsigned long calc = 0;
+
+               /* generate check for the bootloader to check on resume */
+
+               for (ptr = 0; ptr < 0x40000; ptr += 0x400)
+                       calc += __raw_readl(base+ptr);
+
+               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
+       }
+
+       /* the RX3715 uses similar code and the same H1940 and the
+        * same offsets for resume and checksum pointers */
+
+       if (machine_is_rx3715()) {
+               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
+               unsigned long ptr;
+               unsigned long calc = 0;
+
+               /* generate check for the bootloader to check on resume */
+
+               for (ptr = 0; ptr < 0x40000; ptr += 0x4)
+                       calc += __raw_readl(base+ptr);
+
+               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
+       }
+
        if ( machine_is_aml_m5900() )
                s3c2410_gpio_setpin(S3C2410_GPF2, 1);