[ARM] 3986/1: H1940: suspend to RAM support
authorBen Dooks <ben-linux@fluff.org>
Wed, 6 Dec 2006 00:50:24 +0000 (01:50 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 7 Dec 2006 16:17:49 +0000 (16:17 +0000)
Add support to suspend and resume, using the
H1940's bootloader

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-s3c2410/Makefile
arch/arm/mach-s3c2410/mach-h1940.c
arch/arm/mach-s3c2410/pm-h1940.S [new file with mode: 0644]
arch/arm/mach-s3c2410/s3c2410-pm.c
arch/arm/mm/mmu.c
include/asm-arm/arch-s3c2410/h1940.h [new file with mode: 0644]

index d66013365b6bc2e7fa9d2888272a5df8520cd17d..0cd71dfec4478d151d8a1b3b4abd2f5c7f5acd8c 100644 (file)
@@ -77,7 +77,7 @@ obj-$(CONFIG_MACH_AML_M5900)  += mach-amlm5900.o
 obj-$(CONFIG_MACH_ANUBIS)      += mach-anubis.o
 obj-$(CONFIG_MACH_OSIRIS)      += mach-osiris.o
 obj-$(CONFIG_ARCH_BAST)                += mach-bast.o usb-simtec.o
-obj-$(CONFIG_ARCH_H1940)       += mach-h1940.o
+obj-$(CONFIG_ARCH_H1940)       += mach-h1940.o pm-h1940.o
 obj-$(CONFIG_MACH_N30)         += mach-n30.o
 obj-$(CONFIG_ARCH_SMDK2410)    += mach-smdk2410.o
 obj-$(CONFIG_MACH_SMDK2413)    += mach-smdk2413.o
index 8c895c077d22d48701251f889abbc04c6b3c2466..f5b98099a5d9cb1c925d060eb0b472be65078e6e 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/arch/regs-serial.h>
 #include <asm/arch/regs-lcd.h>
 
+#include <asm/arch/h1940.h>
 #include <asm/arch/h1940-latch.h>
 #include <asm/arch/fb.h>
 
@@ -41,6 +42,7 @@
 #include "clock.h"
 #include "devs.h"
 #include "cpu.h"
+#include "pm.h"
 
 static struct map_desc h1940_iodesc[] __initdata = {
        [0] = {
@@ -164,12 +166,16 @@ static void __init h1940_map_io(void)
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
        s3c24xx_set_board(&h1940_board);
+
+       /* setup PM */
+
+       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+       s3c2410_pm_init();
 }
 
 static void __init h1940_init_irq(void)
 {
        s3c24xx_init_irq();
-
 }
 
 static void __init h1940_init(void)
diff --git a/arch/arm/mach-s3c2410/pm-h1940.S b/arch/arm/mach-s3c2410/pm-h1940.S
new file mode 100644 (file)
index 0000000..7d66de7
--- /dev/null
@@ -0,0 +1,33 @@
+/* linux/arch/arm/mach-s3c2410/pm-h1940.S
+ *
+ * Copyright (c) 2006 Ben Dooks <ben-linux@fluff.org>
+ *
+ * H1940 Suspend to RAM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include <asm/hardware.h>
+#include <asm/arch/map.h>
+
+#include <asm/arch/regs-gpio.h>
+
+       .text
+       .global h1940_pm_return
+
+h1940_pm_return:
+       mov     r0, #S3C2410_PA_GPIO
+       ldr     pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ]
index e51d76669512ced432e3df2bf5f5147cfbdaa702..9cd0c104f1cbc05efdcef9d0279fc0b35dbc38da 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,19 @@ 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));
+       }
+
        if ( machine_is_aml_m5900() )
                s3c2410_gpio_setpin(S3C2410_GPF2, 1);
 
index 445bc3b951e678c82839f633c1bc4d2f40cf6cdc..f2d0d6f789731fffa9d4d9add9fb26a90d1124a0 100644 (file)
@@ -619,6 +619,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
        if (machine_is_p720t())
                res_size = 0x00014000;
 
+       if (machine_is_h1940()) {
+               reserve_bootmem_node(pgdat, 0x30003000, 0x1000);
+               reserve_bootmem_node(pgdat, 0x30081000, 0x1000);
+       }
+
 #ifdef CONFIG_SA1111
        /*
         * Because of the SA1111 DMA bug, we want to preserve our
diff --git a/include/asm-arm/arch-s3c2410/h1940.h b/include/asm-arm/arch-s3c2410/h1940.h
new file mode 100644 (file)
index 0000000..6135592
--- /dev/null
@@ -0,0 +1,21 @@
+/* linux/include/asm-arm/arch-s3c2410/h1940.h
+ *
+ * Copyright 2006 Ben Dooks <ben-linux@fluff.org>
+ *
+ * H1940 definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_H1940_H
+#define __ASM_ARCH_H1940_H
+
+#define H1940_SUSPEND_CHECKSUM         (0x30003ff8)
+#define H1940_SUSPEND_RESUMEAT         (0x30081000)
+#define H1940_SUSPEND_CHECK            (0x30080000)
+
+extern void h1940_pm_return(void);
+
+#endif /* __ASM_ARCH_H1940_H */