1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Exynos low-level resume code
9 #include <linux/linkage.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/hardware/cache-l2x0.h>
14 #define CPU_MASK 0xff0ffff0
15 #define CPU_CORTEX_A9 0x410fc090
21 * sleep magic, to allow the bootloader to check for an valid
22 * image to resume to. Must be the first word before the
23 * exynos_cpu_resume entry.
31 * resume code entry for bootloader to call
34 ENTRY(exynos_cpu_resume)
35 #ifdef CONFIG_CACHE_L2X0
36 mrc p15, 0, r0, c0, c0, 0
39 ldr r1, =CPU_CORTEX_A9
41 bleq l2c310_early_resume
44 ENDPROC(exynos_cpu_resume)
49 ENTRY(exynos_cpu_resume_ns)
50 mrc p15, 0, r0, c0, c0, 0
53 ldr r1, =CPU_CORTEX_A9
57 adr r0, _cp15_save_power
60 adr r0, _cp15_save_diag
63 mov r0, #SMC_CMD_C15RESUME
66 #ifdef CONFIG_CACHE_L2X0
71 /* Check that the address has been initialised. */
72 ldr r1, [r0, #L2X0_R_PHY_BASE]
76 /* Check if controller has been enabled. */
77 ldr r2, [r1, #L2X0_CTRL]
81 ldr r1, [r0, #L2X0_R_TAG_LATENCY]
82 ldr r2, [r0, #L2X0_R_DATA_LATENCY]
83 ldr r3, [r0, #L2X0_R_PREFETCH_CTRL]
84 mov r0, #SMC_CMD_L2X0SETUP1
87 /* Reload saved regs pointer because smc corrupts registers. */
92 ldr r1, [r0, #L2X0_R_PWR_CTRL]
93 ldr r2, [r0, #L2X0_R_AUX_CTRL]
94 mov r0, #SMC_CMD_L2X0SETUP2
97 mov r0, #SMC_CMD_L2X0INVALL
101 mov r0, #SMC_CMD_L2X0CTRL
104 #endif /* CONFIG_CACHE_L2X0 */
107 ENDPROC(exynos_cpu_resume_ns)
111 .long cp15_save_power - .
113 .long cp15_save_diag - .
114 #ifdef CONFIG_CACHE_L2X0
115 1: .long l2x0_saved_regs - .
116 #endif /* CONFIG_CACHE_L2X0 */
120 .globl cp15_save_diag
122 .long 0 @ cp15 diagnostic
123 .globl cp15_save_power
125 .long 0 @ cp15 power control