2 * arch/arm/mach-tegra/sleep.S
4 * Copyright (c) 2010-2011, NVIDIA Corporation.
5 * Copyright (c) 2011, Google, Inc.
7 * Author: Colin Cross <ccross@android.com>
8 * Gary King <gking@nvidia.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <linux/linkage.h>
27 #include <asm/assembler.h>
28 #include <asm/cache.h>
30 #include <asm/hardware/cache-l2x0.h>
37 #ifdef CONFIG_PM_SLEEP
39 * tegra_disable_clean_inv_dcache
41 * disable, clean & invalidate the D-cache
43 * Corrupted registers: r1-r3, r6, r8, r9-r11
45 ENTRY(tegra_disable_clean_inv_dcache)
46 stmfd sp!, {r0, r4-r5, r7, r9-r11, lr}
49 /* Disable the D-cache */
50 mrc p15, 0, r2, c1, c0, 0
52 mcr p15, 0, r2, c1, c0, 0
55 /* Flush the D-cache */
56 bl v7_flush_dcache_louis
58 /* Trun off coherency */
61 ldmfd sp!, {r0, r4-r5, r7, r9-r11, pc}
62 ENDPROC(tegra_disable_clean_inv_dcache)
65 * tegra_sleep_cpu_finish(unsigned long v2p)
67 * enters suspend in LP2 by turning off the mmu and jumping to
68 * tegra?_tear_down_cpu
70 ENTRY(tegra_sleep_cpu_finish)
71 /* Flush and disable the L1 data cache */
72 bl tegra_disable_clean_inv_dcache
74 mov32 r6, tegra_tear_down_cpu
78 mov32 r3, tegra_shut_off_mmu
83 ENDPROC(tegra_sleep_cpu_finish)
88 * r0 = physical address to jump to with mmu off
90 * called with VA=PA mapping
91 * turns off MMU, icache, dcache and branch prediction
94 .pushsection .idmap.text, "ax"
95 ENTRY(tegra_shut_off_mmu)
96 mrc p15, 0, r3, c1, c0, 0
97 movw r2, #CR_I | CR_Z | CR_C | CR_M
100 mcr p15, 0, r3, c1, c0, 0
102 #ifdef CONFIG_CACHE_L2X0
103 /* Disable L2 cache */
104 mov32 r4, TEGRA_ARM_PERIF_BASE + 0x3000
106 str r5, [r4, #L2X0_CTRL]
109 ENDPROC(tegra_shut_off_mmu)