]> Pileus Git - ~andy/linux/blob - arch/arm/plat-s3c24xx/sleep.S
ARM: pm: convert cpu_suspend() to a normal function
[~andy/linux] / arch / arm / plat-s3c24xx / sleep.S
1 /* linux/arch/arm/plat-s3c24xx/sleep.S
2  *
3  * Copyright (c) 2004 Simtec Electronics
4  *      Ben Dooks <ben@simtec.co.uk>
5  *
6  * S3C2410 Power Manager (Suspend-To-RAM) support
7  *
8  * Based on PXA/SA1100 sleep code by:
9  *      Nicolas Pitre, (c) 2002 Monta Vista Software Inc
10  *      Cliff Brake, (c) 2001
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25 */
26
27 #include <linux/linkage.h>
28 #include <asm/assembler.h>
29 #include <mach/hardware.h>
30 #include <mach/map.h>
31
32 #include <mach/regs-gpio.h>
33 #include <mach/regs-clock.h>
34 #include <mach/regs-mem.h>
35 #include <plat/regs-serial.h>
36
37 /* CONFIG_DEBUG_RESUME is dangerous if your bootloader does not
38  * reset the UART configuration, only enable if you really need this!
39 */
40 //#define CONFIG_DEBUG_RESUME
41
42         .text
43
44         /* s3c_cpu_save
45          *
46          * entry:
47          *      r1 = v:p offset
48         */
49
50 ENTRY(s3c_cpu_save)
51         stmfd   sp!, { r4 - r12, lr }
52         adr     r3, BSYM(s3c24xx_finish_suspend)
53         bl      cpu_suspend
54         ldmfd   sp!, { r4 - r12, pc }
55
56 s3c24xx_finish_suspend:
57         @@ jump to final code to send system to sleep
58         ldr     r0, =pm_cpu_sleep
59         @@ldr   pc, [ r0 ]
60         ldr     r0, [ r0 ]
61         mov     pc, r0
62         
63         .ltorg
64
65         /* sleep magic, to allow the bootloader to check for an valid
66          * image to resume to. Must be the first word before the
67          * s3c_cpu_resume entry.
68         */
69
70         .word   0x2bedf00d
71
72         /* s3c_cpu_resume
73          *
74          * resume code entry for bootloader to call
75         */
76
77 ENTRY(s3c_cpu_resume)
78         mov     r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
79         msr     cpsr_c, r0
80
81         @@ load UART to allow us to print the two characters for
82         @@ resume debug
83
84         mov     r2, #S3C24XX_PA_UART & 0xff000000
85         orr     r2, r2, #S3C24XX_PA_UART & 0xff000
86
87 #if 0
88         /* SMDK2440 LED set */
89         mov     r14, #S3C24XX_PA_GPIO
90         ldr     r12, [ r14, #0x54 ]
91         bic     r12, r12, #3<<4
92         orr     r12, r12, #1<<7
93         str     r12, [ r14, #0x54 ]
94 #endif
95
96 #ifdef CONFIG_DEBUG_RESUME
97         mov     r3, #'L'
98         strb    r3, [ r2, #S3C2410_UTXH ]
99 1001:
100         ldrb    r14, [ r3, #S3C2410_UTRSTAT ]
101         tst     r14, #S3C2410_UTRSTAT_TXE
102         beq     1001b
103 #endif /* CONFIG_DEBUG_RESUME */
104
105         b       cpu_resume