18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> 78c2ecf20Sopenharmony_ci * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/kernel.h> 118c2ecf20Sopenharmony_ci#include <linux/export.h> 128c2ecf20Sopenharmony_ci#include <linux/cpu.h> 138c2ecf20Sopenharmony_ci#include <asm/cpu.h> 148c2ecf20Sopenharmony_ci#include <asm/cpu-info.h> 158c2ecf20Sopenharmony_ci#include <asm/mipsregs.h> 168c2ecf20Sopenharmony_ci#include <bcm63xx_cpu.h> 178c2ecf20Sopenharmony_ci#include <bcm63xx_regs.h> 188c2ecf20Sopenharmony_ci#include <bcm63xx_io.h> 198c2ecf20Sopenharmony_ci#include <bcm63xx_irq.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciconst unsigned long *bcm63xx_regs_base; 228c2ecf20Sopenharmony_ciEXPORT_SYMBOL(bcm63xx_regs_base); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciconst int *bcm63xx_irqs; 258c2ecf20Sopenharmony_ciEXPORT_SYMBOL(bcm63xx_irqs); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciu16 bcm63xx_cpu_id __read_mostly; 288c2ecf20Sopenharmony_ciEXPORT_SYMBOL(bcm63xx_cpu_id); 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic u8 bcm63xx_cpu_rev; 318c2ecf20Sopenharmony_cistatic unsigned int bcm63xx_cpu_freq; 328c2ecf20Sopenharmony_cistatic unsigned int bcm63xx_memory_size; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic const unsigned long bcm3368_regs_base[] = { 358c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(3368) 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic const int bcm3368_irqs[] = { 398c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(3368) 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistatic const unsigned long bcm6328_regs_base[] = { 438c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6328) 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic const int bcm6328_irqs[] = { 478c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6328) 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistatic const unsigned long bcm6338_regs_base[] = { 518c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6338) 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistatic const int bcm6338_irqs[] = { 558c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6338) 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cistatic const unsigned long bcm6345_regs_base[] = { 598c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6345) 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistatic const int bcm6345_irqs[] = { 638c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6345) 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistatic const unsigned long bcm6348_regs_base[] = { 678c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6348) 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistatic const int bcm6348_irqs[] = { 718c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6348) 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistatic const unsigned long bcm6358_regs_base[] = { 768c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6358) 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistatic const int bcm6358_irqs[] = { 808c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6358) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_cistatic const unsigned long bcm6362_regs_base[] = { 858c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6362) 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic const int bcm6362_irqs[] = { 898c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6362) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci}; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic const unsigned long bcm6368_regs_base[] = { 948c2ecf20Sopenharmony_ci __GEN_CPU_REGS_TABLE(6368) 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic const int bcm6368_irqs[] = { 988c2ecf20Sopenharmony_ci __GEN_CPU_IRQ_TABLE(6368) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ciu8 bcm63xx_get_cpu_rev(void) 1038c2ecf20Sopenharmony_ci{ 1048c2ecf20Sopenharmony_ci return bcm63xx_cpu_rev; 1058c2ecf20Sopenharmony_ci} 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciEXPORT_SYMBOL(bcm63xx_get_cpu_rev); 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciunsigned int bcm63xx_get_cpu_freq(void) 1108c2ecf20Sopenharmony_ci{ 1118c2ecf20Sopenharmony_ci return bcm63xx_cpu_freq; 1128c2ecf20Sopenharmony_ci} 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciunsigned int bcm63xx_get_memory_size(void) 1158c2ecf20Sopenharmony_ci{ 1168c2ecf20Sopenharmony_ci return bcm63xx_memory_size; 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistatic unsigned int detect_cpu_clock(void) 1208c2ecf20Sopenharmony_ci{ 1218c2ecf20Sopenharmony_ci u16 cpu_id = bcm63xx_get_cpu_id(); 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci switch (cpu_id) { 1248c2ecf20Sopenharmony_ci case BCM3368_CPU_ID: 1258c2ecf20Sopenharmony_ci return 300000000; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci case BCM6328_CPU_ID: 1288c2ecf20Sopenharmony_ci { 1298c2ecf20Sopenharmony_ci unsigned int tmp, mips_pll_fcvo; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci tmp = bcm_misc_readl(MISC_STRAPBUS_6328_REG); 1328c2ecf20Sopenharmony_ci mips_pll_fcvo = (tmp & STRAPBUS_6328_FCVO_MASK) 1338c2ecf20Sopenharmony_ci >> STRAPBUS_6328_FCVO_SHIFT; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci switch (mips_pll_fcvo) { 1368c2ecf20Sopenharmony_ci case 0x12: 1378c2ecf20Sopenharmony_ci case 0x14: 1388c2ecf20Sopenharmony_ci case 0x19: 1398c2ecf20Sopenharmony_ci return 160000000; 1408c2ecf20Sopenharmony_ci case 0x1c: 1418c2ecf20Sopenharmony_ci return 192000000; 1428c2ecf20Sopenharmony_ci case 0x13: 1438c2ecf20Sopenharmony_ci case 0x15: 1448c2ecf20Sopenharmony_ci return 200000000; 1458c2ecf20Sopenharmony_ci case 0x1a: 1468c2ecf20Sopenharmony_ci return 384000000; 1478c2ecf20Sopenharmony_ci case 0x16: 1488c2ecf20Sopenharmony_ci return 400000000; 1498c2ecf20Sopenharmony_ci default: 1508c2ecf20Sopenharmony_ci return 320000000; 1518c2ecf20Sopenharmony_ci } 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci } 1548c2ecf20Sopenharmony_ci case BCM6338_CPU_ID: 1558c2ecf20Sopenharmony_ci /* BCM6338 has a fixed 240 Mhz frequency */ 1568c2ecf20Sopenharmony_ci return 240000000; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci case BCM6345_CPU_ID: 1598c2ecf20Sopenharmony_ci /* BCM6345 has a fixed 140Mhz frequency */ 1608c2ecf20Sopenharmony_ci return 140000000; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci case BCM6348_CPU_ID: 1638c2ecf20Sopenharmony_ci { 1648c2ecf20Sopenharmony_ci unsigned int tmp, n1, n2, m1; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /* 16MHz * (N1 + 1) * (N2 + 2) / (M1_CPU + 1) */ 1678c2ecf20Sopenharmony_ci tmp = bcm_perf_readl(PERF_MIPSPLLCTL_REG); 1688c2ecf20Sopenharmony_ci n1 = (tmp & MIPSPLLCTL_N1_MASK) >> MIPSPLLCTL_N1_SHIFT; 1698c2ecf20Sopenharmony_ci n2 = (tmp & MIPSPLLCTL_N2_MASK) >> MIPSPLLCTL_N2_SHIFT; 1708c2ecf20Sopenharmony_ci m1 = (tmp & MIPSPLLCTL_M1CPU_MASK) >> MIPSPLLCTL_M1CPU_SHIFT; 1718c2ecf20Sopenharmony_ci n1 += 1; 1728c2ecf20Sopenharmony_ci n2 += 2; 1738c2ecf20Sopenharmony_ci m1 += 1; 1748c2ecf20Sopenharmony_ci return (16 * 1000000 * n1 * n2) / m1; 1758c2ecf20Sopenharmony_ci } 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci case BCM6358_CPU_ID: 1788c2ecf20Sopenharmony_ci { 1798c2ecf20Sopenharmony_ci unsigned int tmp, n1, n2, m1; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci /* 16MHz * N1 * N2 / M1_CPU */ 1828c2ecf20Sopenharmony_ci tmp = bcm_ddr_readl(DDR_DMIPSPLLCFG_REG); 1838c2ecf20Sopenharmony_ci n1 = (tmp & DMIPSPLLCFG_N1_MASK) >> DMIPSPLLCFG_N1_SHIFT; 1848c2ecf20Sopenharmony_ci n2 = (tmp & DMIPSPLLCFG_N2_MASK) >> DMIPSPLLCFG_N2_SHIFT; 1858c2ecf20Sopenharmony_ci m1 = (tmp & DMIPSPLLCFG_M1_MASK) >> DMIPSPLLCFG_M1_SHIFT; 1868c2ecf20Sopenharmony_ci return (16 * 1000000 * n1 * n2) / m1; 1878c2ecf20Sopenharmony_ci } 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci case BCM6362_CPU_ID: 1908c2ecf20Sopenharmony_ci { 1918c2ecf20Sopenharmony_ci unsigned int tmp, mips_pll_fcvo; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci tmp = bcm_misc_readl(MISC_STRAPBUS_6362_REG); 1948c2ecf20Sopenharmony_ci mips_pll_fcvo = (tmp & STRAPBUS_6362_FCVO_MASK) 1958c2ecf20Sopenharmony_ci >> STRAPBUS_6362_FCVO_SHIFT; 1968c2ecf20Sopenharmony_ci switch (mips_pll_fcvo) { 1978c2ecf20Sopenharmony_ci case 0x03: 1988c2ecf20Sopenharmony_ci case 0x0b: 1998c2ecf20Sopenharmony_ci case 0x13: 2008c2ecf20Sopenharmony_ci case 0x1b: 2018c2ecf20Sopenharmony_ci return 240000000; 2028c2ecf20Sopenharmony_ci case 0x04: 2038c2ecf20Sopenharmony_ci case 0x0c: 2048c2ecf20Sopenharmony_ci case 0x14: 2058c2ecf20Sopenharmony_ci case 0x1c: 2068c2ecf20Sopenharmony_ci return 160000000; 2078c2ecf20Sopenharmony_ci case 0x05: 2088c2ecf20Sopenharmony_ci case 0x0e: 2098c2ecf20Sopenharmony_ci case 0x16: 2108c2ecf20Sopenharmony_ci case 0x1e: 2118c2ecf20Sopenharmony_ci case 0x1f: 2128c2ecf20Sopenharmony_ci return 400000000; 2138c2ecf20Sopenharmony_ci case 0x06: 2148c2ecf20Sopenharmony_ci return 440000000; 2158c2ecf20Sopenharmony_ci case 0x07: 2168c2ecf20Sopenharmony_ci case 0x17: 2178c2ecf20Sopenharmony_ci return 384000000; 2188c2ecf20Sopenharmony_ci case 0x15: 2198c2ecf20Sopenharmony_ci case 0x1d: 2208c2ecf20Sopenharmony_ci return 200000000; 2218c2ecf20Sopenharmony_ci default: 2228c2ecf20Sopenharmony_ci return 320000000; 2238c2ecf20Sopenharmony_ci } 2248c2ecf20Sopenharmony_ci } 2258c2ecf20Sopenharmony_ci case BCM6368_CPU_ID: 2268c2ecf20Sopenharmony_ci { 2278c2ecf20Sopenharmony_ci unsigned int tmp, p1, p2, ndiv, m1; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci /* (64MHz / P1) * P2 * NDIV / M1_CPU */ 2308c2ecf20Sopenharmony_ci tmp = bcm_ddr_readl(DDR_DMIPSPLLCFG_6368_REG); 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci p1 = (tmp & DMIPSPLLCFG_6368_P1_MASK) >> 2338c2ecf20Sopenharmony_ci DMIPSPLLCFG_6368_P1_SHIFT; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci p2 = (tmp & DMIPSPLLCFG_6368_P2_MASK) >> 2368c2ecf20Sopenharmony_ci DMIPSPLLCFG_6368_P2_SHIFT; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci ndiv = (tmp & DMIPSPLLCFG_6368_NDIV_MASK) >> 2398c2ecf20Sopenharmony_ci DMIPSPLLCFG_6368_NDIV_SHIFT; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci tmp = bcm_ddr_readl(DDR_DMIPSPLLDIV_6368_REG); 2428c2ecf20Sopenharmony_ci m1 = (tmp & DMIPSPLLDIV_6368_MDIV_MASK) >> 2438c2ecf20Sopenharmony_ci DMIPSPLLDIV_6368_MDIV_SHIFT; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci return (((64 * 1000000) / p1) * p2 * ndiv) / m1; 2468c2ecf20Sopenharmony_ci } 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci default: 2498c2ecf20Sopenharmony_ci panic("Failed to detect clock for CPU with id=%04X\n", cpu_id); 2508c2ecf20Sopenharmony_ci } 2518c2ecf20Sopenharmony_ci} 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci/* 2548c2ecf20Sopenharmony_ci * attempt to detect the amount of memory installed 2558c2ecf20Sopenharmony_ci */ 2568c2ecf20Sopenharmony_cistatic unsigned int detect_memory_size(void) 2578c2ecf20Sopenharmony_ci{ 2588c2ecf20Sopenharmony_ci unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; 2598c2ecf20Sopenharmony_ci u32 val; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) 2628c2ecf20Sopenharmony_ci return bcm_ddr_readl(DDR_CSEND_REG) << 24; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci if (BCMCPU_IS_6345()) { 2658c2ecf20Sopenharmony_ci val = bcm_sdram_readl(SDRAM_MBASE_REG); 2668c2ecf20Sopenharmony_ci return val * 8 * 1024 * 1024; 2678c2ecf20Sopenharmony_ci } 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { 2708c2ecf20Sopenharmony_ci val = bcm_sdram_readl(SDRAM_CFG_REG); 2718c2ecf20Sopenharmony_ci rows = (val & SDRAM_CFG_ROW_MASK) >> SDRAM_CFG_ROW_SHIFT; 2728c2ecf20Sopenharmony_ci cols = (val & SDRAM_CFG_COL_MASK) >> SDRAM_CFG_COL_SHIFT; 2738c2ecf20Sopenharmony_ci is_32bits = (val & SDRAM_CFG_32B_MASK) ? 1 : 0; 2748c2ecf20Sopenharmony_ci banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1; 2758c2ecf20Sopenharmony_ci } 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) { 2788c2ecf20Sopenharmony_ci val = bcm_memc_readl(MEMC_CFG_REG); 2798c2ecf20Sopenharmony_ci rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT; 2808c2ecf20Sopenharmony_ci cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT; 2818c2ecf20Sopenharmony_ci is_32bits = (val & MEMC_CFG_32B_MASK) ? 0 : 1; 2828c2ecf20Sopenharmony_ci banks = 2; 2838c2ecf20Sopenharmony_ci } 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci /* 0 => 11 address bits ... 2 => 13 address bits */ 2868c2ecf20Sopenharmony_ci rows += 11; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci /* 0 => 8 address bits ... 2 => 10 address bits */ 2898c2ecf20Sopenharmony_ci cols += 8; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci return 1 << (cols + rows + (is_32bits + 1) + banks); 2928c2ecf20Sopenharmony_ci} 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_civoid __init bcm63xx_cpu_init(void) 2958c2ecf20Sopenharmony_ci{ 2968c2ecf20Sopenharmony_ci unsigned int tmp; 2978c2ecf20Sopenharmony_ci unsigned int cpu = smp_processor_id(); 2988c2ecf20Sopenharmony_ci u32 chipid_reg; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci /* soc registers location depends on cpu type */ 3018c2ecf20Sopenharmony_ci chipid_reg = 0; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci switch (current_cpu_type()) { 3048c2ecf20Sopenharmony_ci case CPU_BMIPS3300: 3058c2ecf20Sopenharmony_ci if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT) 3068c2ecf20Sopenharmony_ci __cpu_name[cpu] = "Broadcom BCM6338"; 3078c2ecf20Sopenharmony_ci fallthrough; 3088c2ecf20Sopenharmony_ci case CPU_BMIPS32: 3098c2ecf20Sopenharmony_ci chipid_reg = BCM_6345_PERF_BASE; 3108c2ecf20Sopenharmony_ci break; 3118c2ecf20Sopenharmony_ci case CPU_BMIPS4350: 3128c2ecf20Sopenharmony_ci switch ((read_c0_prid() & PRID_REV_MASK)) { 3138c2ecf20Sopenharmony_ci case 0x04: 3148c2ecf20Sopenharmony_ci chipid_reg = BCM_3368_PERF_BASE; 3158c2ecf20Sopenharmony_ci break; 3168c2ecf20Sopenharmony_ci case 0x10: 3178c2ecf20Sopenharmony_ci chipid_reg = BCM_6345_PERF_BASE; 3188c2ecf20Sopenharmony_ci break; 3198c2ecf20Sopenharmony_ci default: 3208c2ecf20Sopenharmony_ci chipid_reg = BCM_6368_PERF_BASE; 3218c2ecf20Sopenharmony_ci break; 3228c2ecf20Sopenharmony_ci } 3238c2ecf20Sopenharmony_ci break; 3248c2ecf20Sopenharmony_ci } 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci /* 3278c2ecf20Sopenharmony_ci * really early to panic, but delaying panic would not help since we 3288c2ecf20Sopenharmony_ci * will never get any working console 3298c2ecf20Sopenharmony_ci */ 3308c2ecf20Sopenharmony_ci if (!chipid_reg) 3318c2ecf20Sopenharmony_ci panic("unsupported Broadcom CPU"); 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci /* read out CPU type */ 3348c2ecf20Sopenharmony_ci tmp = bcm_readl(chipid_reg); 3358c2ecf20Sopenharmony_ci bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; 3368c2ecf20Sopenharmony_ci bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci switch (bcm63xx_cpu_id) { 3398c2ecf20Sopenharmony_ci case BCM3368_CPU_ID: 3408c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm3368_regs_base; 3418c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm3368_irqs; 3428c2ecf20Sopenharmony_ci break; 3438c2ecf20Sopenharmony_ci case BCM6328_CPU_ID: 3448c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6328_regs_base; 3458c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6328_irqs; 3468c2ecf20Sopenharmony_ci break; 3478c2ecf20Sopenharmony_ci case BCM6338_CPU_ID: 3488c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6338_regs_base; 3498c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6338_irqs; 3508c2ecf20Sopenharmony_ci break; 3518c2ecf20Sopenharmony_ci case BCM6345_CPU_ID: 3528c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6345_regs_base; 3538c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6345_irqs; 3548c2ecf20Sopenharmony_ci break; 3558c2ecf20Sopenharmony_ci case BCM6348_CPU_ID: 3568c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6348_regs_base; 3578c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6348_irqs; 3588c2ecf20Sopenharmony_ci break; 3598c2ecf20Sopenharmony_ci case BCM6358_CPU_ID: 3608c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6358_regs_base; 3618c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6358_irqs; 3628c2ecf20Sopenharmony_ci break; 3638c2ecf20Sopenharmony_ci case BCM6362_CPU_ID: 3648c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6362_regs_base; 3658c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6362_irqs; 3668c2ecf20Sopenharmony_ci break; 3678c2ecf20Sopenharmony_ci case BCM6368_CPU_ID: 3688c2ecf20Sopenharmony_ci bcm63xx_regs_base = bcm6368_regs_base; 3698c2ecf20Sopenharmony_ci bcm63xx_irqs = bcm6368_irqs; 3708c2ecf20Sopenharmony_ci break; 3718c2ecf20Sopenharmony_ci default: 3728c2ecf20Sopenharmony_ci panic("unsupported broadcom CPU %x", bcm63xx_cpu_id); 3738c2ecf20Sopenharmony_ci break; 3748c2ecf20Sopenharmony_ci } 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci bcm63xx_cpu_freq = detect_cpu_clock(); 3778c2ecf20Sopenharmony_ci bcm63xx_memory_size = detect_memory_size(); 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci pr_info("Detected Broadcom 0x%04x CPU revision %02x\n", 3808c2ecf20Sopenharmony_ci bcm63xx_cpu_id, bcm63xx_cpu_rev); 3818c2ecf20Sopenharmony_ci pr_info("CPU frequency is %u MHz\n", 3828c2ecf20Sopenharmony_ci bcm63xx_cpu_freq / 1000000); 3838c2ecf20Sopenharmony_ci pr_info("%uMB of RAM installed\n", 3848c2ecf20Sopenharmony_ci bcm63xx_memory_size >> 20); 3858c2ecf20Sopenharmony_ci} 386