ARM: shmobile: Remove FSF address from copyright headers
[cascardo/linux.git] / arch / arm / mach-shmobile / sleep-sh7372.S
1 /*
2  * sh7372 lowlevel sleep code for "Core Standby Mode"
3  *
4  * Copyright (C) 2011 Magnus Damm
5  *
6  * In "Core Standby Mode" the ARM core is off, but L2 cache is still on
7  *
8  * Based on mach-omap2/sleep34xx.S
9  *
10  * (C) Copyright 2007 Texas Instruments
11  * Karthik Dasu <karthik-dp@ti.com>
12  *
13  * (C) Copyright 2004 Texas Instruments, <www.ti.com>
14  * Richard Woodruff <r-woodruff2@ti.com>
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License as
18  * published by the Free Software Foundation; either version 2 of
19  * the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE.  See the
24  * GNU General Public License for more details.
25  */
26
27 #include <linux/linkage.h>
28 #include <linux/init.h>
29 #include <asm/memory.h>
30 #include <asm/assembler.h>
31
32 #if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
33         .align  12
34         .text
35         .global sh7372_resume_core_standby_sysc
36 sh7372_resume_core_standby_sysc:
37         ldr     pc, 1f
38
39         .align  2
40         .globl  sh7372_cpu_resume
41 sh7372_cpu_resume:
42 1:      .space  4
43
44 #define SPDCR 0xe6180008
45
46         /* A3SM & A4S power down */
47         .global sh7372_do_idle_sysc
48 sh7372_do_idle_sysc:
49         mov     r8, r0 /* sleep mode passed in r0 */
50
51         /*
52          * Clear the SCTLR.C bit to prevent further data cache
53          * allocation. Clearing SCTLR.C would make all the data accesses
54          * strongly ordered and would not hit the cache.
55          */
56         mrc     p15, 0, r0, c1, c0, 0
57         bic     r0, r0, #(1 << 2)       @ Disable the C bit
58         mcr     p15, 0, r0, c1, c0, 0
59         isb
60
61         /*
62          * Clean and invalidate data cache again.
63          */
64         ldr     r1, kernel_flush
65         blx     r1
66
67         /* disable L2 cache in the aux control register */
68         mrc     p15, 0, r10, c1, c0, 1
69         bic     r10, r10, #2
70         mcr     p15, 0, r10, c1, c0, 1
71         isb
72
73         /*
74          * The kernel doesn't interwork: v7_flush_dcache_all in particluar will
75          * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled.
76          * This sequence switches back to ARM.  Note that .align may insert a
77          * nop: bx pc needs to be word-aligned in order to work.
78          */
79  THUMB( .thumb          )
80  THUMB( .align          )
81  THUMB( bx      pc      )
82  THUMB( nop             )
83         .arm
84
85         /* Data memory barrier and Data sync barrier */
86         dsb
87         dmb
88
89         /* SYSC power down */
90         ldr     r0, =SPDCR
91         str     r8, [r0]
92 1:
93         b      1b
94
95         .align  2
96 kernel_flush:
97         .word v7_flush_dcache_all
98 #endif