aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-ap325rxa
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-10-30 00:23:51 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-10-30 01:33:44 -0400
commit86c7d03a0fe4241e64eb19b86544647c8ee4bac9 (patch)
tree8c73bac966ed65aafadd52e0b18ad8c20ab11c05 /arch/sh/boards/mach-ap325rxa
parent53528928d1260747c294b63218d9886c74df4c31 (diff)
sh: Add ap325rxa specific memory pre/post sleep code
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>
Diffstat (limited to 'arch/sh/boards/mach-ap325rxa')
-rw-r--r--arch/sh/boards/mach-ap325rxa/Makefile2
-rw-r--r--arch/sh/boards/mach-ap325rxa/sdram.S69
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c13
3 files changed, 83 insertions, 1 deletions
diff --git a/arch/sh/boards/mach-ap325rxa/Makefile b/arch/sh/boards/mach-ap325rxa/Makefile
index 0ad249dbd351..4cf1774d2613 100644
--- a/arch/sh/boards/mach-ap325rxa/Makefile
+++ b/arch/sh/boards/mach-ap325rxa/Makefile
@@ -1,2 +1,2 @@
1obj-y := setup.o 1obj-y := setup.o sdram.o
2 2
diff --git a/arch/sh/boards/mach-ap325rxa/sdram.S b/arch/sh/boards/mach-ap325rxa/sdram.S
new file mode 100644
index 000000000000..db24fbed4fca
--- /dev/null
+++ b/arch/sh/boards/mach-ap325rxa/sdram.S
@@ -0,0 +1,69 @@
1/*
2 * AP325RXA sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(ap325rxa_sdram_enter_start)
23
24 /* SBSC: disable power down and put in self-refresh mode */
25 mov.l 1f, r4
26 mov.l 2f, r1
27 mov.l @r4, r2
28 or r1, r2
29 mov.l 3f, r3
30 and r3, r2
31 mov.l r2, @r4
32
33 rts
34 nop
35
36 .balign 4
371: .long 0xfe400008 /* SDCR0 */
382: .long 0x00000400
393: .long 0xffff7fff
40ENTRY(ap325rxa_sdram_enter_end)
41
42 .balign 4
43ENTRY(ap325rxa_sdram_leave_start)
44
45 /* SBSC: set auto-refresh mode */
46 mov.l 1f, r4
47 mov.l @r4, r0
48 mov.l 4f, r1
49 and r1, r0
50 mov.l r0, @r4
51 mov.l 6f, r4
52 mov.l 8f, r0
53 mov.l @r4, r1
54 mov #-1, r4
55 add r4, r1
56 or r1, r0
57 mov.l 7f, r1
58 mov.l r0, @r1
59
60 rts
61 nop
62
63 .balign 4
641: .long 0xfe400008 /* SDCR0 */
654: .long 0xfffffbff
666: .long 0xfe40001c /* RTCOR */
677: .long 0xfe400018 /* RTCNT */
688: .long 0xa55a0000
69ENTRY(ap325rxa_sdram_leave_end)
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index b95deee35e0f..be8da973f00f 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -27,6 +27,7 @@
27#include <video/sh_mobile_lcdc.h> 27#include <video/sh_mobile_lcdc.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/clock.h> 29#include <asm/clock.h>
30#include <asm/suspend.h>
30#include <cpu/sh7723.h> 31#include <cpu/sh7723.h>
31 32
32static struct smsc911x_platform_config smsc911x_config = { 33static struct smsc911x_platform_config smsc911x_config = {
@@ -481,8 +482,20 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
481 &ap325rxa_camera[1], 482 &ap325rxa_camera[1],
482}; 483};
483 484
485extern char ap325rxa_sdram_enter_start;
486extern char ap325rxa_sdram_enter_end;
487extern char ap325rxa_sdram_leave_start;
488extern char ap325rxa_sdram_leave_end;
489
484static int __init ap325rxa_devices_setup(void) 490static int __init ap325rxa_devices_setup(void)
485{ 491{
492 /* register board specific self-refresh code */
493 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
494 &ap325rxa_sdram_enter_start,
495 &ap325rxa_sdram_enter_end,
496 &ap325rxa_sdram_leave_start,
497 &ap325rxa_sdram_leave_end);
498
486 /* LD3 and LD4 LEDs */ 499 /* LD3 and LD4 LEDs */
487 gpio_request(GPIO_PTX5, NULL); /* RUN */ 500 gpio_request(GPIO_PTX5, NULL); /* RUN */
488 gpio_direction_output(GPIO_PTX5, 1); 501 gpio_direction_output(GPIO_PTX5, 1);