1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_ENTRY_H
5 #define __ASM_CSKY_ENTRY_H
8 #include <abi/regdef.h>
22 .macro SAVE_ALL epc_inc
54 #ifdef CONFIG_CPU_HAS_HILO
78 #ifdef CONFIG_CPU_HAS_HILO
103 .macro SAVE_SWITCH_STACK
114 #ifdef CONFIG_CPU_HAS_HILO
125 .macro RESTORE_SWITCH_STACK
126 #ifdef CONFIG_CPU_HAS_HILO
147 /* MMU registers operators. */
177 /* Init psr and enable ee */
178 lrw r6
, DEFAULT_PSR_VALUE
182 /* Invalid I/Dcache BTB BHT */
188 /* Invalid all TLB */
190 mtcr r6
, cr
<8, 15> /* Set MCIR */
192 /* Check MMU on/off */
197 /* MMU off: setup mapping tlb entry */
199 mtcr r6
, cr
<6, 15> /* Set MPR with 4K page size */
201 grs r6
, 1f
/* Get current pa by PC */
202 bmaski r7
, (PAGE_SHIFT
+ 1) /* r7 = 0x1fff */
204 mtcr r6
, cr
<4, 15> /* Set MEH */
209 mtcr r8
, cr
<2, 15> /* Set MEL0 */
212 mtcr r8
, cr
<3, 15> /* Set MEL1 */
215 mtcr r8
, cr
<8, 15> /* Set MCIR to write TLB */
220 * MMU on: use origin MSA value from bootloader
222 * cr<30/31, 15> MSA register format:
223 * 31 - 29 | 28 - 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
224 * BA Reserved SH WA B SO SEC C D V
226 mfcr r6
, cr
<30, 15> /* Get MSA0 */
231 mtcr r6
, cr
<30, 15> /* Set MSA0 */
237 mtcr r6
, cr
<31, 15> /* Set MSA1 */
244 jmpi
3f
/* jump to va */
248 .macro ANDI_R3 rx
, imm
250 andi
\rx
, (\imm
>> 3)
252 #endif /* __ASM_CSKY_ENTRY_H */