diff options
author | Magnus Damm <damm@opensource.se> | 2009-10-29 06:52:31 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-10-29 22:59:27 -0400 |
commit | 13fa551b5eb1752c6974a81ef19f369220972cf2 (patch) | |
tree | 1c5d64664d36dc4784451fabb1da8629026d4067 /arch | |
parent | 3b9f2952a3eda738f5f2d7610b76e284cbac581f (diff) |
sh: Add migor specific memory pre/post sleep code
Add self-refresh handling code for the Migo-R board.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/boards/mach-migor/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-migor/sdram.S | 69 | ||||
-rw-r--r-- | arch/sh/boards/mach-migor/setup.c | 13 |
3 files changed, 82 insertions, 2 deletions
diff --git a/arch/sh/boards/mach-migor/Makefile b/arch/sh/boards/mach-migor/Makefile index 5f231dd25c0e..4601a89e5ac7 100644 --- a/arch/sh/boards/mach-migor/Makefile +++ b/arch/sh/boards/mach-migor/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-y := setup.o | 1 | obj-y := setup.o sdram.o |
2 | obj-$(CONFIG_SH_MIGOR_QVGA) += lcd_qvga.o | 2 | obj-$(CONFIG_SH_MIGOR_QVGA) += lcd_qvga.o |
diff --git a/arch/sh/boards/mach-migor/sdram.S b/arch/sh/boards/mach-migor/sdram.S new file mode 100644 index 000000000000..614aa3a1398c --- /dev/null +++ b/arch/sh/boards/mach-migor/sdram.S | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Migo-R 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 | ||
22 | ENTRY(migor_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 | ||
37 | 1: .long 0xfe400008 /* SDCR0 */ | ||
38 | 2: .long 0x00000400 | ||
39 | 3: .long 0xffff7fff | ||
40 | ENTRY(migor_sdram_enter_end) | ||
41 | |||
42 | .balign 4 | ||
43 | ENTRY(migor_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 | ||
64 | 1: .long 0xfe400008 /* SDCR0 */ | ||
65 | 4: .long 0xfffffbff | ||
66 | 6: .long 0xfe40001c /* RTCOR */ | ||
67 | 7: .long 0xfe400018 /* RTCNT */ | ||
68 | 8: .long 0xa55a0000 | ||
69 | ENTRY(migor_sdram_leave_end) | ||
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 8e911360c91e..369525701d60 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/machvec.h> | 26 | #include <asm/machvec.h> |
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <asm/sh_keysc.h> | 28 | #include <asm/sh_keysc.h> |
29 | #include <asm/suspend.h> | ||
29 | #include <mach/migor.h> | 30 | #include <mach/migor.h> |
30 | #include <cpu/sh7722.h> | 31 | #include <cpu/sh7722.h> |
31 | 32 | ||
@@ -478,9 +479,19 @@ static struct platform_device *migor_devices[] __initdata = { | |||
478 | &migor_camera[1], | 479 | &migor_camera[1], |
479 | }; | 480 | }; |
480 | 481 | ||
482 | extern char migor_sdram_enter_start; | ||
483 | extern char migor_sdram_enter_end; | ||
484 | extern char migor_sdram_leave_start; | ||
485 | extern char migor_sdram_leave_end; | ||
486 | |||
481 | static int __init migor_devices_setup(void) | 487 | static int __init migor_devices_setup(void) |
482 | { | 488 | { |
483 | 489 | /* register board specific self-refresh code */ | |
490 | sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF, | ||
491 | &migor_sdram_enter_start, | ||
492 | &migor_sdram_enter_end, | ||
493 | &migor_sdram_leave_start, | ||
494 | &migor_sdram_leave_end); | ||
484 | #ifdef CONFIG_PM | 495 | #ifdef CONFIG_PM |
485 | /* Let D11 LED show STATUS0 */ | 496 | /* Let D11 LED show STATUS0 */ |
486 | gpio_request(GPIO_FN_STATUS0, NULL); | 497 | gpio_request(GPIO_FN_STATUS0, NULL); |