blob: d09c4c2153801e31e1f1650eeb5e43aab39fcd71 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
Stefan Roese153b3e22007-10-05 17:10:59 +02002 * (C) Copyright 2000-2007
wdenkc6097192002-11-03 00:24:07 +00003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
wdenkc6097192002-11-03 00:24:07 +000025 * CPU specific code
26 *
27 * written or collected and sometimes rewritten by
28 * Magnus Damm <damm@bitsmart.com>
29 *
30 * minor modifications by
31 * Wolfgang Denk <wd@denx.de>
32 */
33
34#include <common.h>
35#include <watchdog.h>
36#include <command.h>
37#include <asm/cache.h>
38#include <ppc4xx.h>
Ben Warren9e37c582008-10-27 23:53:17 -070039#include <netdev.h>
wdenkc6097192002-11-03 00:24:07 +000040
Wolfgang Denk6405a152006-03-31 18:32:53 +020041DECLARE_GLOBAL_DATA_PTR;
Wolfgang Denk6405a152006-03-31 18:32:53 +020042
Stefan Roese03687752006-10-07 11:30:52 +020043void board_reset(void);
Stefan Roese03687752006-10-07 11:30:52 +020044
Adam Grahamc31ff682008-10-08 10:13:19 -070045/*
46 * To provide an interface to detect CPU number for boards that support
47 * more then one CPU, we implement the "weak" default functions here.
48 *
49 * Returns CPU number
50 */
51int __get_cpu_num(void)
52{
53 return NA_OR_UNKNOWN_CPU;
54}
55int get_cpu_num(void) __attribute__((weak, alias("__get_cpu_num")));
56
Stefan Roese42fbddd2006-09-07 11:51:23 +020057#if defined(CONFIG_405GP) || \
58 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
59 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010060
61#define PCI_ASYNC
62
Stefan Roese6964fd62007-11-09 12:18:54 +010063static int pci_async_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010064{
65#if defined(CONFIG_405GP)
66 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010067#endif
68
Stefan Roese42fbddd2006-09-07 11:51:23 +020069#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +010070 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
71 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese99644742005-11-29 18:18:21 +010072 unsigned long val;
73
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010074 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010075 return (val & SDR0_SDSTP1_PAME_MASK);
76#endif
77}
78#endif
79
Stefan Roese153b3e22007-10-05 17:10:59 +020080#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \
81 !defined(CONFIG_405) && !defined(CONFIG_405EX)
Stefan Roese6964fd62007-11-09 12:18:54 +010082static int pci_arbiter_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010083{
84#if defined(CONFIG_405GP)
85 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
86#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010087
Stefan Roese99644742005-11-29 18:18:21 +010088#if defined(CONFIG_405EP)
89 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010090#endif
91
92#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010093 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
94#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010095
Stefan Roese84382432007-02-02 12:44:22 +010096#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010097 unsigned long val;
98
Stefan Roese84382432007-02-02 12:44:22 +010099 mfsdr(sdr_xcr, val);
100 return (val & 0x80000000);
101#endif
102#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +0100103 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
104 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese84382432007-02-02 12:44:22 +0100105 unsigned long val;
106
107 mfsdr(sdr_pci0, val);
108 return (val & 0x80000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100109#endif
Stefan Roese99644742005-11-29 18:18:21 +0100110}
111#endif
112
Stefan Roese6964fd62007-11-09 12:18:54 +0100113#if defined(CONFIG_405EP)
Stefan Roese99644742005-11-29 18:18:21 +0100114#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100115
Stefan Roese6964fd62007-11-09 12:18:54 +0100116static int i2c_bootrom_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +0100117{
118#if defined(CONFIG_405EP)
119 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200120#else
Stefan Roese99644742005-11-29 18:18:21 +0100121 unsigned long val;
122
123 mfsdr(sdr_sdcs, val);
124 return (val & SDR0_SDCS_SDD);
125#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200126}
Stefan Roese3a75ac12007-04-18 12:05:59 +0200127#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200128
129#if defined(CONFIG_440GX)
130#define SDR0_PINSTP_SHIFT 29
131static char *bootstrap_str[] = {
132 "EBC (16 bits)",
133 "EBC (8 bits)",
134 "EBC (32 bits)",
135 "EBC (8 bits)",
136 "PCI",
137 "I2C (Addr 0x54)",
138 "Reserved",
139 "I2C (Addr 0x50)",
140};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200141static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200142#endif
143
144#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
145#define SDR0_PINSTP_SHIFT 30
146static char *bootstrap_str[] = {
147 "EBC (8 bits)",
148 "PCI",
149 "I2C (Addr 0x54)",
150 "I2C (Addr 0x50)",
151};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200152static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
Stefan Roese42fbddd2006-09-07 11:51:23 +0200153#endif
154
155#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
156#define SDR0_PINSTP_SHIFT 29
157static char *bootstrap_str[] = {
158 "EBC (8 bits)",
159 "PCI",
160 "NAND (8 bits)",
161 "EBC (16 bits)",
162 "EBC (16 bits)",
163 "I2C (Addr 0x54)",
164 "PCI",
165 "I2C (Addr 0x52)",
166};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200167static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200168#endif
169
170#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
171#define SDR0_PINSTP_SHIFT 29
172static char *bootstrap_str[] = {
173 "EBC (8 bits)",
174 "EBC (16 bits)",
175 "EBC (16 bits)",
176 "NAND (8 bits)",
177 "PCI",
178 "I2C (Addr 0x54)",
179 "PCI",
180 "I2C (Addr 0x52)",
181};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200182static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200183#endif
184
Stefan Roesecc019d12008-03-11 15:05:50 +0100185#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
186#define SDR0_PINSTP_SHIFT 29
187static char *bootstrap_str[] = {
188 "EBC (8 bits)",
189 "EBC (16 bits)",
190 "PCI",
191 "PCI",
192 "EBC (16 bits)",
193 "NAND (8 bits)",
194 "I2C (Addr 0x54)", /* A8 */
195 "I2C (Addr 0x52)", /* A4 */
196};
197static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
198#endif
199
Feng Kan224bc962008-07-08 22:47:31 -0700200#if defined(CONFIG_460SX)
201#define SDR0_PINSTP_SHIFT 29
202static char *bootstrap_str[] = {
203 "EBC (8 bits)",
204 "EBC (16 bits)",
205 "EBC (32 bits)",
206 "NAND (8 bits)",
207 "I2C (Addr 0x54)", /* A8 */
208 "I2C (Addr 0x52)", /* A4 */
209};
210static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G' };
211#endif
212
Stefan Roese3a75ac12007-04-18 12:05:59 +0200213#if defined(CONFIG_405EZ)
214#define SDR0_PINSTP_SHIFT 28
215static char *bootstrap_str[] = {
216 "EBC (8 bits)",
217 "SPI (fast)",
218 "NAND (512 page, 4 addr cycle)",
219 "I2C (Addr 0x50)",
220 "EBC (32 bits)",
221 "I2C (Addr 0x50)",
222 "NAND (2K page, 5 addr cycle)",
223 "I2C (Addr 0x50)",
224 "EBC (16 bits)",
225 "Reserved",
226 "NAND (2K page, 4 addr cycle)",
227 "I2C (Addr 0x50)",
228 "NAND (512 page, 3 addr cycle)",
229 "I2C (Addr 0x50)",
230 "SPI (slow)",
231 "I2C (Addr 0x50)",
232};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200233static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
234 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
Stefan Roese3a75ac12007-04-18 12:05:59 +0200235#endif
236
Stefan Roese153b3e22007-10-05 17:10:59 +0200237#if defined(CONFIG_405EX)
238#define SDR0_PINSTP_SHIFT 29
239static char *bootstrap_str[] = {
240 "EBC (8 bits)",
241 "EBC (16 bits)",
242 "EBC (16 bits)",
243 "NAND (8 bits)",
244 "NAND (8 bits)",
245 "I2C (Addr 0x54)",
246 "EBC (8 bits)",
247 "I2C (Addr 0x52)",
248};
249static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
250#endif
251
Stefan Roese42fbddd2006-09-07 11:51:23 +0200252#if defined(SDR0_PINSTP_SHIFT)
253static int bootstrap_option(void)
254{
255 unsigned long val;
256
Stefan Roese3a75ac12007-04-18 12:05:59 +0200257 mfsdr(SDR_PINSTP, val);
258 return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100259}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200260#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100261
262
wdenkc6097192002-11-03 00:24:07 +0000263#if defined(CONFIG_440)
Stefan Roese6964fd62007-11-09 12:18:54 +0100264static int do_chip_reset (unsigned long sys0, unsigned long sys1)
265{
266 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
267 * reset.
268 */
269 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
270 mtdcr (cpc0_sys0, sys0);
271 mtdcr (cpc0_sys1, sys1);
272 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
273 mtspr (dbcr0, 0x20000000); /* Reset the chip */
274
275 return 1;
276}
wdenkc6097192002-11-03 00:24:07 +0000277#endif
278
wdenkc6097192002-11-03 00:24:07 +0000279
280int checkcpu (void)
281{
Stefan Roese42f2a822005-11-27 19:36:26 +0100282#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100283 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000284 ulong clock = gd->cpu_clk;
285 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000286
Stefan Roese42f2a822005-11-27 19:36:26 +0100287#if !defined(CONFIG_IOP480)
Wolfgang Denk65505432006-10-20 17:54:33 +0200288 char addstr[64] = "";
Stefan Roese42f2a822005-11-27 19:36:26 +0100289 sys_info_t sys_info;
Adam Grahamc31ff682008-10-08 10:13:19 -0700290 int cpu_num;
wdenkc6097192002-11-03 00:24:07 +0000291
Adam Grahamc31ff682008-10-08 10:13:19 -0700292 cpu_num = get_cpu_num();
293 if (cpu_num >= 0)
294 printf("CPU%d: ", cpu_num);
295 else
296 puts("CPU: ");
wdenkc6097192002-11-03 00:24:07 +0000297
298 get_sys_info(&sys_info);
299
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200300#if defined(CONFIG_XILINX_440)
301 puts("IBM PowerPC 4");
302#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100303 puts("AMCC PowerPC 4");
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200304#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100305
Stefan Roese17ffbc82007-03-21 13:38:59 +0100306#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Stefan Roese153b3e22007-10-05 17:10:59 +0200307 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
308 defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100309 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000310#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100311#if defined(CONFIG_440)
Stefan Roesecc019d12008-03-11 15:05:50 +0100312#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
313 puts("60");
314#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100315 puts("40");
stroese434979e2003-05-23 11:18:02 +0000316#endif
Stefan Roesecc019d12008-03-11 15:05:50 +0100317#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100318
wdenkc6097192002-11-03 00:24:07 +0000319 switch (pvr) {
320 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100321 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000322 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100323
wdenkc6097192002-11-03 00:24:07 +0000324 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100325 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000326 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100327
wdenkc6097192002-11-03 00:24:07 +0000328 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100329 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000330 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100331
wdenkc35ba4e2004-03-14 22:25:36 +0000332#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100333 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
334 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000335 break;
336#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100337
wdenkc6097192002-11-03 00:24:07 +0000338 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100339 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000340 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100341
wdenkc6097192002-11-03 00:24:07 +0000342 case PVR_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100343 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000344 break;
wdenkc6097192002-11-03 00:24:07 +0000345
Stefan Roese42f2a822005-11-27 19:36:26 +0100346#ifdef CONFIG_405CR
347 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
348 puts("CR Rev. C");
349 break;
wdenkc6097192002-11-03 00:24:07 +0000350#endif
351
Stefan Roese42f2a822005-11-27 19:36:26 +0100352 case PVR_405GPR_RB:
353 puts("GPr Rev. B");
354 break;
wdenkc6097192002-11-03 00:24:07 +0000355
Stefan Roese42f2a822005-11-27 19:36:26 +0100356 case PVR_405EP_RB:
357 puts("EP Rev. B");
358 break;
wdenkc6097192002-11-03 00:24:07 +0000359
Stefan Roese17ffbc82007-03-21 13:38:59 +0100360 case PVR_405EZ_RA:
361 puts("EZ Rev. A");
362 break;
363
Stefan Roese153b3e22007-10-05 17:10:59 +0200364 case PVR_405EX1_RA:
365 puts("EX Rev. A");
366 strcpy(addstr, "Security support");
367 break;
368
369 case PVR_405EX2_RA:
370 puts("EX Rev. A");
371 strcpy(addstr, "No Security support");
372 break;
373
374 case PVR_405EXR1_RA:
375 puts("EXr Rev. A");
376 strcpy(addstr, "Security support");
377 break;
378
379 case PVR_405EXR2_RA:
380 puts("EXr Rev. A");
381 strcpy(addstr, "No Security support");
382 break;
383
Stefan Roesefbf24302008-05-13 20:22:01 +0200384 case PVR_405EX1_RC:
385 puts("EX Rev. C");
386 strcpy(addstr, "Security support");
387 break;
388
389 case PVR_405EX2_RC:
390 puts("EX Rev. C");
391 strcpy(addstr, "No Security support");
392 break;
393
394 case PVR_405EXR1_RC:
395 puts("EXr Rev. C");
396 strcpy(addstr, "Security support");
397 break;
398
399 case PVR_405EXR2_RC:
400 puts("EXr Rev. C");
401 strcpy(addstr, "No Security support");
402 break;
403
wdenkc6097192002-11-03 00:24:07 +0000404#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000405 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200406 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000407 /* See errata 1.12: CHIP_4 */
408 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
409 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
410 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
411 "Resetting chip ...\n");
412 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
413 do_chip_reset ( mfdcr(cpc0_strp0),
414 mfdcr(cpc0_strp1) );
415 }
wdenkc6097192002-11-03 00:24:07 +0000416 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100417
wdenk57b2d802003-06-27 21:31:46 +0000418 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200419 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000420 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100421
wdenk544e9732004-02-06 23:19:44 +0000422 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200423 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000424 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100425
wdenk544e9732004-02-06 23:19:44 +0000426 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200427 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000428 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100429
stroesec0125272005-04-07 05:33:41 +0000430 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200431 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000432 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100433
Stefan Roese08fb4042005-11-01 10:08:03 +0100434 case PVR_440GX_RF:
435 puts("GX Rev. F");
436 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100437
Stefan Roese326c9712005-08-01 16:41:48 +0200438 case PVR_440EP_RA:
439 puts("EP Rev. A");
440 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100441
Stefan Roese95258d52005-10-04 15:00:30 +0200442#ifdef CONFIG_440EP
443 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200444 puts("EP Rev. B");
445 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200446
447 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
448 puts("EP Rev. C");
449 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200450#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100451
Stefan Roese95258d52005-10-04 15:00:30 +0200452#ifdef CONFIG_440GR
453 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
454 puts("GR Rev. A");
455 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200456
Stefan Roese96467d62006-05-18 19:21:53 +0200457 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200458 puts("GR Rev. B");
459 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200460#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100461#endif /* CONFIG_440 */
462
Stefan Roese188fab62007-01-31 16:56:10 +0100463#ifdef CONFIG_440EPX
464 case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200465 puts("EPx Rev. A");
466 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200467 break;
468
Stefan Roese188fab62007-01-31 16:56:10 +0100469 case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200470 puts("EPx Rev. A");
471 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200472 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100473#endif /* CONFIG_440EPX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200474
Stefan Roese188fab62007-01-31 16:56:10 +0100475#ifdef CONFIG_440GRX
476 case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200477 puts("GRx Rev. A");
478 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200479 break;
480
Stefan Roese188fab62007-01-31 16:56:10 +0100481 case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200482 puts("GRx Rev. A");
483 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200484 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100485#endif /* CONFIG_440GRX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200486
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100487 case PVR_440SP_6_RAB:
488 puts("SP Rev. A/B");
489 strcpy(addstr, "RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100490 break;
491
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100492 case PVR_440SP_RAB:
493 puts("SP Rev. A/B");
494 strcpy(addstr, "No RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100495 break;
496
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100497 case PVR_440SP_6_RC:
498 puts("SP Rev. C");
499 strcpy(addstr, "RAID 6 support");
500 break;
501
Stefan Roesec6d59302006-11-28 16:09:24 +0100502 case PVR_440SP_RC:
503 puts("SP Rev. C");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100504 strcpy(addstr, "No RAID 6 support");
Stefan Roesec6d59302006-11-28 16:09:24 +0100505 break;
506
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100507 case PVR_440SPe_6_RA:
508 puts("SPe Rev. A");
509 strcpy(addstr, "RAID 6 support");
510 break;
511
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200512 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200513 puts("SPe Rev. A");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100514 strcpy(addstr, "No RAID 6 support");
515 break;
516
517 case PVR_440SPe_6_RB:
518 puts("SPe Rev. B");
519 strcpy(addstr, "RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200520 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200521
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200522 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200523 puts("SPe Rev. B");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100524 strcpy(addstr, "No RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200525 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200526
Stefan Roesecc019d12008-03-11 15:05:50 +0100527 case PVR_460EX_RA:
528 puts("EX Rev. A");
529 strcpy(addstr, "No Security/Kasumi support");
530 break;
531
532 case PVR_460EX_SE_RA:
533 puts("EX Rev. A");
534 strcpy(addstr, "Security/Kasumi support");
535 break;
536
537 case PVR_460GT_RA:
538 puts("GT Rev. A");
539 strcpy(addstr, "No Security/Kasumi support");
540 break;
541
542 case PVR_460GT_SE_RA:
543 puts("GT Rev. A");
544 strcpy(addstr, "Security/Kasumi support");
545 break;
546
Feng Kan224bc962008-07-08 22:47:31 -0700547 case PVR_460SX_RA:
548 puts("SX Rev. A");
549 strcpy(addstr, "Security support");
550 break;
551
552 case PVR_460SX_RA_V1:
553 puts("SX Rev. A");
554 strcpy(addstr, "No Security support");
555 break;
556
557 case PVR_460GX_RA:
558 puts("GX Rev. A");
559 strcpy(addstr, "Security support");
560 break;
561
562 case PVR_460GX_RA_V1:
563 puts("GX Rev. A");
564 strcpy(addstr, "No Security support");
565 break;
566
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200567 case PVR_VIRTEX5:
568 puts("x5 VIRTEX5");
569 break;
570
wdenk57b2d802003-06-27 21:31:46 +0000571 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200572 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000573 break;
574 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100575
576 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
Stefan Roese17ffbc82007-03-21 13:38:59 +0100577 sys_info.freqPLB / 1000000,
578 get_OPB_freq() / 1000000,
Stefan Roese153b3e22007-10-05 17:10:59 +0200579 sys_info.freqEBC / 1000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100580
Stefan Roese11dd8812006-10-18 15:59:35 +0200581 if (addstr[0] != 0)
582 printf(" %s\n", addstr);
583
Stefan Roese99644742005-11-29 18:18:21 +0100584#if defined(I2C_BOOTROM)
585 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese3a75ac12007-04-18 12:05:59 +0200586#endif /* I2C_BOOTROM */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200587#if defined(SDR0_PINSTP_SHIFT)
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200588 printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200589 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
Wolfgang Denk65505432006-10-20 17:54:33 +0200590#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100591
Stefan Roese153b3e22007-10-05 17:10:59 +0200592#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese99644742005-11-29 18:18:21 +0100593 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100594#endif
595
Stefan Roese99644742005-11-29 18:18:21 +0100596#if defined(PCI_ASYNC)
597 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100598 printf (", PCI async ext clock used");
599 } else {
600 printf (", PCI sync clock at %lu MHz",
601 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
602 }
wdenkc6097192002-11-03 00:24:07 +0000603#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100604
Stefan Roese153b3e22007-10-05 17:10:59 +0200605#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100606 putc('\n');
607#endif
608
Stefan Roese153b3e22007-10-05 17:10:59 +0200609#if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100610 printf (" 16 kB I-Cache 16 kB D-Cache");
611#elif defined(CONFIG_440)
612 printf (" 32 kB I-Cache 32 kB D-Cache");
613#else
614 printf (" 16 kB I-Cache %d kB D-Cache",
615 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
616#endif
617#endif /* !defined(CONFIG_IOP480) */
618
619#if defined(CONFIG_IOP480)
620 printf ("PLX IOP480 (PVR=%08x)", pvr);
621 printf (" at %s MHz:", strmhz(buf, clock));
622 printf (" %u kB I-Cache", 4);
623 printf (" %u kB D-Cache", 2);
624#endif
625
626#endif /* !defined(CONFIG_405) */
627
628 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000629
630 return 0;
631}
632
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200633int ppc440spe_revB() {
634 unsigned int pvr;
635
636 pvr = get_pvr();
Stefan Roese1456a772007-01-15 09:46:29 +0100637 if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB))
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200638 return 1;
639 else
640 return 0;
641}
wdenkc6097192002-11-03 00:24:07 +0000642
643/* ------------------------------------------------------------------------- */
644
wdenk57b2d802003-06-27 21:31:46 +0000645int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000646{
Stefan Roeseecf05b22006-11-27 14:48:41 +0100647#if defined(CONFIG_BOARD_RESET)
648 board_reset();
Stefan Roesea5232952006-11-27 14:52:04 +0100649#else
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200650#if defined(CONFIG_SYS_4xx_RESET_TYPE)
651 mtspr(dbcr0, CONFIG_SYS_4xx_RESET_TYPE << 28);
Stefan Roese326c9712005-08-01 16:41:48 +0200652#else
wdenk57b2d802003-06-27 21:31:46 +0000653 /*
654 * Initiate system reset in debug control register DBCR
655 */
Stefan Roese03687752006-10-07 11:30:52 +0200656 mtspr(dbcr0, 0x30000000);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200657#endif /* defined(CONFIG_SYS_4xx_RESET_TYPE) */
Stefan Roese03687752006-10-07 11:30:52 +0200658#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roese326c9712005-08-01 16:41:48 +0200659
wdenkc6097192002-11-03 00:24:07 +0000660 return 1;
661}
wdenkc6097192002-11-03 00:24:07 +0000662
663
664/*
665 * Get timebase clock frequency
666 */
667unsigned long get_tbclk (void)
668{
Stefan Roese42f2a822005-11-27 19:36:26 +0100669#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000670 sys_info_t sys_info;
671
672 get_sys_info(&sys_info);
673 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000674#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100675 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000676#endif
677
678}
679
680
681#if defined(CONFIG_WATCHDOG)
Stefan Roese6964fd62007-11-09 12:18:54 +0100682void watchdog_reset(void)
wdenkc6097192002-11-03 00:24:07 +0000683{
684 int re_enable = disable_interrupts();
685 reset_4xx_watchdog();
686 if (re_enable) enable_interrupts();
687}
688
Stefan Roese6964fd62007-11-09 12:18:54 +0100689void reset_4xx_watchdog(void)
wdenkc6097192002-11-03 00:24:07 +0000690{
691 /*
692 * Clear TSR(WIS) bit
693 */
694 mtspr(tsr, 0x40000000);
695}
696#endif /* CONFIG_WATCHDOG */
Ben Warren9e37c582008-10-27 23:53:17 -0700697
698/*
699 * Initializes on-chip ethernet controllers.
700 * to override, implement board_eth_init()
701 */
702int cpu_eth_init(bd_t *bis)
703{
704#if defined(CONFIG_PPC4xx_EMAC)
705 ppc_4xx_eth_initialize(bis);
706#endif
707 return 0;
708}