blob: 67b9c48dcafe7dc1ee281c49ece9de88338297f4 [file] [log] [blame]
Shawn Guo69c31b72011-09-06 14:59:40 +08001/*
2 * Copyright 2011 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/linkage.h>
14#include <linux/init.h>
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080015#include <asm/asm-offsets.h>
Shawn Guo69c31b72011-09-06 14:59:40 +080016#include <asm/hardware/cache-l2x0.h>
17
18 .section ".text.head", "ax"
Shawn Guo69c31b72011-09-06 14:59:40 +080019
Shawn Guo69c31b72011-09-06 14:59:40 +080020#ifdef CONFIG_SMP
21ENTRY(v7_secondary_startup)
22 bl v7_invalidate_l1
23 b secondary_startup
24ENDPROC(v7_secondary_startup)
25#endif
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080026
Arnd Bergmanncb483892013-04-30 17:57:00 +020027#ifdef CONFIG_ARM_CPU_SUSPEND
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080028/*
Nicolas Pitreb4e61532013-02-18 23:11:30 -050029 * The following code must assume it is running from physical address
30 * where absolute virtual addresses to the data section have to be
31 * turned into relative ones.
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080032 */
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080033
Eric Miao733d1722011-12-22 11:55:01 +080034#ifdef CONFIG_CACHE_L2X0
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080035 .macro pl310_resume
Nicolas Pitreb4e61532013-02-18 23:11:30 -050036 adr r0, l2x0_saved_regs_offset
37 ldr r2, [r0]
38 add r2, r2, r0
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080039 ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
40 ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
41 str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
42 mov r1, #0x1
43 str r1, [r0, #L2X0_CTRL] @ re-enable L2
44 .endm
45
Nicolas Pitreb4e61532013-02-18 23:11:30 -050046l2x0_saved_regs_offset:
47 .word l2x0_saved_regs - .
48
Eric Miao733d1722011-12-22 11:55:01 +080049#else
50 .macro pl310_resume
51 .endm
52#endif
53
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080054ENTRY(v7_cpu_resume)
55 bl v7_invalidate_l1
56 pl310_resume
57 b cpu_resume
58ENDPROC(v7_cpu_resume)
Eric Miao46ec1b22011-12-21 22:38:23 +080059#endif