]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - arch/cris/arch-v32/mm/l2cache.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-hirsute-kernel.git] / arch / cris / arch-v32 / mm / l2cache.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/init.h>
3 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <memmap.h>
6 #include <hwregs/reg_map.h>
7 #include <hwregs/reg_rdwr.h>
8 #include <hwregs/l2cache_defs.h>
9 #include <asm/io.h>
10
11 #define L2CACHE_SIZE 64
12
13 int __init l2cache_init(void)
14 {
15 reg_l2cache_rw_ctrl ctrl = {0};
16 reg_l2cache_rw_cfg cfg = {.en = regk_l2cache_yes};
17
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);
21
22 /* Flush the tag memory */
23 memset((void *)(MEM_INTMEM_START | MEM_NON_CACHEABLE), 0, 2*1024);
24
25 /* Enable the cache */
26 REG_WR(l2cache, regi_l2cache, rw_cfg, cfg);
27
28 return 0;
29 }
30