blob: fb3837c3df7befa480a7fc2ad30b180e41c49019 [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 Roese9f500fa2009-07-06 11:44:33 +020057#if defined(CONFIG_PCI)
Stefan Roese42fbddd2006-09-07 11:51:23 +020058#if defined(CONFIG_405GP) || \
59 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
60 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010061
62#define PCI_ASYNC
63
Stefan Roese6964fd62007-11-09 12:18:54 +010064static int pci_async_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010065{
66#if defined(CONFIG_405GP)
67 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010068#endif
69
Stefan Roese42fbddd2006-09-07 11:51:23 +020070#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +010071 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
72 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese99644742005-11-29 18:18:21 +010073 unsigned long val;
74
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010075 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010076 return (val & SDR0_SDSTP1_PAME_MASK);
77#endif
78}
79#endif
Stefan Roese9f500fa2009-07-06 11:44:33 +020080#endif /* CONFIG_PCI */
Stefan Roese99644742005-11-29 18:18:21 +010081
Stefan Roese153b3e22007-10-05 17:10:59 +020082#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \
83 !defined(CONFIG_405) && !defined(CONFIG_405EX)
Stefan Roese6964fd62007-11-09 12:18:54 +010084static int pci_arbiter_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010085{
86#if defined(CONFIG_405GP)
87 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
88#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010089
Stefan Roese99644742005-11-29 18:18:21 +010090#if defined(CONFIG_405EP)
91 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010092#endif
93
94#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010095 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
96#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010097
Stefan Roese84382432007-02-02 12:44:22 +010098#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010099 unsigned long val;
100
Stefan Roese84382432007-02-02 12:44:22 +0100101 mfsdr(sdr_xcr, val);
102 return (val & 0x80000000);
103#endif
104#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +0100105 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
106 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese84382432007-02-02 12:44:22 +0100107 unsigned long val;
108
109 mfsdr(sdr_pci0, val);
110 return (val & 0x80000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100111#endif
Stefan Roese99644742005-11-29 18:18:21 +0100112}
113#endif
114
Stefan Roese6964fd62007-11-09 12:18:54 +0100115#if defined(CONFIG_405EP)
Stefan Roese99644742005-11-29 18:18:21 +0100116#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100117
Stefan Roese6964fd62007-11-09 12:18:54 +0100118static int i2c_bootrom_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +0100119{
120#if defined(CONFIG_405EP)
121 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200122#else
Stefan Roese99644742005-11-29 18:18:21 +0100123 unsigned long val;
124
125 mfsdr(sdr_sdcs, val);
126 return (val & SDR0_SDCS_SDD);
127#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200128}
Stefan Roese3a75ac12007-04-18 12:05:59 +0200129#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200130
131#if defined(CONFIG_440GX)
132#define SDR0_PINSTP_SHIFT 29
133static char *bootstrap_str[] = {
134 "EBC (16 bits)",
135 "EBC (8 bits)",
136 "EBC (32 bits)",
137 "EBC (8 bits)",
138 "PCI",
139 "I2C (Addr 0x54)",
140 "Reserved",
141 "I2C (Addr 0x50)",
142};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200143static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200144#endif
145
146#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
147#define SDR0_PINSTP_SHIFT 30
148static char *bootstrap_str[] = {
149 "EBC (8 bits)",
150 "PCI",
151 "I2C (Addr 0x54)",
152 "I2C (Addr 0x50)",
153};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200154static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
Stefan Roese42fbddd2006-09-07 11:51:23 +0200155#endif
156
157#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
158#define SDR0_PINSTP_SHIFT 29
159static char *bootstrap_str[] = {
160 "EBC (8 bits)",
161 "PCI",
162 "NAND (8 bits)",
163 "EBC (16 bits)",
164 "EBC (16 bits)",
165 "I2C (Addr 0x54)",
166 "PCI",
167 "I2C (Addr 0x52)",
168};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200169static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200170#endif
171
172#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
173#define SDR0_PINSTP_SHIFT 29
174static char *bootstrap_str[] = {
175 "EBC (8 bits)",
176 "EBC (16 bits)",
177 "EBC (16 bits)",
178 "NAND (8 bits)",
179 "PCI",
180 "I2C (Addr 0x54)",
181 "PCI",
182 "I2C (Addr 0x52)",
183};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200184static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200185#endif
186
Stefan Roesecc019d12008-03-11 15:05:50 +0100187#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
188#define SDR0_PINSTP_SHIFT 29
189static char *bootstrap_str[] = {
190 "EBC (8 bits)",
191 "EBC (16 bits)",
192 "PCI",
193 "PCI",
194 "EBC (16 bits)",
195 "NAND (8 bits)",
196 "I2C (Addr 0x54)", /* A8 */
197 "I2C (Addr 0x52)", /* A4 */
198};
199static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
200#endif
201
Feng Kan224bc962008-07-08 22:47:31 -0700202#if defined(CONFIG_460SX)
203#define SDR0_PINSTP_SHIFT 29
204static char *bootstrap_str[] = {
205 "EBC (8 bits)",
206 "EBC (16 bits)",
207 "EBC (32 bits)",
208 "NAND (8 bits)",
209 "I2C (Addr 0x54)", /* A8 */
210 "I2C (Addr 0x52)", /* A4 */
211};
212static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G' };
213#endif
214
Stefan Roese3a75ac12007-04-18 12:05:59 +0200215#if defined(CONFIG_405EZ)
216#define SDR0_PINSTP_SHIFT 28
217static char *bootstrap_str[] = {
218 "EBC (8 bits)",
219 "SPI (fast)",
220 "NAND (512 page, 4 addr cycle)",
221 "I2C (Addr 0x50)",
222 "EBC (32 bits)",
223 "I2C (Addr 0x50)",
224 "NAND (2K page, 5 addr cycle)",
225 "I2C (Addr 0x50)",
226 "EBC (16 bits)",
227 "Reserved",
228 "NAND (2K page, 4 addr cycle)",
229 "I2C (Addr 0x50)",
230 "NAND (512 page, 3 addr cycle)",
231 "I2C (Addr 0x50)",
232 "SPI (slow)",
233 "I2C (Addr 0x50)",
234};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200235static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
236 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
Stefan Roese3a75ac12007-04-18 12:05:59 +0200237#endif
238
Stefan Roese153b3e22007-10-05 17:10:59 +0200239#if defined(CONFIG_405EX)
240#define SDR0_PINSTP_SHIFT 29
241static char *bootstrap_str[] = {
242 "EBC (8 bits)",
243 "EBC (16 bits)",
244 "EBC (16 bits)",
245 "NAND (8 bits)",
246 "NAND (8 bits)",
247 "I2C (Addr 0x54)",
248 "EBC (8 bits)",
249 "I2C (Addr 0x52)",
250};
251static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
252#endif
253
Stefan Roese42fbddd2006-09-07 11:51:23 +0200254#if defined(SDR0_PINSTP_SHIFT)
255static int bootstrap_option(void)
256{
257 unsigned long val;
258
Stefan Roese3a75ac12007-04-18 12:05:59 +0200259 mfsdr(SDR_PINSTP, val);
260 return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100261}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200262#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100263
264
wdenkc6097192002-11-03 00:24:07 +0000265#if defined(CONFIG_440)
Stefan Roese6964fd62007-11-09 12:18:54 +0100266static int do_chip_reset (unsigned long sys0, unsigned long sys1)
267{
268 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
269 * reset.
270 */
271 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
272 mtdcr (cpc0_sys0, sys0);
273 mtdcr (cpc0_sys1, sys1);
274 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
275 mtspr (dbcr0, 0x20000000); /* Reset the chip */
276
277 return 1;
278}
wdenkc6097192002-11-03 00:24:07 +0000279#endif
280
wdenkc6097192002-11-03 00:24:07 +0000281
282int checkcpu (void)
283{
Stefan Roese42f2a822005-11-27 19:36:26 +0100284#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100285 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000286 ulong clock = gd->cpu_clk;
287 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000288
Stefan Roese42f2a822005-11-27 19:36:26 +0100289#if !defined(CONFIG_IOP480)
Wolfgang Denk65505432006-10-20 17:54:33 +0200290 char addstr[64] = "";
Stefan Roese42f2a822005-11-27 19:36:26 +0100291 sys_info_t sys_info;
Adam Grahamc31ff682008-10-08 10:13:19 -0700292 int cpu_num;
wdenkc6097192002-11-03 00:24:07 +0000293
Adam Grahamc31ff682008-10-08 10:13:19 -0700294 cpu_num = get_cpu_num();
295 if (cpu_num >= 0)
296 printf("CPU%d: ", cpu_num);
297 else
298 puts("CPU: ");
wdenkc6097192002-11-03 00:24:07 +0000299
300 get_sys_info(&sys_info);
301
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200302#if defined(CONFIG_XILINX_440)
303 puts("IBM PowerPC 4");
304#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100305 puts("AMCC PowerPC 4");
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200306#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100307
Stefan Roese17ffbc82007-03-21 13:38:59 +0100308#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Stefan Roese153b3e22007-10-05 17:10:59 +0200309 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
310 defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100311 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000312#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100313#if defined(CONFIG_440)
Stefan Roesecc019d12008-03-11 15:05:50 +0100314#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
315 puts("60");
316#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100317 puts("40");
stroese434979e2003-05-23 11:18:02 +0000318#endif
Stefan Roesecc019d12008-03-11 15:05:50 +0100319#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100320
wdenkc6097192002-11-03 00:24:07 +0000321 switch (pvr) {
322 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100323 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000324 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100325
wdenkc6097192002-11-03 00:24:07 +0000326 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100327 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000328 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100329
wdenkc6097192002-11-03 00:24:07 +0000330 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100331 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000332 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100333
wdenkc35ba4e2004-03-14 22:25:36 +0000334#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100335 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
336 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000337 break;
338#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100339
wdenkc6097192002-11-03 00:24:07 +0000340 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100341 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000342 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100343
wdenkc6097192002-11-03 00:24:07 +0000344 case PVR_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100345 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000346 break;
wdenkc6097192002-11-03 00:24:07 +0000347
Stefan Roese42f2a822005-11-27 19:36:26 +0100348#ifdef CONFIG_405CR
349 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
350 puts("CR Rev. C");
351 break;
wdenkc6097192002-11-03 00:24:07 +0000352#endif
353
Stefan Roese42f2a822005-11-27 19:36:26 +0100354 case PVR_405GPR_RB:
355 puts("GPr Rev. B");
356 break;
wdenkc6097192002-11-03 00:24:07 +0000357
Stefan Roese42f2a822005-11-27 19:36:26 +0100358 case PVR_405EP_RB:
359 puts("EP Rev. B");
360 break;
wdenkc6097192002-11-03 00:24:07 +0000361
Stefan Roese17ffbc82007-03-21 13:38:59 +0100362 case PVR_405EZ_RA:
363 puts("EZ Rev. A");
364 break;
365
Stefan Roese153b3e22007-10-05 17:10:59 +0200366 case PVR_405EX1_RA:
367 puts("EX Rev. A");
368 strcpy(addstr, "Security support");
369 break;
370
371 case PVR_405EX2_RA:
372 puts("EX Rev. A");
373 strcpy(addstr, "No Security support");
374 break;
375
376 case PVR_405EXR1_RA:
377 puts("EXr Rev. A");
378 strcpy(addstr, "Security support");
379 break;
380
381 case PVR_405EXR2_RA:
382 puts("EXr Rev. A");
383 strcpy(addstr, "No Security support");
384 break;
385
Stefan Roesefbf24302008-05-13 20:22:01 +0200386 case PVR_405EX1_RC:
387 puts("EX Rev. C");
388 strcpy(addstr, "Security support");
389 break;
390
391 case PVR_405EX2_RC:
392 puts("EX Rev. C");
393 strcpy(addstr, "No Security support");
394 break;
395
396 case PVR_405EXR1_RC:
397 puts("EXr Rev. C");
398 strcpy(addstr, "Security support");
399 break;
400
401 case PVR_405EXR2_RC:
402 puts("EXr Rev. C");
403 strcpy(addstr, "No Security support");
404 break;
405
wdenkc6097192002-11-03 00:24:07 +0000406#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000407 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200408 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000409 /* See errata 1.12: CHIP_4 */
410 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
411 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
412 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
413 "Resetting chip ...\n");
414 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
415 do_chip_reset ( mfdcr(cpc0_strp0),
416 mfdcr(cpc0_strp1) );
417 }
wdenkc6097192002-11-03 00:24:07 +0000418 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100419
wdenk57b2d802003-06-27 21:31:46 +0000420 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200421 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000422 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100423
wdenk544e9732004-02-06 23:19:44 +0000424 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200425 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000426 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100427
wdenk544e9732004-02-06 23:19:44 +0000428 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200429 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000430 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100431
stroesec0125272005-04-07 05:33:41 +0000432 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200433 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000434 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100435
Stefan Roese08fb4042005-11-01 10:08:03 +0100436 case PVR_440GX_RF:
437 puts("GX Rev. F");
438 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100439
Stefan Roese326c9712005-08-01 16:41:48 +0200440 case PVR_440EP_RA:
441 puts("EP Rev. A");
442 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100443
Stefan Roese95258d52005-10-04 15:00:30 +0200444#ifdef CONFIG_440EP
445 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200446 puts("EP Rev. B");
447 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200448
449 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
450 puts("EP Rev. C");
451 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200452#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100453
Stefan Roese95258d52005-10-04 15:00:30 +0200454#ifdef CONFIG_440GR
455 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
456 puts("GR Rev. A");
457 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200458
Stefan Roese96467d62006-05-18 19:21:53 +0200459 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200460 puts("GR Rev. B");
461 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200462#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100463#endif /* CONFIG_440 */
464
Stefan Roese188fab62007-01-31 16:56:10 +0100465#ifdef CONFIG_440EPX
466 case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200467 puts("EPx Rev. A");
468 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200469 break;
470
Stefan Roese188fab62007-01-31 16:56:10 +0100471 case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200472 puts("EPx Rev. A");
473 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200474 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100475#endif /* CONFIG_440EPX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200476
Stefan Roese188fab62007-01-31 16:56:10 +0100477#ifdef CONFIG_440GRX
478 case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200479 puts("GRx Rev. A");
480 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200481 break;
482
Stefan Roese188fab62007-01-31 16:56:10 +0100483 case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200484 puts("GRx Rev. A");
485 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200486 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100487#endif /* CONFIG_440GRX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200488
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100489 case PVR_440SP_6_RAB:
490 puts("SP Rev. A/B");
491 strcpy(addstr, "RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100492 break;
493
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100494 case PVR_440SP_RAB:
495 puts("SP Rev. A/B");
496 strcpy(addstr, "No RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100497 break;
498
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100499 case PVR_440SP_6_RC:
500 puts("SP Rev. C");
501 strcpy(addstr, "RAID 6 support");
502 break;
503
Stefan Roesec6d59302006-11-28 16:09:24 +0100504 case PVR_440SP_RC:
505 puts("SP Rev. C");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100506 strcpy(addstr, "No RAID 6 support");
Stefan Roesec6d59302006-11-28 16:09:24 +0100507 break;
508
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100509 case PVR_440SPe_6_RA:
510 puts("SPe Rev. A");
511 strcpy(addstr, "RAID 6 support");
512 break;
513
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200514 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200515 puts("SPe Rev. A");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100516 strcpy(addstr, "No RAID 6 support");
517 break;
518
519 case PVR_440SPe_6_RB:
520 puts("SPe Rev. B");
521 strcpy(addstr, "RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200522 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200523
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200524 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200525 puts("SPe Rev. B");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100526 strcpy(addstr, "No RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200527 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200528
Stefan Roesecc019d12008-03-11 15:05:50 +0100529 case PVR_460EX_RA:
530 puts("EX Rev. A");
531 strcpy(addstr, "No Security/Kasumi support");
532 break;
533
534 case PVR_460EX_SE_RA:
535 puts("EX Rev. A");
536 strcpy(addstr, "Security/Kasumi support");
537 break;
538
539 case PVR_460GT_RA:
540 puts("GT Rev. A");
541 strcpy(addstr, "No Security/Kasumi support");
542 break;
543
544 case PVR_460GT_SE_RA:
545 puts("GT Rev. A");
546 strcpy(addstr, "Security/Kasumi support");
547 break;
548
Feng Kan224bc962008-07-08 22:47:31 -0700549 case PVR_460SX_RA:
550 puts("SX Rev. A");
551 strcpy(addstr, "Security support");
552 break;
553
554 case PVR_460SX_RA_V1:
555 puts("SX Rev. A");
556 strcpy(addstr, "No Security support");
557 break;
558
559 case PVR_460GX_RA:
560 puts("GX Rev. A");
561 strcpy(addstr, "Security support");
562 break;
563
564 case PVR_460GX_RA_V1:
565 puts("GX Rev. A");
566 strcpy(addstr, "No Security support");
567 break;
568
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200569 case PVR_VIRTEX5:
570 puts("x5 VIRTEX5");
571 break;
572
wdenk57b2d802003-06-27 21:31:46 +0000573 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200574 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000575 break;
576 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100577
578 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
Stefan Roese17ffbc82007-03-21 13:38:59 +0100579 sys_info.freqPLB / 1000000,
580 get_OPB_freq() / 1000000,
Stefan Roese153b3e22007-10-05 17:10:59 +0200581 sys_info.freqEBC / 1000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100582
Stefan Roese11dd8812006-10-18 15:59:35 +0200583 if (addstr[0] != 0)
584 printf(" %s\n", addstr);
585
Stefan Roese99644742005-11-29 18:18:21 +0100586#if defined(I2C_BOOTROM)
587 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese3a75ac12007-04-18 12:05:59 +0200588#endif /* I2C_BOOTROM */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200589#if defined(SDR0_PINSTP_SHIFT)
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200590 printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
Stefan Roese8ebdb922009-04-15 10:50:48 +0200591 printf ("Boot ROM Location %s", bootstrap_str[bootstrap_option()]);
592#ifdef CONFIG_NAND_U_BOOT
593 puts(", booting from NAND");
594#endif /* CONFIG_NAND_U_BOOT */
595 putc('\n');
Wolfgang Denk65505432006-10-20 17:54:33 +0200596#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100597
Stefan Roese153b3e22007-10-05 17:10:59 +0200598#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese99644742005-11-29 18:18:21 +0100599 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100600#endif
601
Stefan Roesef5150122009-05-27 10:34:32 +0200602#if defined(CONFIG_PCI) && defined(PCI_ASYNC)
Stefan Roese99644742005-11-29 18:18:21 +0100603 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100604 printf (", PCI async ext clock used");
605 } else {
606 printf (", PCI sync clock at %lu MHz",
607 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
608 }
wdenkc6097192002-11-03 00:24:07 +0000609#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100610
Stefan Roese153b3e22007-10-05 17:10:59 +0200611#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100612 putc('\n');
613#endif
614
Stefan Roese153b3e22007-10-05 17:10:59 +0200615#if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100616 printf (" 16 kB I-Cache 16 kB D-Cache");
617#elif defined(CONFIG_440)
618 printf (" 32 kB I-Cache 32 kB D-Cache");
619#else
620 printf (" 16 kB I-Cache %d kB D-Cache",
621 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
622#endif
623#endif /* !defined(CONFIG_IOP480) */
624
625#if defined(CONFIG_IOP480)
626 printf ("PLX IOP480 (PVR=%08x)", pvr);
627 printf (" at %s MHz:", strmhz(buf, clock));
628 printf (" %u kB I-Cache", 4);
629 printf (" %u kB D-Cache", 2);
630#endif
631
632#endif /* !defined(CONFIG_405) */
633
634 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000635
636 return 0;
637}
638
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200639int ppc440spe_revB() {
640 unsigned int pvr;
641
642 pvr = get_pvr();
Stefan Roese1456a772007-01-15 09:46:29 +0100643 if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB))
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200644 return 1;
645 else
646 return 0;
647}
wdenkc6097192002-11-03 00:24:07 +0000648
649/* ------------------------------------------------------------------------- */
650
wdenk57b2d802003-06-27 21:31:46 +0000651int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000652{
Stefan Roeseecf05b22006-11-27 14:48:41 +0100653#if defined(CONFIG_BOARD_RESET)
654 board_reset();
Stefan Roesea5232952006-11-27 14:52:04 +0100655#else
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200656#if defined(CONFIG_SYS_4xx_RESET_TYPE)
657 mtspr(dbcr0, CONFIG_SYS_4xx_RESET_TYPE << 28);
Stefan Roese326c9712005-08-01 16:41:48 +0200658#else
wdenk57b2d802003-06-27 21:31:46 +0000659 /*
660 * Initiate system reset in debug control register DBCR
661 */
Stefan Roese03687752006-10-07 11:30:52 +0200662 mtspr(dbcr0, 0x30000000);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200663#endif /* defined(CONFIG_SYS_4xx_RESET_TYPE) */
Stefan Roese03687752006-10-07 11:30:52 +0200664#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roese326c9712005-08-01 16:41:48 +0200665
wdenkc6097192002-11-03 00:24:07 +0000666 return 1;
667}
wdenkc6097192002-11-03 00:24:07 +0000668
669
670/*
671 * Get timebase clock frequency
672 */
673unsigned long get_tbclk (void)
674{
Stefan Roese42f2a822005-11-27 19:36:26 +0100675#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000676 sys_info_t sys_info;
677
678 get_sys_info(&sys_info);
679 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000680#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100681 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000682#endif
683
684}
685
686
687#if defined(CONFIG_WATCHDOG)
Stefan Roese6964fd62007-11-09 12:18:54 +0100688void watchdog_reset(void)
wdenkc6097192002-11-03 00:24:07 +0000689{
690 int re_enable = disable_interrupts();
691 reset_4xx_watchdog();
692 if (re_enable) enable_interrupts();
693}
694
Stefan Roese6964fd62007-11-09 12:18:54 +0100695void reset_4xx_watchdog(void)
wdenkc6097192002-11-03 00:24:07 +0000696{
697 /*
698 * Clear TSR(WIS) bit
699 */
700 mtspr(tsr, 0x40000000);
701}
702#endif /* CONFIG_WATCHDOG */
Ben Warren9e37c582008-10-27 23:53:17 -0700703
704/*
705 * Initializes on-chip ethernet controllers.
706 * to override, implement board_eth_init()
707 */
708int cpu_eth_init(bd_t *bis)
709{
710#if defined(CONFIG_PPC4xx_EMAC)
711 ppc_4xx_eth_initialize(bis);
712#endif
713 return 0;
714}