1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Andes Technology Corporation
4 * Rick Chen, Andes Technology Corporation <rick@andestech.com>
9 void icache_enable(void)
11 #ifndef CONFIG_SYS_ICACHE_OFF
12 #ifdef CONFIG_RISCV_NDS
14 "csrr t1, mcache_ctl\n\t"
16 "csrw mcache_ctl, t0\n\t"
22 void icache_disable(void)
24 #ifndef CONFIG_SYS_ICACHE_OFF
25 #ifdef CONFIG_RISCV_NDS
28 "csrr t1, mcache_ctl\n\t"
29 "andi t0, t1, ~0x1\n\t"
30 "csrw mcache_ctl, t0\n\t"
36 void dcache_enable(void)
38 #ifndef CONFIG_SYS_DCACHE_OFF
39 #ifdef CONFIG_RISCV_NDS
41 "csrr t1, mcache_ctl\n\t"
43 "csrw mcache_ctl, t0\n\t"
49 void dcache_disable(void)
51 #ifndef CONFIG_SYS_DCACHE_OFF
52 #ifdef CONFIG_RISCV_NDS
55 "csrr t1, mcache_ctl\n\t"
56 "andi t0, t1, ~0x2\n\t"
57 "csrw mcache_ctl, t0\n\t"
63 int icache_status(void)
67 #ifdef CONFIG_RISCV_NDS
69 "csrr t1, mcache_ctl\n\t"
70 "andi %0, t1, 0x01\n\t"
80 int dcache_status(void)
84 #ifdef CONFIG_RISCV_NDS
86 "csrr t1, mcache_ctl\n\t"
87 "andi %0, t1, 0x02\n\t"