From a81b46c6ec4189d5bab8c0dff0057f19f83effd0 Mon Sep 17 00:00:00 2001 From: Jesper Nilsson Date: Thu, 29 Nov 2007 17:24:10 +0100 Subject: [PATCH] --- yaml --- r: 84912 b: refs/heads/master c: f74c31d50c3c568abf315f9b8b206a4ec7b9c9f6 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/cris/arch-v32/mm/l2cache.c | 29 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 trunk/arch/cris/arch-v32/mm/l2cache.c diff --git a/[refs] b/[refs] index 9f32cee7511c..0442b7cff7f6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 58d083192825c5fbd46fa0b1ff4d1ecc9118b692 +refs/heads/master: f74c31d50c3c568abf315f9b8b206a4ec7b9c9f6 diff --git a/trunk/arch/cris/arch-v32/mm/l2cache.c b/trunk/arch/cris/arch-v32/mm/l2cache.c new file mode 100644 index 000000000000..332ff10dcc6b --- /dev/null +++ b/trunk/arch/cris/arch-v32/mm/l2cache.c @@ -0,0 +1,29 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#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; +} +