2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000, 2001, 2002, 2003 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.
|
|
|
|
*/
|
2006-01-29 23:56:43 +03:00
|
|
|
#include <linux/init.h>
|
2007-03-09 18:59:56 +03:00
|
|
|
#include <linux/module.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/reboot.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
|
|
|
|
#include <asm/bootinfo.h>
|
2013-09-17 19:58:10 +04:00
|
|
|
#include <asm/cpu.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/mipsregs.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/sibyte/sb1250.h>
|
|
|
|
#include <asm/sibyte/sb1250_regs.h>
|
|
|
|
#include <asm/sibyte/sb1250_scd.h>
|
|
|
|
|
|
|
|
unsigned int sb1_pass;
|
|
|
|
unsigned int soc_pass;
|
|
|
|
unsigned int soc_type;
|
2007-07-17 15:03:50 +04:00
|
|
|
EXPORT_SYMBOL(soc_type);
|
2005-04-17 02:20:36 +04:00
|
|
|
unsigned int periph_rev;
|
|
|
|
unsigned int zbbus_mhz;
|
2007-03-09 18:59:56 +03:00
|
|
|
EXPORT_SYMBOL(zbbus_mhz);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
static char *soc_str;
|
|
|
|
static char *pass_str;
|
|
|
|
static unsigned int war_pass; /* XXXKW don't overload PASS defines? */
|
|
|
|
|
2006-01-29 23:56:43 +03:00
|
|
|
static int __init setup_bcm1250(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (soc_pass) {
|
|
|
|
case K_SYS_REVISION_BCM1250_PASS1:
|
|
|
|
periph_rev = 1;
|
|
|
|
pass_str = "Pass 1";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_A10:
|
|
|
|
periph_rev = 2;
|
|
|
|
pass_str = "A8/A10";
|
|
|
|
/* XXXKW different war_pass? */
|
|
|
|
war_pass = K_SYS_REVISION_BCM1250_PASS2;
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_PASS2_2:
|
|
|
|
periph_rev = 2;
|
|
|
|
pass_str = "B1";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_B2:
|
|
|
|
periph_rev = 2;
|
|
|
|
pass_str = "B2";
|
|
|
|
war_pass = K_SYS_REVISION_BCM1250_PASS2_2;
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_PASS3:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "C0";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_C1:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "C1";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (soc_pass < K_SYS_REVISION_BCM1250_PASS2_2) {
|
|
|
|
periph_rev = 2;
|
|
|
|
pass_str = "A0-A6";
|
|
|
|
war_pass = K_SYS_REVISION_BCM1250_PASS2;
|
|
|
|
} else {
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Unknown BCM1250 rev %x\n", soc_pass);
|
2005-04-17 02:20:36 +04:00
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-10-12 02:46:05 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-23 02:02:43 +03:00
|
|
|
int sb1250_m3_workaround_needed(void)
|
|
|
|
{
|
|
|
|
switch (soc_type) {
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250_ALT:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250_ALT2:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1125:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1125H:
|
|
|
|
return soc_pass < K_SYS_REVISION_BCM1250_C0;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-29 23:56:43 +03:00
|
|
|
static int __init setup_bcm112x(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (soc_pass) {
|
|
|
|
case 0:
|
|
|
|
/* Early build didn't have revid set */
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "A1";
|
|
|
|
war_pass = K_SYS_REVISION_BCM112x_A1;
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM112x_A1:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "A1";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM112x_A2:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "A2";
|
|
|
|
break;
|
2007-04-13 21:32:25 +04:00
|
|
|
case K_SYS_REVISION_BCM112x_A3:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "A3";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM112x_A4:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "A4";
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM112x_B0:
|
|
|
|
periph_rev = 3;
|
|
|
|
pass_str = "B0";
|
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
default:
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Unknown %s rev %x\n", soc_str, soc_pass);
|
2005-04-17 02:20:36 +04:00
|
|
|
ret = 1;
|
|
|
|
}
|
2007-10-12 02:46:05 +04:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup code likely to be common to all SiByte platforms */
|
|
|
|
|
|
|
|
static int __init sys_rev_decode(void)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
war_pass = soc_pass;
|
|
|
|
switch (soc_type) {
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250_ALT:
|
|
|
|
case K_SYS_SOC_TYPE_BCM1250_ALT2:
|
|
|
|
soc_str = "BCM1250";
|
|
|
|
ret = setup_bcm1250();
|
|
|
|
break;
|
|
|
|
case K_SYS_SOC_TYPE_BCM1120:
|
|
|
|
soc_str = "BCM1120";
|
|
|
|
ret = setup_bcm112x();
|
|
|
|
break;
|
|
|
|
case K_SYS_SOC_TYPE_BCM1125:
|
|
|
|
soc_str = "BCM1125";
|
|
|
|
ret = setup_bcm112x();
|
|
|
|
break;
|
|
|
|
case K_SYS_SOC_TYPE_BCM1125H:
|
|
|
|
soc_str = "BCM1125H";
|
|
|
|
ret = setup_bcm112x();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk("Unknown SOC type %x\n", soc_type);
|
|
|
|
ret = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-01-29 23:56:43 +03:00
|
|
|
void __init sb1250_setup(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
uint64_t sys_rev;
|
|
|
|
int plldiv;
|
|
|
|
int bad_config = 0;
|
|
|
|
|
2013-09-17 19:58:10 +04:00
|
|
|
sb1_pass = read_c0_prid() & PRID_REV_MASK;
|
2005-02-23 00:51:30 +03:00
|
|
|
sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));
|
2005-04-17 02:20:36 +04:00
|
|
|
soc_type = SYS_SOC_TYPE(sys_rev);
|
|
|
|
soc_pass = G_SYS_REVISION(sys_rev);
|
|
|
|
|
|
|
|
if (sys_rev_decode()) {
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Restart after failure to identify SiByte chip\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
machine_restart(NULL);
|
|
|
|
}
|
|
|
|
|
2005-02-23 00:51:30 +03:00
|
|
|
plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
|
2005-04-17 02:20:36 +04:00
|
|
|
zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
|
|
|
|
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
|
2005-04-17 02:20:36 +04:00
|
|
|
soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Board type: %s\n", get_system_type());
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-01-30 00:01:42 +03:00
|
|
|
switch (war_pass) {
|
2005-04-17 02:20:36 +04:00
|
|
|
case K_SYS_REVISION_BCM1250_PASS1:
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
|
2013-01-22 15:59:30 +04:00
|
|
|
"and the kernel doesn't have the proper "
|
|
|
|
"workarounds compiled in. @@@@\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
bad_config = 1;
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_PASS2:
|
|
|
|
/* Pass 2 - easiest as default for now - so many numbers */
|
2006-01-30 00:01:42 +03:00
|
|
|
#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
|
|
|
|
!defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("@@@@ This is a BCM1250 A3-A10 board, and the "
|
2013-01-22 15:59:30 +04:00
|
|
|
"kernel doesn't have the proper workarounds "
|
|
|
|
"compiled in. @@@@\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
bad_config = 1;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CPU_HAS_PREFETCH
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("@@@@ Prefetches may be enabled in this kernel, "
|
2013-01-22 15:59:30 +04:00
|
|
|
"but are buggy on this board. @@@@\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
bad_config = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case K_SYS_REVISION_BCM1250_PASS2_2:
|
|
|
|
#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("@@@@ This is a BCM1250 B1/B2. board, and the "
|
2013-01-22 15:59:30 +04:00
|
|
|
"kernel doesn't have the proper workarounds "
|
|
|
|
"compiled in. @@@@\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
bad_config = 1;
|
|
|
|
#endif
|
2006-01-30 00:01:42 +03:00
|
|
|
#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
|
|
|
|
!defined(CONFIG_CPU_HAS_PREFETCH)
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("@@@@ This is a BCM1250 B1/B2, but the kernel is "
|
2013-01-22 15:59:30 +04:00
|
|
|
"conservatively configured for an 'A' stepping. "
|
|
|
|
"@@@@\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bad_config) {
|
2007-03-01 14:56:43 +03:00
|
|
|
printk("Invalid configuration for this chip.\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
machine_restart(NULL);
|
|
|
|
}
|
|
|
|
}
|