Skip to content

Commit

Permalink
CRIS v32: Add L2 cache initialization code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesper Nilsson authored and Jesper Nilsson committed Feb 8, 2008
1 parent 58d0831 commit f74c31d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions arch/cris/arch-v32/mm/l2cache.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <memmap.h>
#include <hwregs/reg_map.h>
#include <hwregs/reg_rdwr.h>
#include <hwregs/l2cache_defs.h>
#include <asm/io.h>

#define L2CACHE_SIZE 64

int __init l2cache_init(void)
{
reg_l2cache_rw_ctrl ctrl = {0};
reg_l2cache_rw_cfg cfg = {.en = regk_l2cache_yes};

ctrl.csize = L2CACHE_SIZE;
ctrl.cbase = L2CACHE_SIZE / 4 + (L2CACHE_SIZE % 4 ? 1 : 0);
REG_WR(l2cache, regi_l2cache, rw_ctrl, ctrl);

/* Flush the tag memory */
memset((void *)(MEM_INTMEM_START | MEM_NON_CACHEABLE), 0, 2*1024);

/* Enable the cache */
REG_WR(l2cache, regi_l2cache, rw_cfg, cfg);

return 0;
}

0 comments on commit f74c31d

Please sign in to comment.