/*1* arch/sh/kernel/cpu/sh5/probe.c2*3* CPU Subtype Probing for SH-5.4*5* Copyright (C) 2000, 2001 Paolo Alberelli6* Copyright (C) 2003 - 2007 Paul Mundt7*8* This file is subject to the terms and conditions of the GNU General Public9* License. See the file "COPYING" in the main directory of this archive10* for more details.11*/12#include <linux/init.h>13#include <linux/io.h>14#include <linux/string.h>15#include <asm/processor.h>16#include <asm/cache.h>17#include <asm/tlb.h>1819void __cpuinit cpu_probe(void)20{21unsigned long long cir;2223/*24* Do peeks in real mode to avoid having to set up a mapping for25* the WPC registers. On SH5-101 cut2, such a mapping would be26* exposed to an address translation erratum which would make it27* hard to set up correctly.28*/29cir = peek_real_address_q(0x0d000008);30if ((cir & 0xffff) == 0x5103)31boot_cpu_data.type = CPU_SH5_103;32else if (((cir >> 32) & 0xffff) == 0x51e2)33/* CPU.VCR aliased at CIR address on SH5-101 */34boot_cpu_data.type = CPU_SH5_101;3536boot_cpu_data.family = CPU_FAMILY_SH5;3738/*39* First, setup some sane values for the I-cache.40*/41boot_cpu_data.icache.ways = 4;42boot_cpu_data.icache.sets = 256;43boot_cpu_data.icache.linesz = L1_CACHE_BYTES;44boot_cpu_data.icache.way_incr = (1 << 13);45boot_cpu_data.icache.entry_shift = 5;46boot_cpu_data.icache.way_size = boot_cpu_data.icache.sets *47boot_cpu_data.icache.linesz;48boot_cpu_data.icache.entry_mask = 0x1fe0;49boot_cpu_data.icache.flags = 0;5051/*52* Next, setup some sane values for the D-cache.53*54* On the SH5, these are pretty consistent with the I-cache settings,55* so we just copy over the existing definitions.. these can be fixed56* up later, especially if we add runtime CPU probing.57*58* Though in the meantime it saves us from having to duplicate all of59* the above definitions..60*/61boot_cpu_data.dcache = boot_cpu_data.icache;6263/*64* Setup any cache-related flags here65*/66#if defined(CONFIG_CACHE_WRITETHROUGH)67set_bit(SH_CACHE_MODE_WT, &(boot_cpu_data.dcache.flags));68#elif defined(CONFIG_CACHE_WRITEBACK)69set_bit(SH_CACHE_MODE_WB, &(boot_cpu_data.dcache.flags));70#endif7172/* Setup some I/D TLB defaults */73sh64_tlb_init();74}757677