Path: blob/master/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
15126 views
/*1* Support for MicroBlaze PVR (processor version register)2*3* Copyright (C) 2007-2009 Michal Simek <[email protected]>4* Copyright (C) 2007-2009 PetaLogix5* Copyright (C) 2007 John Williams <[email protected]>6*7* This file is subject to the terms and conditions of the GNU General Public8* License. See the file "COPYING" in the main directory of this archive9* for more details.10*/1112#include <linux/init.h>13#include <linux/string.h>14#include <asm/pvr.h>15#include <asm/cpuinfo.h>1617/*18* Helper macro to map between fields in our struct cpuinfo, and19* the PVR macros in pvr.h.20*/2122#define CI(c, p) { ci->c = PVR_##p(pvr); }2324#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_SERIAL_UARTLITE_CONSOLE)25#define err_printk(x) \26early_printk("ERROR: Microblaze " x "-different for PVR and DTS\n");27#else28#define err_printk(x) \29printk(KERN_INFO "ERROR: Microblaze " x "-different for PVR and DTS\n");30#endif3132void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)33{34struct pvr_s pvr;35int temp; /* for saving temp value */36get_pvr(&pvr);3738CI(ver_code, VERSION);39if (!ci->ver_code) {40printk(KERN_ERR "ERROR: MB has broken PVR regs "41"-> use DTS setting\n");42return;43}4445temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) |\46PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr);47if (ci->use_instr != temp)48err_printk("BARREL, MSR, PCMP or DIV");49ci->use_instr = temp;5051temp = PVR_USE_HW_MUL(pvr) | PVR_USE_MUL64(pvr);52if (ci->use_mult != temp)53err_printk("HW_MUL");54ci->use_mult = temp;5556temp = PVR_USE_FPU(pvr) | PVR_USE_FPU2(pvr);57if (ci->use_fpu != temp)58err_printk("HW_FPU");59ci->use_fpu = temp;6061ci->use_exc = PVR_OPCODE_0x0_ILLEGAL(pvr) |\62PVR_UNALIGNED_EXCEPTION(pvr) |\63PVR_ILL_OPCODE_EXCEPTION(pvr) |\64PVR_IOPB_BUS_EXCEPTION(pvr) |\65PVR_DOPB_BUS_EXCEPTION(pvr) |\66PVR_DIV_ZERO_EXCEPTION(pvr) |\67PVR_FPU_EXCEPTION(pvr) |\68PVR_FSL_EXCEPTION(pvr);6970CI(pvr_user1, USER1);71CI(pvr_user2, USER2);7273CI(mmu, USE_MMU);74CI(endian, ENDIAN);7576CI(use_icache, USE_ICACHE);77CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);78CI(icache_write, ICACHE_ALLOW_WR);79ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2;80CI(icache_size, ICACHE_BYTE_SIZE);81CI(icache_base, ICACHE_BASEADDR);82CI(icache_high, ICACHE_HIGHADDR);8384CI(use_dcache, USE_DCACHE);85CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);86CI(dcache_write, DCACHE_ALLOW_WR);87ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2;88CI(dcache_size, DCACHE_BYTE_SIZE);89CI(dcache_base, DCACHE_BASEADDR);90CI(dcache_high, DCACHE_HIGHADDR);9192temp = PVR_DCACHE_USE_WRITEBACK(pvr);93if (ci->dcache_wb != temp)94err_printk("DCACHE WB");95ci->dcache_wb = temp;9697CI(use_dopb, D_OPB);98CI(use_iopb, I_OPB);99CI(use_dlmb, D_LMB);100CI(use_ilmb, I_LMB);101CI(num_fsl, FSL_LINKS);102103CI(irq_edge, INTERRUPT_IS_EDGE);104CI(irq_positive, EDGE_IS_POSITIVE);105106CI(area_optimised, AREA_OPTIMISED);107108CI(hw_debug, DEBUG_ENABLED);109CI(num_pc_brk, NUMBER_OF_PC_BRK);110CI(num_rd_brk, NUMBER_OF_RD_ADDR_BRK);111CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);112113CI(fpga_family_code, TARGET_FAMILY);114115/* take timebase-frequency from DTS */116ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");117}118119120