/* * 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 * for more details. * * Copyright (C) 2011-2012 by Broadcom Corporation * * Init for bmips 5000. * Used to init second core in dual core 5000's. */ #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_CPU_BMIPS5000 #define cacheop(kva, size, linesize, op) \ .set noreorder ; \ addu t1, kva, size ; \ subu t2, linesize, 1 ; \ not t2 ; \ and t0, kva, t2 ; \ addiu t1, t1, -1 ; \ and t1, t2 ; \ 9: cache op, 0(t0) ; \ bne t0, t1, 9b ; \ addu t0, linesize ; \ .set reorder ; #define IS_SHIFT 22 #define IL_SHIFT 19 #define IA_SHIFT 16 #define DS_SHIFT 13 #define DL_SHIFT 10 #define DA_SHIFT 7 #define IS_MASK 7 #define IL_MASK 7 #define IA_MASK 7 #define DS_MASK 7 #define DL_MASK 7 #define DA_MASK 7 #define ICE_MASK 0x80000000 #define DCE_MASK 0x40000000 #define CP0_BRCM_CONFIG0 $22, 0 #define CP0_BRCM_MODE $22, 1 #define CP0_CONFIG_K0_MASK 7 #define CP0_ICACHE_TAG_LO $28 #define CP0_ICACHE_DATA_LO $28, 1 #define CP0_DCACHE_TAG_LO $28, 2 #define CP0_D_SEC_CACHE_DATA_LO $28, 3 #define CP0_ICACHE_TAG_HI $29 #define CP0_ICACHE_DATA_HI $29, 1 #define CP0_DCACHE_TAG_HI $29, 2 #define CP0_BRCM_MODE_Luc_MASK (1 << 11) #define CP0_BRCM_CONFIG0_CWF_MASK (1 << 20) #define CP0_BRCM_CONFIG0_TSE_MASK (1 << 19) #define CP0_BRCM_MODE_SET_MASK (1 << 7) #define CP0_BRCM_MODE_ClkRATIO_MASK (7 << 4) #define CP0_BRCM_MODE_BrPRED_MASK (3 << 24) #define CP0_BRCM_MODE_BrPRED_SHIFT 24 #define CP0_BRCM_MODE_BrHIST_MASK (0x1f << 20) #define CP0_BRCM_MODE_BrHIST_SHIFT 20 /* ZSC L2 Cache Register Access Register Definitions */ #define BRCM_ZSC_ALL_REGS_SELECT 0x7 << 24 #define BRCM_ZSC_CONFIG_REG 0 << 3 #define BRCM_ZSC_REQ_BUFFER_REG 2 << 3 #define BRCM_ZSC_RBUS_ADDR_MAPPING_REG0 4 << 3 #define BRCM_ZSC_RBUS_ADDR_MAPPING_REG1 6 << 3 #define BRCM_ZSC_RBUS_ADDR_MAPPING_REG2 8 << 3 #define BRCM_ZSC_SCB0_ADDR_MAPPING_REG0 0xa << 3 #define BRCM_ZSC_SCB0_ADDR_MAPPING_REG1 0xc << 3 #define BRCM_ZSC_SCB1_ADDR_MAPPING_REG0 0xe << 3 #define BRCM_ZSC_SCB1_ADDR_MAPPING_REG1 0x10 << 3 #define BRCM_ZSC_CONFIG_LMB1En 1 << (15) #define BRCM_ZSC_CONFIG_LMB0En 1 << (14) /* branch predition values */ #define BRCM_BrPRED_ALL_TAKEN (0x0) #define BRCM_BrPRED_ALL_NOT_TAKEN (0x1) #define BRCM_BrPRED_BHT_ENABLE (0x2) #define BRCM_BrPRED_PREDICT_BACKWARD (0x3) .align 2 /* * Function: size_i_cache * Arguments: None * Returns: v0 = i cache size, v1 = I cache line size * Description: compute the I-cache size and I-cache line size * Trashes: v0, v1, a0, t0 * * pseudo code: * */ LEAF(size_i_cache) .set noreorder mfc0 a0, CP0_CONFIG, 1 move t0, a0 /* * Determine sets per way: IS * * This field contains the number of sets (i.e., indices) per way of * the instruction cache: * i) 0x0: 64, ii) 0x1: 128, iii) 0x2: 256, iv) 0x3: 512, v) 0x4: 1k * vi) 0x5 - 0x7: Reserved. */ srl a0, a0, IS_SHIFT and a0, a0, IS_MASK /* sets per way = (64<