2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #include <linux/init.h>
19 #include <linux/module.h>
20 #include <linux/kernel.h>
21 #include <linux/reboot.h>
22 #include <linux/string.h>
24 #include <asm/bootinfo.h>
25 #include <asm/mipsregs.h>
27 #include <asm/sibyte/sb1250.h>
28 #include <asm/sibyte/sb1250_regs.h>
29 #include <asm/sibyte/sb1250_scd.h>
31 unsigned int sb1_pass
;
32 unsigned int soc_pass
;
33 unsigned int soc_type
;
34 unsigned int periph_rev
;
35 unsigned int zbbus_mhz
;
36 EXPORT_SYMBOL(zbbus_mhz
);
39 static char *pass_str
;
40 static unsigned int war_pass
; /* XXXKW don't overload PASS defines? */
42 static inline int setup_bcm1250(void);
43 static inline int setup_bcm112x(void);
45 /* Setup code likely to be common to all SiByte platforms */
47 static int __init
sys_rev_decode(void)
53 case K_SYS_SOC_TYPE_BCM1250
:
54 case K_SYS_SOC_TYPE_BCM1250_ALT
:
55 case K_SYS_SOC_TYPE_BCM1250_ALT2
:
57 ret
= setup_bcm1250();
59 case K_SYS_SOC_TYPE_BCM1120
:
61 ret
= setup_bcm112x();
63 case K_SYS_SOC_TYPE_BCM1125
:
65 ret
= setup_bcm112x();
67 case K_SYS_SOC_TYPE_BCM1125H
:
69 ret
= setup_bcm112x();
72 printk("Unknown SOC type %x\n", soc_type
);
79 static int __init
setup_bcm1250(void)
84 case K_SYS_REVISION_BCM1250_PASS1
:
88 case K_SYS_REVISION_BCM1250_A10
:
91 /* XXXKW different war_pass? */
92 war_pass
= K_SYS_REVISION_BCM1250_PASS2
;
94 case K_SYS_REVISION_BCM1250_PASS2_2
:
98 case K_SYS_REVISION_BCM1250_B2
:
101 war_pass
= K_SYS_REVISION_BCM1250_PASS2_2
;
103 case K_SYS_REVISION_BCM1250_PASS3
:
107 case K_SYS_REVISION_BCM1250_C1
:
112 if (soc_pass
< K_SYS_REVISION_BCM1250_PASS2_2
) {
115 war_pass
= K_SYS_REVISION_BCM1250_PASS2
;
117 printk("Unknown BCM1250 rev %x\n", soc_pass
);
125 static int __init
setup_bcm112x(void)
131 /* Early build didn't have revid set */
134 war_pass
= K_SYS_REVISION_BCM112x_A1
;
136 case K_SYS_REVISION_BCM112x_A1
:
140 case K_SYS_REVISION_BCM112x_A2
:
144 case K_SYS_REVISION_BCM112x_A3
:
148 case K_SYS_REVISION_BCM112x_A4
:
152 case K_SYS_REVISION_BCM112x_B0
:
157 printk("Unknown %s rev %x\n", soc_str
, soc_pass
);
163 void __init
sb1250_setup(void)
169 sb1_pass
= read_c0_prid() & 0xff;
170 sys_rev
= __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION
));
171 soc_type
= SYS_SOC_TYPE(sys_rev
);
172 soc_pass
= G_SYS_REVISION(sys_rev
);
174 if (sys_rev_decode()) {
175 printk("Restart after failure to identify SiByte chip\n");
176 machine_restart(NULL
);
179 plldiv
= G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG
)));
180 zbbus_mhz
= ((plldiv
>> 1) * 50) + ((plldiv
& 1) * 25);
182 printk("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
183 soc_str
, pass_str
, zbbus_mhz
* 2, sb1_pass
);
184 printk("Board type: %s\n", get_system_type());
187 case K_SYS_REVISION_BCM1250_PASS1
:
188 #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
189 printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
190 "and the kernel doesn't have the proper "
191 "workarounds compiled in. @@@@\n");
195 case K_SYS_REVISION_BCM1250_PASS2
:
196 /* Pass 2 - easiest as default for now - so many numbers */
197 #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
198 !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
199 printk("@@@@ This is a BCM1250 A3-A10 board, and the "
200 "kernel doesn't have the proper workarounds "
201 "compiled in. @@@@\n");
204 #ifdef CONFIG_CPU_HAS_PREFETCH
205 printk("@@@@ Prefetches may be enabled in this kernel, "
206 "but are buggy on this board. @@@@\n");
210 case K_SYS_REVISION_BCM1250_PASS2_2
:
211 #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
212 printk("@@@@ This is a BCM1250 B1/B2. board, and the "
213 "kernel doesn't have the proper workarounds "
214 "compiled in. @@@@\n");
217 #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
218 !defined(CONFIG_CPU_HAS_PREFETCH)
219 printk("@@@@ This is a BCM1250 B1/B2, but the kernel is "
220 "conservatively configured for an 'A' stepping. "
228 printk("Invalid configuration for this chip.\n");
229 machine_restart(NULL
);