]> Pileus Git - ~andy/linux/commitdiff
sh: Add ap325rxa specific memory pre/post sleep code
authorMagnus Damm <damm@opensource.se>
Fri, 30 Oct 2009 04:23:51 +0000 (04:23 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 30 Oct 2009 05:33:44 +0000 (14:33 +0900)
Add self-refresh handling code for the AP325RXA board.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/boards/mach-ap325rxa/Makefile
arch/sh/boards/mach-ap325rxa/sdram.S [new file with mode: 0644]
arch/sh/boards/mach-ap325rxa/setup.c

index 0ad249dbd3518fe685f9215ac3260006e95cef09..4cf1774d26132e87b7d61e8eafc70bd3e94d5d27 100644 (file)
@@ -1,2 +1,2 @@
-obj-y   := setup.o
+obj-y   := setup.o sdram.o
 
diff --git a/arch/sh/boards/mach-ap325rxa/sdram.S b/arch/sh/boards/mach-ap325rxa/sdram.S
new file mode 100644 (file)
index 0000000..db24fbe
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * AP325RXA sdram self/auto-refresh setup code
+ *
+ *  Copyright (C) 2009 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/sys.h>
+#include <linux/errno.h>
+#include <linux/linkage.h>
+#include <asm/asm-offsets.h>
+#include <asm/suspend.h>
+#include <asm/romimage-macros.h>
+
+/* code to enter and leave self-refresh. must be self-contained.
+ * this code will be copied to on-chip memory and executed from there.
+ */
+       .balign 4
+ENTRY(ap325rxa_sdram_enter_start)
+
+       /* SBSC: disable power down and put in self-refresh mode */
+       mov.l   1f, r4
+       mov.l   2f, r1
+       mov.l   @r4, r2
+       or      r1, r2
+       mov.l   3f, r3
+       and     r3, r2
+       mov.l   r2, @r4
+
+       rts
+        nop
+
+       .balign 4
+1:     .long   0xfe400008 /* SDCR0 */
+2:     .long   0x00000400
+3:     .long   0xffff7fff
+ENTRY(ap325rxa_sdram_enter_end)
+
+       .balign 4
+ENTRY(ap325rxa_sdram_leave_start)
+
+       /* SBSC: set auto-refresh mode */
+       mov.l   1f, r4
+       mov.l   @r4, r0
+       mov.l   4f, r1
+       and     r1, r0
+       mov.l   r0, @r4
+       mov.l   6f, r4
+       mov.l   8f, r0
+       mov.l   @r4, r1
+       mov     #-1, r4
+       add     r4, r1
+       or      r1, r0
+       mov.l   7f, r1
+       mov.l   r0, @r1
+
+       rts
+        nop
+
+       .balign 4
+1:     .long   0xfe400008 /* SDCR0 */
+4:     .long   0xfffffbff
+6:     .long   0xfe40001c /* RTCOR */
+7:     .long   0xfe400018 /* RTCNT */
+8:     .long   0xa55a0000
+ENTRY(ap325rxa_sdram_leave_end)
index b95deee35e0ffc04ee56730c7b9a91780df555f1..be8da973f00f92defcd5e4436e3d9033260b9d31 100644 (file)
@@ -27,6 +27,7 @@
 #include <video/sh_mobile_lcdc.h>
 #include <asm/io.h>
 #include <asm/clock.h>
+#include <asm/suspend.h>
 #include <cpu/sh7723.h>
 
 static struct smsc911x_platform_config smsc911x_config = {
@@ -481,8 +482,20 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
        &ap325rxa_camera[1],
 };
 
+extern char ap325rxa_sdram_enter_start;
+extern char ap325rxa_sdram_enter_end;
+extern char ap325rxa_sdram_leave_start;
+extern char ap325rxa_sdram_leave_end;
+
 static int __init ap325rxa_devices_setup(void)
 {
+       /* register board specific self-refresh code */
+       sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
+                                       &ap325rxa_sdram_enter_start,
+                                       &ap325rxa_sdram_enter_end,
+                                       &ap325rxa_sdram_leave_start,
+                                       &ap325rxa_sdram_leave_end);
+
        /* LD3 and LD4 LEDs */
        gpio_request(GPIO_PTX5, NULL); /* RUN */
        gpio_direction_output(GPIO_PTX5, 1);