Path: blob/master/arch/mips/sibyte/bcm1480/setup.c
10818 views
/*1* Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation; either version 26* of the License, or (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*/17#include <linux/init.h>18#include <linux/kernel.h>19#include <linux/module.h>20#include <linux/reboot.h>21#include <linux/string.h>2223#include <asm/bootinfo.h>24#include <asm/mipsregs.h>25#include <asm/io.h>26#include <asm/sibyte/sb1250.h>2728#include <asm/sibyte/bcm1480_regs.h>29#include <asm/sibyte/bcm1480_scd.h>30#include <asm/sibyte/sb1250_scd.h>3132unsigned int sb1_pass;33unsigned int soc_pass;34unsigned int soc_type;35EXPORT_SYMBOL(soc_type);36unsigned int periph_rev;37unsigned int zbbus_mhz;38EXPORT_SYMBOL(zbbus_mhz);3940static unsigned int part_type;4142static char *soc_str;43static char *pass_str;4445static int __init setup_bcm1x80_bcm1x55(void)46{47int ret = 0;4849switch (soc_pass) {50case K_SYS_REVISION_BCM1480_S0:51periph_rev = 1;52pass_str = "S0 (pass1)";53break;54case K_SYS_REVISION_BCM1480_A1:55periph_rev = 1;56pass_str = "A1 (pass1)";57break;58case K_SYS_REVISION_BCM1480_A2:59periph_rev = 1;60pass_str = "A2 (pass1)";61break;62case K_SYS_REVISION_BCM1480_A3:63periph_rev = 1;64pass_str = "A3 (pass1)";65break;66case K_SYS_REVISION_BCM1480_B0:67periph_rev = 1;68pass_str = "B0 (pass2)";69break;70default:71printk("Unknown %s rev %x\n", soc_str, soc_pass);72periph_rev = 1;73pass_str = "Unknown Revision";74break;75}7677return ret;78}7980/* Setup code likely to be common to all SiByte platforms */8182static int __init sys_rev_decode(void)83{84int ret = 0;8586switch (soc_type) {87case K_SYS_SOC_TYPE_BCM1x80:88if (part_type == K_SYS_PART_BCM1480)89soc_str = "BCM1480";90else if (part_type == K_SYS_PART_BCM1280)91soc_str = "BCM1280";92else93soc_str = "BCM1x80";94ret = setup_bcm1x80_bcm1x55();95break;9697case K_SYS_SOC_TYPE_BCM1x55:98if (part_type == K_SYS_PART_BCM1455)99soc_str = "BCM1455";100else if (part_type == K_SYS_PART_BCM1255)101soc_str = "BCM1255";102else103soc_str = "BCM1x55";104ret = setup_bcm1x80_bcm1x55();105break;106107default:108printk("Unknown part type %x\n", part_type);109ret = 1;110break;111}112113return ret;114}115116void __init bcm1480_setup(void)117{118uint64_t sys_rev;119int plldiv;120121sb1_pass = read_c0_prid() & 0xff;122sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));123soc_type = SYS_SOC_TYPE(sys_rev);124part_type = G_SYS_PART(sys_rev);125soc_pass = G_SYS_REVISION(sys_rev);126127if (sys_rev_decode()) {128printk("Restart after failure to identify SiByte chip\n");129machine_restart(NULL);130}131132plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));133zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);134135printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",136soc_str, pass_str, zbbus_mhz * 2, sb1_pass);137printk("Board type: %s\n", get_system_type());138}139140141