blob: a676b30efe735bca9057916abfdf437d8a577397 [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>
39
Wolfgang Denk6405a152006-03-31 18:32:53 +020040DECLARE_GLOBAL_DATA_PTR;
Wolfgang Denk6405a152006-03-31 18:32:53 +020041
Stefan Roese03687752006-10-07 11:30:52 +020042void board_reset(void);
Stefan Roese03687752006-10-07 11:30:52 +020043
Adam Grahamc31ff682008-10-08 10:13:19 -070044/*
45 * To provide an interface to detect CPU number for boards that support
46 * more then one CPU, we implement the "weak" default functions here.
47 *
48 * Returns CPU number
49 */
50int __get_cpu_num(void)
51{
52 return NA_OR_UNKNOWN_CPU;
53}
54int get_cpu_num(void) __attribute__((weak, alias("__get_cpu_num")));
55
Stefan Roese42fbddd2006-09-07 11:51:23 +020056#if defined(CONFIG_405GP) || \
57 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
58 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010059
60#define PCI_ASYNC
61
Stefan Roese6964fd62007-11-09 12:18:54 +010062static int pci_async_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010063{
64#if defined(CONFIG_405GP)
65 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010066#endif
67
Stefan Roese42fbddd2006-09-07 11:51:23 +020068#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +010069 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
70 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese99644742005-11-29 18:18:21 +010071 unsigned long val;
72
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010073 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010074 return (val & SDR0_SDSTP1_PAME_MASK);
75#endif
76}
77#endif
78
Stefan Roese153b3e22007-10-05 17:10:59 +020079#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \
80 !defined(CONFIG_405) && !defined(CONFIG_405EX)
Stefan Roese6964fd62007-11-09 12:18:54 +010081static int pci_arbiter_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010082{
83#if defined(CONFIG_405GP)
84 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
85#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010086
Stefan Roese99644742005-11-29 18:18:21 +010087#if defined(CONFIG_405EP)
88 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010089#endif
90
91#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010092 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
93#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010094
Stefan Roese84382432007-02-02 12:44:22 +010095#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010096 unsigned long val;
97
Stefan Roese84382432007-02-02 12:44:22 +010098 mfsdr(sdr_xcr, val);
99 return (val & 0x80000000);
100#endif
101#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +0100102 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
103 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese84382432007-02-02 12:44:22 +0100104 unsigned long val;
105
106 mfsdr(sdr_pci0, val);
107 return (val & 0x80000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100108#endif
Stefan Roese99644742005-11-29 18:18:21 +0100109}
110#endif
111
Stefan Roese6964fd62007-11-09 12:18:54 +0100112#if defined(CONFIG_405EP)
Stefan Roese99644742005-11-29 18:18:21 +0100113#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100114
Stefan Roese6964fd62007-11-09 12:18:54 +0100115static int i2c_bootrom_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +0100116{
117#if defined(CONFIG_405EP)
118 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200119#else
Stefan Roese99644742005-11-29 18:18:21 +0100120 unsigned long val;
121
122 mfsdr(sdr_sdcs, val);
123 return (val & SDR0_SDCS_SDD);
124#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200125}
Stefan Roese3a75ac12007-04-18 12:05:59 +0200126#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200127
128#if defined(CONFIG_440GX)
129#define SDR0_PINSTP_SHIFT 29
130static char *bootstrap_str[] = {
131 "EBC (16 bits)",
132 "EBC (8 bits)",
133 "EBC (32 bits)",
134 "EBC (8 bits)",
135 "PCI",
136 "I2C (Addr 0x54)",
137 "Reserved",
138 "I2C (Addr 0x50)",
139};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200140static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200141#endif
142
143#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
144#define SDR0_PINSTP_SHIFT 30
145static char *bootstrap_str[] = {
146 "EBC (8 bits)",
147 "PCI",
148 "I2C (Addr 0x54)",
149 "I2C (Addr 0x50)",
150};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200151static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
Stefan Roese42fbddd2006-09-07 11:51:23 +0200152#endif
153
154#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
155#define SDR0_PINSTP_SHIFT 29
156static char *bootstrap_str[] = {
157 "EBC (8 bits)",
158 "PCI",
159 "NAND (8 bits)",
160 "EBC (16 bits)",
161 "EBC (16 bits)",
162 "I2C (Addr 0x54)",
163 "PCI",
164 "I2C (Addr 0x52)",
165};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200166static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200167#endif
168
169#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
170#define SDR0_PINSTP_SHIFT 29
171static char *bootstrap_str[] = {
172 "EBC (8 bits)",
173 "EBC (16 bits)",
174 "EBC (16 bits)",
175 "NAND (8 bits)",
176 "PCI",
177 "I2C (Addr 0x54)",
178 "PCI",
179 "I2C (Addr 0x52)",
180};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200181static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200182#endif
183
Stefan Roesecc019d12008-03-11 15:05:50 +0100184#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
185#define SDR0_PINSTP_SHIFT 29
186static char *bootstrap_str[] = {
187 "EBC (8 bits)",
188 "EBC (16 bits)",
189 "PCI",
190 "PCI",
191 "EBC (16 bits)",
192 "NAND (8 bits)",
193 "I2C (Addr 0x54)", /* A8 */
194 "I2C (Addr 0x52)", /* A4 */
195};
196static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
197#endif
198
Feng Kan224bc962008-07-08 22:47:31 -0700199#if defined(CONFIG_460SX)
200#define SDR0_PINSTP_SHIFT 29
201static char *bootstrap_str[] = {
202 "EBC (8 bits)",
203 "EBC (16 bits)",
204 "EBC (32 bits)",
205 "NAND (8 bits)",
206 "I2C (Addr 0x54)", /* A8 */
207 "I2C (Addr 0x52)", /* A4 */
208};
209static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G' };
210#endif
211
Stefan Roese3a75ac12007-04-18 12:05:59 +0200212#if defined(CONFIG_405EZ)
213#define SDR0_PINSTP_SHIFT 28
214static char *bootstrap_str[] = {
215 "EBC (8 bits)",
216 "SPI (fast)",
217 "NAND (512 page, 4 addr cycle)",
218 "I2C (Addr 0x50)",
219 "EBC (32 bits)",
220 "I2C (Addr 0x50)",
221 "NAND (2K page, 5 addr cycle)",
222 "I2C (Addr 0x50)",
223 "EBC (16 bits)",
224 "Reserved",
225 "NAND (2K page, 4 addr cycle)",
226 "I2C (Addr 0x50)",
227 "NAND (512 page, 3 addr cycle)",
228 "I2C (Addr 0x50)",
229 "SPI (slow)",
230 "I2C (Addr 0x50)",
231};
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200232static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
233 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
Stefan Roese3a75ac12007-04-18 12:05:59 +0200234#endif
235
Stefan Roese153b3e22007-10-05 17:10:59 +0200236#if defined(CONFIG_405EX)
237#define SDR0_PINSTP_SHIFT 29
238static char *bootstrap_str[] = {
239 "EBC (8 bits)",
240 "EBC (16 bits)",
241 "EBC (16 bits)",
242 "NAND (8 bits)",
243 "NAND (8 bits)",
244 "I2C (Addr 0x54)",
245 "EBC (8 bits)",
246 "I2C (Addr 0x52)",
247};
248static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
249#endif
250
Stefan Roese42fbddd2006-09-07 11:51:23 +0200251#if defined(SDR0_PINSTP_SHIFT)
252static int bootstrap_option(void)
253{
254 unsigned long val;
255
Stefan Roese3a75ac12007-04-18 12:05:59 +0200256 mfsdr(SDR_PINSTP, val);
257 return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100258}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200259#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100260
261
wdenkc6097192002-11-03 00:24:07 +0000262#if defined(CONFIG_440)
Stefan Roese6964fd62007-11-09 12:18:54 +0100263static int do_chip_reset (unsigned long sys0, unsigned long sys1)
264{
265 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
266 * reset.
267 */
268 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
269 mtdcr (cpc0_sys0, sys0);
270 mtdcr (cpc0_sys1, sys1);
271 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
272 mtspr (dbcr0, 0x20000000); /* Reset the chip */
273
274 return 1;
275}
wdenkc6097192002-11-03 00:24:07 +0000276#endif
277
wdenkc6097192002-11-03 00:24:07 +0000278
279int checkcpu (void)
280{
Stefan Roese42f2a822005-11-27 19:36:26 +0100281#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100282 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000283 ulong clock = gd->cpu_clk;
284 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000285
Stefan Roese42f2a822005-11-27 19:36:26 +0100286#if !defined(CONFIG_IOP480)
Wolfgang Denk65505432006-10-20 17:54:33 +0200287 char addstr[64] = "";
Stefan Roese42f2a822005-11-27 19:36:26 +0100288 sys_info_t sys_info;
Adam Grahamc31ff682008-10-08 10:13:19 -0700289 int cpu_num;
wdenkc6097192002-11-03 00:24:07 +0000290
Adam Grahamc31ff682008-10-08 10:13:19 -0700291 cpu_num = get_cpu_num();
292 if (cpu_num >= 0)
293 printf("CPU%d: ", cpu_num);
294 else
295 puts("CPU: ");
wdenkc6097192002-11-03 00:24:07 +0000296
297 get_sys_info(&sys_info);
298
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200299#if defined(CONFIG_XILINX_440)
300 puts("IBM PowerPC 4");
301#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100302 puts("AMCC PowerPC 4");
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200303#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100304
Stefan Roese17ffbc82007-03-21 13:38:59 +0100305#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Stefan Roese153b3e22007-10-05 17:10:59 +0200306 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
307 defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100308 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000309#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100310#if defined(CONFIG_440)
Stefan Roesecc019d12008-03-11 15:05:50 +0100311#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
312 puts("60");
313#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100314 puts("40");
stroese434979e2003-05-23 11:18:02 +0000315#endif
Stefan Roesecc019d12008-03-11 15:05:50 +0100316#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100317
wdenkc6097192002-11-03 00:24:07 +0000318 switch (pvr) {
319 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100320 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000321 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100322
wdenkc6097192002-11-03 00:24:07 +0000323 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100324 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000325 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100326
wdenkc6097192002-11-03 00:24:07 +0000327 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100328 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000329 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100330
wdenkc35ba4e2004-03-14 22:25:36 +0000331#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100332 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
333 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000334 break;
335#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100336
wdenkc6097192002-11-03 00:24:07 +0000337 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100338 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000339 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100340
wdenkc6097192002-11-03 00:24:07 +0000341 case PVR_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100342 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000343 break;
wdenkc6097192002-11-03 00:24:07 +0000344
Stefan Roese42f2a822005-11-27 19:36:26 +0100345#ifdef CONFIG_405CR
346 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
347 puts("CR Rev. C");
348 break;
wdenkc6097192002-11-03 00:24:07 +0000349#endif
350
Stefan Roese42f2a822005-11-27 19:36:26 +0100351 case PVR_405GPR_RB:
352 puts("GPr Rev. B");
353 break;
wdenkc6097192002-11-03 00:24:07 +0000354
Stefan Roese42f2a822005-11-27 19:36:26 +0100355 case PVR_405EP_RB:
356 puts("EP Rev. B");
357 break;
wdenkc6097192002-11-03 00:24:07 +0000358
Stefan Roese17ffbc82007-03-21 13:38:59 +0100359 case PVR_405EZ_RA:
360 puts("EZ Rev. A");
361 break;
362
Stefan Roese153b3e22007-10-05 17:10:59 +0200363 case PVR_405EX1_RA:
364 puts("EX Rev. A");
365 strcpy(addstr, "Security support");
366 break;
367
368 case PVR_405EX2_RA:
369 puts("EX Rev. A");
370 strcpy(addstr, "No Security support");
371 break;
372
373 case PVR_405EXR1_RA:
374 puts("EXr Rev. A");
375 strcpy(addstr, "Security support");
376 break;
377
378 case PVR_405EXR2_RA:
379 puts("EXr Rev. A");
380 strcpy(addstr, "No Security support");
381 break;
382
Stefan Roesefbf24302008-05-13 20:22:01 +0200383 case PVR_405EX1_RC:
384 puts("EX Rev. C");
385 strcpy(addstr, "Security support");
386 break;
387
388 case PVR_405EX2_RC:
389 puts("EX Rev. C");
390 strcpy(addstr, "No Security support");
391 break;
392
393 case PVR_405EXR1_RC:
394 puts("EXr Rev. C");
395 strcpy(addstr, "Security support");
396 break;
397
398 case PVR_405EXR2_RC:
399 puts("EXr Rev. C");
400 strcpy(addstr, "No Security support");
401 break;
402
wdenkc6097192002-11-03 00:24:07 +0000403#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000404 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200405 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000406 /* See errata 1.12: CHIP_4 */
407 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
408 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
409 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
410 "Resetting chip ...\n");
411 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
412 do_chip_reset ( mfdcr(cpc0_strp0),
413 mfdcr(cpc0_strp1) );
414 }
wdenkc6097192002-11-03 00:24:07 +0000415 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100416
wdenk57b2d802003-06-27 21:31:46 +0000417 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200418 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000419 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100420
wdenk544e9732004-02-06 23:19:44 +0000421 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200422 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000423 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100424
wdenk544e9732004-02-06 23:19:44 +0000425 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200426 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000427 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100428
stroesec0125272005-04-07 05:33:41 +0000429 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200430 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000431 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100432
Stefan Roese08fb4042005-11-01 10:08:03 +0100433 case PVR_440GX_RF:
434 puts("GX Rev. F");
435 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100436
Stefan Roese326c9712005-08-01 16:41:48 +0200437 case PVR_440EP_RA:
438 puts("EP Rev. A");
439 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100440
Stefan Roese95258d52005-10-04 15:00:30 +0200441#ifdef CONFIG_440EP
442 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200443 puts("EP Rev. B");
444 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200445
446 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
447 puts("EP Rev. C");
448 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200449#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100450
Stefan Roese95258d52005-10-04 15:00:30 +0200451#ifdef CONFIG_440GR
452 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
453 puts("GR Rev. A");
454 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200455
Stefan Roese96467d62006-05-18 19:21:53 +0200456 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200457 puts("GR Rev. B");
458 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200459#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100460#endif /* CONFIG_440 */
461
Stefan Roese188fab62007-01-31 16:56:10 +0100462#ifdef CONFIG_440EPX
463 case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200464 puts("EPx Rev. A");
465 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200466 break;
467
Stefan Roese188fab62007-01-31 16:56:10 +0100468 case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200469 puts("EPx Rev. A");
470 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200471 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100472#endif /* CONFIG_440EPX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200473
Stefan Roese188fab62007-01-31 16:56:10 +0100474#ifdef CONFIG_440GRX
475 case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200476 puts("GRx Rev. A");
477 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200478 break;
479
Stefan Roese188fab62007-01-31 16:56:10 +0100480 case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200481 puts("GRx Rev. A");
482 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200483 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100484#endif /* CONFIG_440GRX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200485
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100486 case PVR_440SP_6_RAB:
487 puts("SP Rev. A/B");
488 strcpy(addstr, "RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100489 break;
490
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100491 case PVR_440SP_RAB:
492 puts("SP Rev. A/B");
493 strcpy(addstr, "No RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100494 break;
495
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100496 case PVR_440SP_6_RC:
497 puts("SP Rev. C");
498 strcpy(addstr, "RAID 6 support");
499 break;
500
Stefan Roesec6d59302006-11-28 16:09:24 +0100501 case PVR_440SP_RC:
502 puts("SP Rev. C");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100503 strcpy(addstr, "No RAID 6 support");
Stefan Roesec6d59302006-11-28 16:09:24 +0100504 break;
505
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100506 case PVR_440SPe_6_RA:
507 puts("SPe Rev. A");
508 strcpy(addstr, "RAID 6 support");
509 break;
510
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200511 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200512 puts("SPe Rev. A");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100513 strcpy(addstr, "No RAID 6 support");
514 break;
515
516 case PVR_440SPe_6_RB:
517 puts("SPe Rev. B");
518 strcpy(addstr, "RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200519 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200520
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200521 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200522 puts("SPe Rev. B");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100523 strcpy(addstr, "No RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200524 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200525
Stefan Roesecc019d12008-03-11 15:05:50 +0100526 case PVR_460EX_RA:
527 puts("EX Rev. A");
528 strcpy(addstr, "No Security/Kasumi support");
529 break;
530
531 case PVR_460EX_SE_RA:
532 puts("EX Rev. A");
533 strcpy(addstr, "Security/Kasumi support");
534 break;
535
536 case PVR_460GT_RA:
537 puts("GT Rev. A");
538 strcpy(addstr, "No Security/Kasumi support");
539 break;
540
541 case PVR_460GT_SE_RA:
542 puts("GT Rev. A");
543 strcpy(addstr, "Security/Kasumi support");
544 break;
545
Feng Kan224bc962008-07-08 22:47:31 -0700546 case PVR_460SX_RA:
547 puts("SX Rev. A");
548 strcpy(addstr, "Security support");
549 break;
550
551 case PVR_460SX_RA_V1:
552 puts("SX Rev. A");
553 strcpy(addstr, "No Security support");
554 break;
555
556 case PVR_460GX_RA:
557 puts("GX Rev. A");
558 strcpy(addstr, "Security support");
559 break;
560
561 case PVR_460GX_RA_V1:
562 puts("GX Rev. A");
563 strcpy(addstr, "No Security support");
564 break;
565
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200566 case PVR_VIRTEX5:
567 puts("x5 VIRTEX5");
568 break;
569
wdenk57b2d802003-06-27 21:31:46 +0000570 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200571 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000572 break;
573 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100574
575 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
Stefan Roese17ffbc82007-03-21 13:38:59 +0100576 sys_info.freqPLB / 1000000,
577 get_OPB_freq() / 1000000,
Stefan Roese153b3e22007-10-05 17:10:59 +0200578 sys_info.freqEBC / 1000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100579
Stefan Roese11dd8812006-10-18 15:59:35 +0200580 if (addstr[0] != 0)
581 printf(" %s\n", addstr);
582
Stefan Roese99644742005-11-29 18:18:21 +0100583#if defined(I2C_BOOTROM)
584 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese3a75ac12007-04-18 12:05:59 +0200585#endif /* I2C_BOOTROM */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200586#if defined(SDR0_PINSTP_SHIFT)
BenoƮt Monin1a70cf22007-06-04 08:36:05 +0200587 printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200588 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
Wolfgang Denk65505432006-10-20 17:54:33 +0200589#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100590
Stefan Roese153b3e22007-10-05 17:10:59 +0200591#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese99644742005-11-29 18:18:21 +0100592 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100593#endif
594
Stefan Roese99644742005-11-29 18:18:21 +0100595#if defined(PCI_ASYNC)
596 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100597 printf (", PCI async ext clock used");
598 } else {
599 printf (", PCI sync clock at %lu MHz",
600 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
601 }
wdenkc6097192002-11-03 00:24:07 +0000602#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100603
Stefan Roese153b3e22007-10-05 17:10:59 +0200604#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100605 putc('\n');
606#endif
607
Stefan Roese153b3e22007-10-05 17:10:59 +0200608#if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100609 printf (" 16 kB I-Cache 16 kB D-Cache");
610#elif defined(CONFIG_440)
611 printf (" 32 kB I-Cache 32 kB D-Cache");
612#else
613 printf (" 16 kB I-Cache %d kB D-Cache",
614 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
615#endif
616#endif /* !defined(CONFIG_IOP480) */
617
618#if defined(CONFIG_IOP480)
619 printf ("PLX IOP480 (PVR=%08x)", pvr);
620 printf (" at %s MHz:", strmhz(buf, clock));
621 printf (" %u kB I-Cache", 4);
622 printf (" %u kB D-Cache", 2);
623#endif
624
625#endif /* !defined(CONFIG_405) */
626
627 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000628
629 return 0;
630}
631
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200632int ppc440spe_revB() {
633 unsigned int pvr;
634
635 pvr = get_pvr();
Stefan Roese1456a772007-01-15 09:46:29 +0100636 if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB))
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200637 return 1;
638 else
639 return 0;
640}
wdenkc6097192002-11-03 00:24:07 +0000641
642/* ------------------------------------------------------------------------- */
643
wdenk57b2d802003-06-27 21:31:46 +0000644int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000645{
Stefan Roeseecf05b22006-11-27 14:48:41 +0100646#if defined(CONFIG_BOARD_RESET)
647 board_reset();
Stefan Roesea5232952006-11-27 14:52:04 +0100648#else
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200649#if defined(CONFIG_SYS_4xx_RESET_TYPE)
650 mtspr(dbcr0, CONFIG_SYS_4xx_RESET_TYPE << 28);
Stefan Roese326c9712005-08-01 16:41:48 +0200651#else
wdenk57b2d802003-06-27 21:31:46 +0000652 /*
653 * Initiate system reset in debug control register DBCR
654 */
Stefan Roese03687752006-10-07 11:30:52 +0200655 mtspr(dbcr0, 0x30000000);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200656#endif /* defined(CONFIG_SYS_4xx_RESET_TYPE) */
Stefan Roese03687752006-10-07 11:30:52 +0200657#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roese326c9712005-08-01 16:41:48 +0200658
wdenkc6097192002-11-03 00:24:07 +0000659 return 1;
660}
wdenkc6097192002-11-03 00:24:07 +0000661
662
663/*
664 * Get timebase clock frequency
665 */
666unsigned long get_tbclk (void)
667{
Stefan Roese42f2a822005-11-27 19:36:26 +0100668#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000669 sys_info_t sys_info;
670
671 get_sys_info(&sys_info);
672 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000673#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100674 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000675#endif
676
677}
678
679
680#if defined(CONFIG_WATCHDOG)
Stefan Roese6964fd62007-11-09 12:18:54 +0100681void watchdog_reset(void)
wdenkc6097192002-11-03 00:24:07 +0000682{
683 int re_enable = disable_interrupts();
684 reset_4xx_watchdog();
685 if (re_enable) enable_interrupts();
686}
687
Stefan Roese6964fd62007-11-09 12:18:54 +0100688void reset_4xx_watchdog(void)
wdenkc6097192002-11-03 00:24:07 +0000689{
690 /*
691 * Clear TSR(WIS) bit
692 */
693 mtspr(tsr, 0x40000000);
694}
695#endif /* CONFIG_WATCHDOG */