blob: bc9335a05ea71a617c4bce2b6d163b4a79416625 [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
Stefan Roese42fbddd2006-09-07 11:51:23 +020044#if defined(CONFIG_405GP) || \
45 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
46 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010047
48#define PCI_ASYNC
49
Stefan Roese6964fd62007-11-09 12:18:54 +010050static int pci_async_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010051{
52#if defined(CONFIG_405GP)
53 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010054#endif
55
Stefan Roese42fbddd2006-09-07 11:51:23 +020056#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +010057 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
58 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese99644742005-11-29 18:18:21 +010059 unsigned long val;
60
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010061 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010062 return (val & SDR0_SDSTP1_PAME_MASK);
63#endif
64}
65#endif
66
Stefan Roese153b3e22007-10-05 17:10:59 +020067#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \
68 !defined(CONFIG_405) && !defined(CONFIG_405EX)
Stefan Roese6964fd62007-11-09 12:18:54 +010069static int pci_arbiter_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +010070{
71#if defined(CONFIG_405GP)
72 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
73#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010074
Stefan Roese99644742005-11-29 18:18:21 +010075#if defined(CONFIG_405EP)
76 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010077#endif
78
79#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010080 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
81#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010082
Stefan Roese84382432007-02-02 12:44:22 +010083#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010084 unsigned long val;
85
Stefan Roese84382432007-02-02 12:44:22 +010086 mfsdr(sdr_xcr, val);
87 return (val & 0x80000000);
88#endif
89#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roesecc019d12008-03-11 15:05:50 +010090 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
91 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese84382432007-02-02 12:44:22 +010092 unsigned long val;
93
94 mfsdr(sdr_pci0, val);
95 return (val & 0x80000000);
Stefan Roese42f2a822005-11-27 19:36:26 +010096#endif
Stefan Roese99644742005-11-29 18:18:21 +010097}
98#endif
99
Stefan Roese6964fd62007-11-09 12:18:54 +0100100#if defined(CONFIG_405EP)
Stefan Roese99644742005-11-29 18:18:21 +0100101#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100102
Stefan Roese6964fd62007-11-09 12:18:54 +0100103static int i2c_bootrom_enabled(void)
Stefan Roese99644742005-11-29 18:18:21 +0100104{
105#if defined(CONFIG_405EP)
106 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200107#else
Stefan Roese99644742005-11-29 18:18:21 +0100108 unsigned long val;
109
110 mfsdr(sdr_sdcs, val);
111 return (val & SDR0_SDCS_SDD);
112#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200113}
Stefan Roese3a75ac12007-04-18 12:05:59 +0200114#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200115
116#if defined(CONFIG_440GX)
117#define SDR0_PINSTP_SHIFT 29
118static char *bootstrap_str[] = {
119 "EBC (16 bits)",
120 "EBC (8 bits)",
121 "EBC (32 bits)",
122 "EBC (8 bits)",
123 "PCI",
124 "I2C (Addr 0x54)",
125 "Reserved",
126 "I2C (Addr 0x50)",
127};
Benoît Monin1a70cf22007-06-04 08:36:05 +0200128static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200129#endif
130
131#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
132#define SDR0_PINSTP_SHIFT 30
133static char *bootstrap_str[] = {
134 "EBC (8 bits)",
135 "PCI",
136 "I2C (Addr 0x54)",
137 "I2C (Addr 0x50)",
138};
Benoît Monin1a70cf22007-06-04 08:36:05 +0200139static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
Stefan Roese42fbddd2006-09-07 11:51:23 +0200140#endif
141
142#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
143#define SDR0_PINSTP_SHIFT 29
144static char *bootstrap_str[] = {
145 "EBC (8 bits)",
146 "PCI",
147 "NAND (8 bits)",
148 "EBC (16 bits)",
149 "EBC (16 bits)",
150 "I2C (Addr 0x54)",
151 "PCI",
152 "I2C (Addr 0x52)",
153};
Benoît Monin1a70cf22007-06-04 08:36:05 +0200154static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese42fbddd2006-09-07 11:51:23 +0200155#endif
156
157#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
158#define SDR0_PINSTP_SHIFT 29
159static char *bootstrap_str[] = {
160 "EBC (8 bits)",
161 "EBC (16 bits)",
162 "EBC (16 bits)",
163 "NAND (8 bits)",
164 "PCI",
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
Stefan Roesecc019d12008-03-11 15:05:50 +0100172#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
173#define SDR0_PINSTP_SHIFT 29
174static char *bootstrap_str[] = {
175 "EBC (8 bits)",
176 "EBC (16 bits)",
177 "PCI",
178 "PCI",
179 "EBC (16 bits)",
180 "NAND (8 bits)",
181 "I2C (Addr 0x54)", /* A8 */
182 "I2C (Addr 0x52)", /* A4 */
183};
184static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
185#endif
186
Feng Kan224bc962008-07-08 22:47:31 -0700187#if defined(CONFIG_460SX)
188#define SDR0_PINSTP_SHIFT 29
189static char *bootstrap_str[] = {
190 "EBC (8 bits)",
191 "EBC (16 bits)",
192 "EBC (32 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' };
198#endif
199
Stefan Roese3a75ac12007-04-18 12:05:59 +0200200#if defined(CONFIG_405EZ)
201#define SDR0_PINSTP_SHIFT 28
202static char *bootstrap_str[] = {
203 "EBC (8 bits)",
204 "SPI (fast)",
205 "NAND (512 page, 4 addr cycle)",
206 "I2C (Addr 0x50)",
207 "EBC (32 bits)",
208 "I2C (Addr 0x50)",
209 "NAND (2K page, 5 addr cycle)",
210 "I2C (Addr 0x50)",
211 "EBC (16 bits)",
212 "Reserved",
213 "NAND (2K page, 4 addr cycle)",
214 "I2C (Addr 0x50)",
215 "NAND (512 page, 3 addr cycle)",
216 "I2C (Addr 0x50)",
217 "SPI (slow)",
218 "I2C (Addr 0x50)",
219};
Benoît Monin1a70cf22007-06-04 08:36:05 +0200220static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
221 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
Stefan Roese3a75ac12007-04-18 12:05:59 +0200222#endif
223
Stefan Roese153b3e22007-10-05 17:10:59 +0200224#if defined(CONFIG_405EX)
225#define SDR0_PINSTP_SHIFT 29
226static char *bootstrap_str[] = {
227 "EBC (8 bits)",
228 "EBC (16 bits)",
229 "EBC (16 bits)",
230 "NAND (8 bits)",
231 "NAND (8 bits)",
232 "I2C (Addr 0x54)",
233 "EBC (8 bits)",
234 "I2C (Addr 0x52)",
235};
236static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
237#endif
238
Stefan Roese42fbddd2006-09-07 11:51:23 +0200239#if defined(SDR0_PINSTP_SHIFT)
240static int bootstrap_option(void)
241{
242 unsigned long val;
243
Stefan Roese3a75ac12007-04-18 12:05:59 +0200244 mfsdr(SDR_PINSTP, val);
245 return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100246}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200247#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100248
249
wdenkc6097192002-11-03 00:24:07 +0000250#if defined(CONFIG_440)
Stefan Roese6964fd62007-11-09 12:18:54 +0100251static int do_chip_reset (unsigned long sys0, unsigned long sys1)
252{
253 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
254 * reset.
255 */
256 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
257 mtdcr (cpc0_sys0, sys0);
258 mtdcr (cpc0_sys1, sys1);
259 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
260 mtspr (dbcr0, 0x20000000); /* Reset the chip */
261
262 return 1;
263}
wdenkc6097192002-11-03 00:24:07 +0000264#endif
265
wdenkc6097192002-11-03 00:24:07 +0000266
267int checkcpu (void)
268{
Stefan Roese42f2a822005-11-27 19:36:26 +0100269#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100270 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000271 ulong clock = gd->cpu_clk;
272 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000273
Stefan Roese42f2a822005-11-27 19:36:26 +0100274#if !defined(CONFIG_IOP480)
Wolfgang Denk65505432006-10-20 17:54:33 +0200275 char addstr[64] = "";
Stefan Roese42f2a822005-11-27 19:36:26 +0100276 sys_info_t sys_info;
wdenkc6097192002-11-03 00:24:07 +0000277
278 puts ("CPU: ");
279
280 get_sys_info(&sys_info);
281
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200282#if defined(CONFIG_XILINX_440)
283 puts("IBM PowerPC 4");
284#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100285 puts("AMCC PowerPC 4");
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200286#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100287
Stefan Roese17ffbc82007-03-21 13:38:59 +0100288#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Stefan Roese153b3e22007-10-05 17:10:59 +0200289 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
290 defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100291 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000292#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100293#if defined(CONFIG_440)
Stefan Roesecc019d12008-03-11 15:05:50 +0100294#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
295 puts("60");
296#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100297 puts("40");
stroese434979e2003-05-23 11:18:02 +0000298#endif
Stefan Roesecc019d12008-03-11 15:05:50 +0100299#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100300
wdenkc6097192002-11-03 00:24:07 +0000301 switch (pvr) {
302 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100303 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000304 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100305
wdenkc6097192002-11-03 00:24:07 +0000306 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100307 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000308 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100309
wdenkc6097192002-11-03 00:24:07 +0000310 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100311 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000312 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100313
wdenkc35ba4e2004-03-14 22:25:36 +0000314#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100315 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
316 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000317 break;
318#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100319
wdenkc6097192002-11-03 00:24:07 +0000320 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100321 puts("CR Rev. A");
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_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100325 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000326 break;
wdenkc6097192002-11-03 00:24:07 +0000327
Stefan Roese42f2a822005-11-27 19:36:26 +0100328#ifdef CONFIG_405CR
329 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
330 puts("CR Rev. C");
331 break;
wdenkc6097192002-11-03 00:24:07 +0000332#endif
333
Stefan Roese42f2a822005-11-27 19:36:26 +0100334 case PVR_405GPR_RB:
335 puts("GPr Rev. B");
336 break;
wdenkc6097192002-11-03 00:24:07 +0000337
Stefan Roese42f2a822005-11-27 19:36:26 +0100338 case PVR_405EP_RB:
339 puts("EP Rev. B");
340 break;
wdenkc6097192002-11-03 00:24:07 +0000341
Stefan Roese17ffbc82007-03-21 13:38:59 +0100342 case PVR_405EZ_RA:
343 puts("EZ Rev. A");
344 break;
345
Stefan Roese153b3e22007-10-05 17:10:59 +0200346 case PVR_405EX1_RA:
347 puts("EX Rev. A");
348 strcpy(addstr, "Security support");
349 break;
350
351 case PVR_405EX2_RA:
352 puts("EX Rev. A");
353 strcpy(addstr, "No Security support");
354 break;
355
356 case PVR_405EXR1_RA:
357 puts("EXr Rev. A");
358 strcpy(addstr, "Security support");
359 break;
360
361 case PVR_405EXR2_RA:
362 puts("EXr Rev. A");
363 strcpy(addstr, "No Security support");
364 break;
365
Stefan Roesefbf24302008-05-13 20:22:01 +0200366 case PVR_405EX1_RC:
367 puts("EX Rev. C");
368 strcpy(addstr, "Security support");
369 break;
370
371 case PVR_405EX2_RC:
372 puts("EX Rev. C");
373 strcpy(addstr, "No Security support");
374 break;
375
376 case PVR_405EXR1_RC:
377 puts("EXr Rev. C");
378 strcpy(addstr, "Security support");
379 break;
380
381 case PVR_405EXR2_RC:
382 puts("EXr Rev. C");
383 strcpy(addstr, "No Security support");
384 break;
385
wdenkc6097192002-11-03 00:24:07 +0000386#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000387 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200388 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000389 /* See errata 1.12: CHIP_4 */
390 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
391 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
392 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
393 "Resetting chip ...\n");
394 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
395 do_chip_reset ( mfdcr(cpc0_strp0),
396 mfdcr(cpc0_strp1) );
397 }
wdenkc6097192002-11-03 00:24:07 +0000398 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100399
wdenk57b2d802003-06-27 21:31:46 +0000400 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200401 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000402 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100403
wdenk544e9732004-02-06 23:19:44 +0000404 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200405 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000406 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100407
wdenk544e9732004-02-06 23:19:44 +0000408 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200409 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000410 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100411
stroesec0125272005-04-07 05:33:41 +0000412 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200413 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000414 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100415
Stefan Roese08fb4042005-11-01 10:08:03 +0100416 case PVR_440GX_RF:
417 puts("GX Rev. F");
418 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100419
Stefan Roese326c9712005-08-01 16:41:48 +0200420 case PVR_440EP_RA:
421 puts("EP Rev. A");
422 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100423
Stefan Roese95258d52005-10-04 15:00:30 +0200424#ifdef CONFIG_440EP
425 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200426 puts("EP Rev. B");
427 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200428
429 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
430 puts("EP Rev. C");
431 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200432#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100433
Stefan Roese95258d52005-10-04 15:00:30 +0200434#ifdef CONFIG_440GR
435 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
436 puts("GR Rev. A");
437 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200438
Stefan Roese96467d62006-05-18 19:21:53 +0200439 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200440 puts("GR Rev. B");
441 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200442#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100443#endif /* CONFIG_440 */
444
Stefan Roese188fab62007-01-31 16:56:10 +0100445#ifdef CONFIG_440EPX
446 case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200447 puts("EPx Rev. A");
448 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200449 break;
450
Stefan Roese188fab62007-01-31 16:56:10 +0100451 case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200452 puts("EPx Rev. A");
453 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200454 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100455#endif /* CONFIG_440EPX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200456
Stefan Roese188fab62007-01-31 16:56:10 +0100457#ifdef CONFIG_440GRX
458 case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200459 puts("GRx Rev. A");
460 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200461 break;
462
Stefan Roese188fab62007-01-31 16:56:10 +0100463 case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roese11dd8812006-10-18 15:59:35 +0200464 puts("GRx Rev. A");
465 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200466 break;
Stefan Roese188fab62007-01-31 16:56:10 +0100467#endif /* CONFIG_440GRX */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200468
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100469 case PVR_440SP_6_RAB:
470 puts("SP Rev. A/B");
471 strcpy(addstr, "RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100472 break;
473
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100474 case PVR_440SP_RAB:
475 puts("SP Rev. A/B");
476 strcpy(addstr, "No RAID 6 support");
Stefan Roese99644742005-11-29 18:18:21 +0100477 break;
478
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100479 case PVR_440SP_6_RC:
480 puts("SP Rev. C");
481 strcpy(addstr, "RAID 6 support");
482 break;
483
Stefan Roesec6d59302006-11-28 16:09:24 +0100484 case PVR_440SP_RC:
485 puts("SP Rev. C");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100486 strcpy(addstr, "No RAID 6 support");
Stefan Roesec6d59302006-11-28 16:09:24 +0100487 break;
488
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100489 case PVR_440SPe_6_RA:
490 puts("SPe Rev. A");
491 strcpy(addstr, "RAID 6 support");
492 break;
493
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200494 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200495 puts("SPe Rev. A");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100496 strcpy(addstr, "No RAID 6 support");
497 break;
498
499 case PVR_440SPe_6_RB:
500 puts("SPe Rev. B");
501 strcpy(addstr, "RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200502 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200503
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200504 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200505 puts("SPe Rev. B");
Stefan Roesef4b01bf2007-01-13 08:01:03 +0100506 strcpy(addstr, "No RAID 6 support");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200507 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200508
Stefan Roesecc019d12008-03-11 15:05:50 +0100509 case PVR_460EX_RA:
510 puts("EX Rev. A");
511 strcpy(addstr, "No Security/Kasumi support");
512 break;
513
514 case PVR_460EX_SE_RA:
515 puts("EX Rev. A");
516 strcpy(addstr, "Security/Kasumi support");
517 break;
518
519 case PVR_460GT_RA:
520 puts("GT Rev. A");
521 strcpy(addstr, "No Security/Kasumi support");
522 break;
523
524 case PVR_460GT_SE_RA:
525 puts("GT Rev. A");
526 strcpy(addstr, "Security/Kasumi support");
527 break;
528
Feng Kan224bc962008-07-08 22:47:31 -0700529 case PVR_460SX_RA:
530 puts("SX Rev. A");
531 strcpy(addstr, "Security support");
532 break;
533
534 case PVR_460SX_RA_V1:
535 puts("SX Rev. A");
536 strcpy(addstr, "No Security support");
537 break;
538
539 case PVR_460GX_RA:
540 puts("GX Rev. A");
541 strcpy(addstr, "Security support");
542 break;
543
544 case PVR_460GX_RA_V1:
545 puts("GX Rev. A");
546 strcpy(addstr, "No Security support");
547 break;
548
Ricardo Ribalda Delgado95c50202008-07-17 11:44:12 +0200549 case PVR_VIRTEX5:
550 puts("x5 VIRTEX5");
551 break;
552
wdenk57b2d802003-06-27 21:31:46 +0000553 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200554 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000555 break;
556 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100557
558 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
Stefan Roese17ffbc82007-03-21 13:38:59 +0100559 sys_info.freqPLB / 1000000,
560 get_OPB_freq() / 1000000,
Stefan Roese153b3e22007-10-05 17:10:59 +0200561 sys_info.freqEBC / 1000000);
Stefan Roese42f2a822005-11-27 19:36:26 +0100562
Stefan Roese11dd8812006-10-18 15:59:35 +0200563 if (addstr[0] != 0)
564 printf(" %s\n", addstr);
565
Stefan Roese99644742005-11-29 18:18:21 +0100566#if defined(I2C_BOOTROM)
567 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese3a75ac12007-04-18 12:05:59 +0200568#endif /* I2C_BOOTROM */
Stefan Roese42fbddd2006-09-07 11:51:23 +0200569#if defined(SDR0_PINSTP_SHIFT)
Benoît Monin1a70cf22007-06-04 08:36:05 +0200570 printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200571 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
Wolfgang Denk65505432006-10-20 17:54:33 +0200572#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100573
Stefan Roese153b3e22007-10-05 17:10:59 +0200574#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese99644742005-11-29 18:18:21 +0100575 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100576#endif
577
Stefan Roese99644742005-11-29 18:18:21 +0100578#if defined(PCI_ASYNC)
579 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100580 printf (", PCI async ext clock used");
581 } else {
582 printf (", PCI sync clock at %lu MHz",
583 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
584 }
wdenkc6097192002-11-03 00:24:07 +0000585#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100586
Stefan Roese153b3e22007-10-05 17:10:59 +0200587#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100588 putc('\n');
589#endif
590
Stefan Roese153b3e22007-10-05 17:10:59 +0200591#if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
Stefan Roese42f2a822005-11-27 19:36:26 +0100592 printf (" 16 kB I-Cache 16 kB D-Cache");
593#elif defined(CONFIG_440)
594 printf (" 32 kB I-Cache 32 kB D-Cache");
595#else
596 printf (" 16 kB I-Cache %d kB D-Cache",
597 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
598#endif
599#endif /* !defined(CONFIG_IOP480) */
600
601#if defined(CONFIG_IOP480)
602 printf ("PLX IOP480 (PVR=%08x)", pvr);
603 printf (" at %s MHz:", strmhz(buf, clock));
604 printf (" %u kB I-Cache", 4);
605 printf (" %u kB D-Cache", 2);
606#endif
607
608#endif /* !defined(CONFIG_405) */
609
610 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000611
612 return 0;
613}
614
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200615int ppc440spe_revB() {
616 unsigned int pvr;
617
618 pvr = get_pvr();
Stefan Roese1456a772007-01-15 09:46:29 +0100619 if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB))
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200620 return 1;
621 else
622 return 0;
623}
wdenkc6097192002-11-03 00:24:07 +0000624
625/* ------------------------------------------------------------------------- */
626
wdenk57b2d802003-06-27 21:31:46 +0000627int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000628{
Stefan Roeseecf05b22006-11-27 14:48:41 +0100629#if defined(CONFIG_BOARD_RESET)
630 board_reset();
Stefan Roesea5232952006-11-27 14:52:04 +0100631#else
Stefan Roese2a4a9432006-11-27 14:12:17 +0100632#if defined(CFG_4xx_RESET_TYPE)
633 mtspr(dbcr0, CFG_4xx_RESET_TYPE << 28);
Stefan Roese326c9712005-08-01 16:41:48 +0200634#else
wdenk57b2d802003-06-27 21:31:46 +0000635 /*
636 * Initiate system reset in debug control register DBCR
637 */
Stefan Roese03687752006-10-07 11:30:52 +0200638 mtspr(dbcr0, 0x30000000);
Stefan Roesea5232952006-11-27 14:52:04 +0100639#endif /* defined(CFG_4xx_RESET_TYPE) */
Stefan Roese03687752006-10-07 11:30:52 +0200640#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roese326c9712005-08-01 16:41:48 +0200641
wdenkc6097192002-11-03 00:24:07 +0000642 return 1;
643}
wdenkc6097192002-11-03 00:24:07 +0000644
645
646/*
647 * Get timebase clock frequency
648 */
649unsigned long get_tbclk (void)
650{
Stefan Roese42f2a822005-11-27 19:36:26 +0100651#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000652 sys_info_t sys_info;
653
654 get_sys_info(&sys_info);
655 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000656#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100657 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000658#endif
659
660}
661
662
663#if defined(CONFIG_WATCHDOG)
Stefan Roese6964fd62007-11-09 12:18:54 +0100664void watchdog_reset(void)
wdenkc6097192002-11-03 00:24:07 +0000665{
666 int re_enable = disable_interrupts();
667 reset_4xx_watchdog();
668 if (re_enable) enable_interrupts();
669}
670
Stefan Roese6964fd62007-11-09 12:18:54 +0100671void reset_4xx_watchdog(void)
wdenkc6097192002-11-03 00:24:07 +0000672{
673 /*
674 * Clear TSR(WIS) bit
675 */
676 mtspr(tsr, 0x40000000);
677}
678#endif /* CONFIG_WATCHDOG */