^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Tony Xie <tony.xie@rock-chips.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <asm/assembler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/memory.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) .data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * this code will be copied from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * ddr to sram for system resumeing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * so it is ".data section".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) .align 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ENTRY(rockchip_slp_cpu_resume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set svc, irqs off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) mrc p15, 0, r1, c0, c0, 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) and r1, r1, #0xf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) cmp r1, #0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* olny cpu0 can continue to run, the others is halt here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) beq cpu0run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) secondary_loop:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) wfe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) b secondary_loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) cpu0run:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) ldr r3, rkpm_bootdata_l2ctlr_f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) cmp r3, #0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) beq sp_set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ldr r3, rkpm_bootdata_l2ctlr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) mcr p15, 1, r3, c9, c0, 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) sp_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ldr sp, rkpm_bootdata_cpusp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ldr r1, rkpm_bootdata_cpu_code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) bx r1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ENDPROC(rockchip_slp_cpu_resume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* Parameters filled in by the kernel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* Flag for whether to restore L2CTLR on resume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .global rkpm_bootdata_l2ctlr_f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) rkpm_bootdata_l2ctlr_f:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .long 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* Saved L2CTLR to restore on resume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .global rkpm_bootdata_l2ctlr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) rkpm_bootdata_l2ctlr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .long 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* CPU resume SP addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .globl rkpm_bootdata_cpusp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) rkpm_bootdata_cpusp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .long 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* CPU resume function (physical address) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .globl rkpm_bootdata_cpu_code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) rkpm_bootdata_cpu_code:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .long 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) ENTRY(rk3288_bootram_sz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .word . - rockchip_slp_cpu_resume