Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36240
b: refs/heads/master
c: b638d0b
h: refs/heads/master
v: v3
  • Loading branch information
Richard Curnow authored and Paul Mundt committed Sep 27, 2006
1 parent afa4c25 commit 53a84f0
Show file tree
Hide file tree
Showing 6 changed files with 476 additions and 191 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fdfc74f9fcebdda14609159d5010b758a9409acf
refs/heads/master: b638d0b921dc95229af0dfd09cd24850336a2f75
16 changes: 15 additions & 1 deletion trunk/arch/sh/kernel/cpu/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* CPU init code
*
* Copyright (C) 2002, 2003 Paul Mundt
* Copyright (C) 2003 Richard Curnow
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
Expand Down Expand Up @@ -51,7 +52,15 @@ static void __init cache_init(void)
ccr = ctrl_inl(CCR);

/*
* If the cache is already enabled .. flush it.
* At this point we don't know whether the cache is enabled or not - a
* bootloader may have enabled it. There are at least 2 things that
* could be dirty in the cache at this point:
* 1. kernel command line set up by boot loader
* 2. spilled registers from the prolog of this function
* => before re-initialising the cache, we must do a purge of the whole
* cache out to memory for safety. As long as nothing is spilled
* during the loop to lines that have already been done, this is safe.
* - RPC
*/
if (ccr & CCR_CACHE_ENABLE) {
unsigned long ways, waysize, addrstart;
Expand Down Expand Up @@ -98,6 +107,8 @@ static void __init cache_init(void)
/* Force EMODE if possible */
if (cpu_data->dcache.ways > 1)
flags |= CCR_CACHE_EMODE;
else
flags &= ~CCR_CACHE_EMODE;
#endif

#ifdef CONFIG_SH_WRITETHROUGH
Expand All @@ -112,6 +123,9 @@ static void __init cache_init(void)
/* Turn on OCRAM -- halve the OC */
flags |= CCR_CACHE_ORA;
cpu_data->dcache.sets >>= 1;

cpu_data->dcache.way_size = cpu_data->dcache.sets *
cpu_data->dcache.linesz;
#endif

ctrl_outl(flags, CCR);
Expand Down
11 changes: 11 additions & 0 deletions trunk/arch/sh/kernel/cpu/sh4/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ int __init detect_cpu_and_cache_system(void)
break;
}

#ifdef CONFIG_SH_DIRECT_MAPPED
cpu_data->icache.ways = 1;
cpu_data->dcache.ways = 1;
#endif

/*
* On anything that's not a direct-mapped cache, look to the CVR
* for I/D-cache specifics.
Expand All @@ -125,6 +130,9 @@ int __init detect_cpu_and_cache_system(void)
(cpu_data->icache.way_incr - (1 << 5));
}

cpu_data->icache.way_size = cpu_data->icache.sets *
cpu_data->icache.linesz;

if (cpu_data->dcache.ways > 1) {
size = sizes[(cvr >> 16) & 0xf];
cpu_data->dcache.way_incr = (size >> 1);
Expand All @@ -133,6 +141,9 @@ int __init detect_cpu_and_cache_system(void)
(cpu_data->dcache.way_incr - (1 << 5));
}

cpu_data->dcache.way_size = cpu_data->dcache.sets *
cpu_data->dcache.linesz;

return 0;
}

Loading

0 comments on commit 53a84f0

Please sign in to comment.