1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/init.h>
3 #include <linux/kernel.h>
4 #include <linux/string.h>
6 #include <hwregs/reg_map.h>
7 #include <hwregs/reg_rdwr.h>
8 #include <hwregs/l2cache_defs.h>
11 #define L2CACHE_SIZE 64
13 int __init
l2cache_init(void)
15 reg_l2cache_rw_ctrl ctrl
= {0};
16 reg_l2cache_rw_cfg cfg
= {.en
= regk_l2cache_yes
};
18 ctrl
.csize
= L2CACHE_SIZE
;
19 ctrl
.cbase
= L2CACHE_SIZE
/ 4 + (L2CACHE_SIZE
% 4 ? 1 : 0);
20 REG_WR(l2cache
, regi_l2cache
, rw_ctrl
, ctrl
);
22 /* Flush the tag memory */
23 memset((void *)(MEM_INTMEM_START
| MEM_NON_CACHEABLE
), 0, 2*1024);
25 /* Enable the cache */
26 REG_WR(l2cache
, regi_l2cache
, rw_cfg
, cfg
);