2005-10-20 14:56:38 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2007-09-21 16:01:15 +08:00
|
|
|
#include <linux/init.h>
|
2005-10-20 14:56:38 +08:00
|
|
|
#include <linux/kernel.h>
|
2007-07-29 07:00:34 +08:00
|
|
|
#include <linux/module.h>
|
2005-10-20 14:56:38 +08:00
|
|
|
#include <linux/reboot.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
|
|
|
|
#include <asm/bootinfo.h>
|
|
|
|
#include <asm/mipsregs.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/sibyte/sb1250.h>
|
|
|
|
|
|
|
|
#include <asm/sibyte/bcm1480_regs.h>
|
|
|
|
#include <asm/sibyte/bcm1480_scd.h>
|
|
|
|
#include <asm/sibyte/sb1250_scd.h>
|
|
|
|
|
|
|
|
unsigned int sb1_pass;
|
|
|
|
unsigned int soc_pass;
|
|
|
|
unsigned int soc_type;
|
2007-07-17 19:03:50 +08:00
|
|
|
EXPORT_SYMBOL(soc_type);
|
2005-10-20 14:56:38 +08:00
|
|
|
unsigned int periph_rev;
|
|
|
|
unsigned int zbbus_mhz;
|
2007-09-21 15:59:07 +08:00
|
|
|
EXPORT_SYMBOL(zbbus_mhz);
|
2005-10-20 14:56:38 +08:00
|
|
|
|
|
|
|
static unsigned int part_type;
|
|
|
|
|
|
|
|
static char *soc_str;
|
|
|
|
static char *pass_str;
|
|
|
|
|
2007-10-12 06:46:05 +08:00
|
|
|
static int __init setup_bcm1x80_bcm1x55(void)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (soc_pass) {
|
|
|
|
case K_SYS_REVISION_BCM1480_S0:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "S0 (pass1)";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1480_A1:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "A1 (pass1)";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1480_A2:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "A2 (pass1)";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1480_A3:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "A3 (pass1)";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1480_B0:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "B0 (pass2)";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk("Unknown %s rev %x\n", soc_str, soc_pass);
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "Unknown Revision";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2005-10-20 14:56:38 +08:00
|
|
|
|
|
|
|
/* Setup code likely to be common to all SiByte platforms */
|
|
|
|
|
2007-10-12 06:46:05 +08:00
|
|
|
static int __init sys_rev_decode(void)
|
2005-10-20 14:56:38 +08:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (soc_type) {
|
2007-10-12 06:46:05 +08:00
|
|
|
case K_SYS_SOC_TYPE_BCM1x80:
|
2005-10-20 14:56:38 +08:00
|
|
|
if (part_type == K_SYS_PART_BCM1480)
|
|
|
|
soc_str = "BCM1480";
|
|
|
|
else if (part_type == K_SYS_PART_BCM1280)
|
|
|
|
soc_str = "BCM1280";
|
|
|
|
else
|
|
|
|
soc_str = "BCM1x80";
|
|
|
|
ret = setup_bcm1x80_bcm1x55();
|
|
|
|
break;
|
|
|
|
|
2007-10-12 06:46:05 +08:00
|
|
|
case K_SYS_SOC_TYPE_BCM1x55:
|
2005-10-20 14:56:38 +08:00
|
|
|
if (part_type == K_SYS_PART_BCM1455)
|
|
|
|
soc_str = "BCM1455";
|
|
|
|
else if (part_type == K_SYS_PART_BCM1255)
|
|
|
|
soc_str = "BCM1255";
|
|
|
|
else
|
|
|
|
soc_str = "BCM1x55";
|
|
|
|
ret = setup_bcm1x80_bcm1x55();
|
|
|
|
break;
|
|
|
|
|
2007-10-12 06:46:05 +08:00
|
|
|
default:
|
2007-03-01 19:56:43 +08:00
|
|
|
printk("Unknown part type %x\n", part_type);
|
2005-10-20 14:56:38 +08:00
|
|
|
ret = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-10-12 06:46:05 +08:00
|
|
|
void __init bcm1480_setup(void)
|
2005-10-20 14:56:38 +08:00
|
|
|
{
|
|
|
|
uint64_t sys_rev;
|
|
|
|
int plldiv;
|
|
|
|
|
|
|
|
sb1_pass = read_c0_prid() & 0xff;
|
|
|
|
sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));
|
|
|
|
soc_type = SYS_SOC_TYPE(sys_rev);
|
|
|
|
part_type = G_SYS_PART(sys_rev);
|
|
|
|
soc_pass = G_SYS_REVISION(sys_rev);
|
|
|
|
|
|
|
|
if (sys_rev_decode()) {
|
2007-03-01 19:56:43 +08:00
|
|
|
printk("Restart after failure to identify SiByte chip\n");
|
2005-10-20 14:56:38 +08:00
|
|
|
machine_restart(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
|
|
|
|
zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
|
|
|
|
|
2007-03-01 19:56:43 +08:00
|
|
|
printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",
|
2005-10-20 14:56:38 +08:00
|
|
|
soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
|
2007-03-01 19:56:43 +08:00
|
|
|
printk("Board type: %s\n", get_system_type());
|
2005-10-20 14:56:38 +08:00
|
|
|
}
|