blob: 39f439df9881dabc3d85196bc9892cf87c919009 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
Stefan Roesedbbd1252007-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 Denkd87080b2006-03-31 18:32:53 +020040DECLARE_GLOBAL_DATA_PTR;
Wolfgang Denkd87080b2006-03-31 18:32:53 +020041
Stefan Roesef3443862006-10-07 11:30:52 +020042void board_reset(void);
Stefan Roesef3443862006-10-07 11:30:52 +020043
Stefan Roese887e2ec2006-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 Roese6e7fb6e2005-11-29 18:18:21 +010047
48#define PCI_ASYNC
49
Stefan Roesec7f69c32007-11-09 12:18:54 +010050static int pci_async_enabled(void)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010051{
52#if defined(CONFIG_405GP)
53 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
54#endif
55
Stefan Roese887e2ec2006-09-07 11:51:23 +020056#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roese2801b2d2008-03-11 15:05:50 +010057 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
58 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010059 unsigned long val;
60
Wolfgang Denk74812662005-12-12 16:06:05 +010061 mfsdr(sdr_sdstp1, val);
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010062 return (val & SDR0_SDSTP1_PAME_MASK);
63#endif
64}
65#endif
66
Stefan Roesedbbd1252007-10-05 17:10:59 +020067#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && \
68 !defined(CONFIG_405) && !defined(CONFIG_405EX)
Stefan Roesec7f69c32007-11-09 12:18:54 +010069static int pci_arbiter_enabled(void)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010070{
71#if defined(CONFIG_405GP)
72 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
73#endif
74
75#if defined(CONFIG_405EP)
76 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
77#endif
78
79#if defined(CONFIG_440GP)
80 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
81#endif
82
Stefan Roese7372ca62007-02-02 12:44:22 +010083#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010084 unsigned long val;
85
Stefan Roese7372ca62007-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 Roese2801b2d2008-03-11 15:05:50 +010090 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
91 defined(CONFIG_460EX) || defined(CONFIG_460GT)
Stefan Roese7372ca62007-02-02 12:44:22 +010092 unsigned long val;
93
94 mfsdr(sdr_pci0, val);
95 return (val & 0x80000000);
Stefan Roese6e7fb6e2005-11-29 18:18:21 +010096#endif
97}
98#endif
99
Stefan Roesec7f69c32007-11-09 12:18:54 +0100100#if defined(CONFIG_405EP)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100101#define I2C_BOOTROM
102
Stefan Roesec7f69c32007-11-09 12:18:54 +0100103static int i2c_bootrom_enabled(void)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100104{
105#if defined(CONFIG_405EP)
106 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese887e2ec2006-09-07 11:51:23 +0200107#else
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100108 unsigned long val;
109
110 mfsdr(sdr_sdcs, val);
111 return (val & SDR0_SDCS_SDD);
112#endif
113}
Stefan Roese90e6f412007-04-18 12:05:59 +0200114#endif
Stefan Roese887e2ec2006-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 Monine3cbe1f2007-06-04 08:36:05 +0200128static char bootstrap_char[] = { 'A', 'B', 'C', 'B', 'D', 'E', 'x', 'F' };
Stefan Roese887e2ec2006-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 Monine3cbe1f2007-06-04 08:36:05 +0200139static char bootstrap_char[] = { 'A', 'B', 'C', 'D'};
Stefan Roese887e2ec2006-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 Monine3cbe1f2007-06-04 08:36:05 +0200154static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese887e2ec2006-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 Monine3cbe1f2007-06-04 08:36:05 +0200169static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
Stefan Roese887e2ec2006-09-07 11:51:23 +0200170#endif
171
Stefan Roese2801b2d2008-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
Stefan Roese90e6f412007-04-18 12:05:59 +0200187#if defined(CONFIG_405EZ)
188#define SDR0_PINSTP_SHIFT 28
189static char *bootstrap_str[] = {
190 "EBC (8 bits)",
191 "SPI (fast)",
192 "NAND (512 page, 4 addr cycle)",
193 "I2C (Addr 0x50)",
194 "EBC (32 bits)",
195 "I2C (Addr 0x50)",
196 "NAND (2K page, 5 addr cycle)",
197 "I2C (Addr 0x50)",
198 "EBC (16 bits)",
199 "Reserved",
200 "NAND (2K page, 4 addr cycle)",
201 "I2C (Addr 0x50)",
202 "NAND (512 page, 3 addr cycle)",
203 "I2C (Addr 0x50)",
204 "SPI (slow)",
205 "I2C (Addr 0x50)",
206};
Benoît Monine3cbe1f2007-06-04 08:36:05 +0200207static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
208 'I', 'x', 'K', 'L', 'M', 'N', 'O', 'P' };
Stefan Roese90e6f412007-04-18 12:05:59 +0200209#endif
210
Stefan Roesedbbd1252007-10-05 17:10:59 +0200211#if defined(CONFIG_405EX)
212#define SDR0_PINSTP_SHIFT 29
213static char *bootstrap_str[] = {
214 "EBC (8 bits)",
215 "EBC (16 bits)",
216 "EBC (16 bits)",
217 "NAND (8 bits)",
218 "NAND (8 bits)",
219 "I2C (Addr 0x54)",
220 "EBC (8 bits)",
221 "I2C (Addr 0x52)",
222};
223static char bootstrap_char[] = { 'A', 'B', 'C', 'D', 'E', 'G', 'F', 'H' };
224#endif
225
Stefan Roese887e2ec2006-09-07 11:51:23 +0200226#if defined(SDR0_PINSTP_SHIFT)
227static int bootstrap_option(void)
228{
229 unsigned long val;
230
Stefan Roese90e6f412007-04-18 12:05:59 +0200231 mfsdr(SDR_PINSTP, val);
232 return ((val & 0xf0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese887e2ec2006-09-07 11:51:23 +0200233}
234#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100235
Stefan Roese3d9569b2005-11-27 19:36:26 +0100236
237#if defined(CONFIG_440)
Stefan Roesec7f69c32007-11-09 12:18:54 +0100238static int do_chip_reset (unsigned long sys0, unsigned long sys1)
239{
240 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
241 * reset.
242 */
243 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
244 mtdcr (cpc0_sys0, sys0);
245 mtdcr (cpc0_sys1, sys1);
246 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
247 mtspr (dbcr0, 0x20000000); /* Reset the chip */
248
249 return 1;
250}
Stefan Roese3d9569b2005-11-27 19:36:26 +0100251#endif
252
wdenkc6097192002-11-03 00:24:07 +0000253
254int checkcpu (void)
255{
Stefan Roese3d9569b2005-11-27 19:36:26 +0100256#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese3d9569b2005-11-27 19:36:26 +0100257 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000258 ulong clock = gd->cpu_clk;
259 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000260
Stefan Roese3d9569b2005-11-27 19:36:26 +0100261#if !defined(CONFIG_IOP480)
Wolfgang Denkba999c52006-10-20 17:54:33 +0200262 char addstr[64] = "";
Stefan Roese3d9569b2005-11-27 19:36:26 +0100263 sys_info_t sys_info;
wdenkc6097192002-11-03 00:24:07 +0000264
265 puts ("CPU: ");
266
267 get_sys_info(&sys_info);
268
Stefan Roese3d9569b2005-11-27 19:36:26 +0100269 puts("AMCC PowerPC 4");
270
Stefan Roesee01bd212007-03-21 13:38:59 +0100271#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Stefan Roesedbbd1252007-10-05 17:10:59 +0200272 defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
273 defined(CONFIG_405EX)
Stefan Roese3d9569b2005-11-27 19:36:26 +0100274 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000275#endif
Stefan Roese3d9569b2005-11-27 19:36:26 +0100276#if defined(CONFIG_440)
Stefan Roese2801b2d2008-03-11 15:05:50 +0100277#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
278 puts("60");
279#else
Stefan Roese3d9569b2005-11-27 19:36:26 +0100280 puts("40");
wdenkc6097192002-11-03 00:24:07 +0000281#endif
Stefan Roese2801b2d2008-03-11 15:05:50 +0100282#endif
Stefan Roese3d9569b2005-11-27 19:36:26 +0100283
wdenkc6097192002-11-03 00:24:07 +0000284 switch (pvr) {
285 case PVR_405GP_RB:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100286 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000287 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100288
wdenkc6097192002-11-03 00:24:07 +0000289 case PVR_405GP_RC:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100290 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000291 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100292
wdenkc6097192002-11-03 00:24:07 +0000293 case PVR_405GP_RD:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100294 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000295 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100296
wdenk42dfe7a2004-03-14 22:25:36 +0000297#ifdef CONFIG_405GP
Stefan Roese3d9569b2005-11-27 19:36:26 +0100298 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
299 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000300 break;
301#endif
Stefan Roese3d9569b2005-11-27 19:36:26 +0100302
wdenkc6097192002-11-03 00:24:07 +0000303 case PVR_405CR_RA:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100304 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000305 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100306
wdenkc6097192002-11-03 00:24:07 +0000307 case PVR_405CR_RB:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100308 puts("CR Rev. B");
309 break;
310
311#ifdef CONFIG_405CR
312 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
313 puts("CR Rev. C");
314 break;
315#endif
316
317 case PVR_405GPR_RB:
318 puts("GPr Rev. B");
319 break;
320
stroeseb867d702003-05-23 11:18:02 +0000321 case PVR_405EP_RB:
Stefan Roese3d9569b2005-11-27 19:36:26 +0100322 puts("EP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000323 break;
wdenkc6097192002-11-03 00:24:07 +0000324
Stefan Roesee01bd212007-03-21 13:38:59 +0100325 case PVR_405EZ_RA:
326 puts("EZ Rev. A");
327 break;
328
Stefan Roesedbbd1252007-10-05 17:10:59 +0200329 case PVR_405EX1_RA:
330 puts("EX Rev. A");
331 strcpy(addstr, "Security support");
332 break;
333
334 case PVR_405EX2_RA:
335 puts("EX Rev. A");
336 strcpy(addstr, "No Security support");
337 break;
338
339 case PVR_405EXR1_RA:
340 puts("EXr Rev. A");
341 strcpy(addstr, "Security support");
342 break;
343
344 case PVR_405EXR2_RA:
345 puts("EXr Rev. A");
346 strcpy(addstr, "No Security support");
347 break;
348
Stefan Roese70fab192008-05-13 20:22:01 +0200349 case PVR_405EX1_RC:
350 puts("EX Rev. C");
351 strcpy(addstr, "Security support");
352 break;
353
354 case PVR_405EX2_RC:
355 puts("EX Rev. C");
356 strcpy(addstr, "No Security support");
357 break;
358
359 case PVR_405EXR1_RC:
360 puts("EXr Rev. C");
361 strcpy(addstr, "Security support");
362 break;
363
364 case PVR_405EXR2_RC:
365 puts("EXr Rev. C");
366 strcpy(addstr, "No Security support");
367 break;
368
wdenkc6097192002-11-03 00:24:07 +0000369#if defined(CONFIG_440)
wdenk8bde7f72003-06-27 21:31:46 +0000370 case PVR_440GP_RB:
Stefan Roesec157d8e2005-08-01 16:41:48 +0200371 puts("GP Rev. B");
wdenk4d816772003-09-03 14:03:26 +0000372 /* See errata 1.12: CHIP_4 */
373 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
374 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
375 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
376 "Resetting chip ...\n");
377 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
378 do_chip_reset ( mfdcr(cpc0_strp0),
379 mfdcr(cpc0_strp1) );
380 }
wdenkc6097192002-11-03 00:24:07 +0000381 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100382
wdenk8bde7f72003-06-27 21:31:46 +0000383 case PVR_440GP_RC:
Stefan Roesec157d8e2005-08-01 16:41:48 +0200384 puts("GP Rev. C");
wdenkba56f622004-02-06 23:19:44 +0000385 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100386
wdenkba56f622004-02-06 23:19:44 +0000387 case PVR_440GX_RA:
Stefan Roesec157d8e2005-08-01 16:41:48 +0200388 puts("GX Rev. A");
wdenkba56f622004-02-06 23:19:44 +0000389 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100390
wdenkba56f622004-02-06 23:19:44 +0000391 case PVR_440GX_RB:
Stefan Roesec157d8e2005-08-01 16:41:48 +0200392 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000393 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100394
stroese0a7c5392005-04-07 05:33:41 +0000395 case PVR_440GX_RC:
Stefan Roesec157d8e2005-08-01 16:41:48 +0200396 puts("GX Rev. C");
stroese0a7c5392005-04-07 05:33:41 +0000397 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100398
Stefan Roese57275b62005-11-01 10:08:03 +0100399 case PVR_440GX_RF:
400 puts("GX Rev. F");
401 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100402
Stefan Roesec157d8e2005-08-01 16:41:48 +0200403 case PVR_440EP_RA:
404 puts("EP Rev. A");
405 break;
Stefan Roese3d9569b2005-11-27 19:36:26 +0100406
Stefan Roese9a8d82f2005-10-04 15:00:30 +0200407#ifdef CONFIG_440EP
408 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roesec157d8e2005-08-01 16:41:48 +0200409 puts("EP Rev. B");
410 break;
Stefan Roese512f8d52006-05-10 14:10:41 +0200411
412 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
413 puts("EP Rev. C");
414 break;
Stefan Roese9a8d82f2005-10-04 15:00:30 +0200415#endif /* CONFIG_440EP */
Stefan Roese3d9569b2005-11-27 19:36:26 +0100416
Stefan Roese9a8d82f2005-10-04 15:00:30 +0200417#ifdef CONFIG_440GR
418 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
419 puts("GR Rev. A");
420 break;
Stefan Roese512f8d52006-05-10 14:10:41 +0200421
Stefan Roese5770a1e2006-05-18 19:21:53 +0200422 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese512f8d52006-05-10 14:10:41 +0200423 puts("GR Rev. B");
424 break;
Stefan Roese9a8d82f2005-10-04 15:00:30 +0200425#endif /* CONFIG_440GR */
Stefan Roese3d9569b2005-11-27 19:36:26 +0100426#endif /* CONFIG_440 */
427
Stefan Roese2902fad2007-01-31 16:56:10 +0100428#ifdef CONFIG_440EPX
429 case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roeseedf0b542006-10-18 15:59:35 +0200430 puts("EPx Rev. A");
431 strcpy(addstr, "Security/Kasumi support");
Stefan Roese887e2ec2006-09-07 11:51:23 +0200432 break;
433
Stefan Roese2902fad2007-01-31 16:56:10 +0100434 case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roeseedf0b542006-10-18 15:59:35 +0200435 puts("EPx Rev. A");
436 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese887e2ec2006-09-07 11:51:23 +0200437 break;
Stefan Roese2902fad2007-01-31 16:56:10 +0100438#endif /* CONFIG_440EPX */
Stefan Roese887e2ec2006-09-07 11:51:23 +0200439
Stefan Roese2902fad2007-01-31 16:56:10 +0100440#ifdef CONFIG_440GRX
441 case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roeseedf0b542006-10-18 15:59:35 +0200442 puts("GRx Rev. A");
443 strcpy(addstr, "Security/Kasumi support");
Stefan Roese887e2ec2006-09-07 11:51:23 +0200444 break;
445
Stefan Roese2902fad2007-01-31 16:56:10 +0100446 case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
Stefan Roeseedf0b542006-10-18 15:59:35 +0200447 puts("GRx Rev. A");
448 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese887e2ec2006-09-07 11:51:23 +0200449 break;
Stefan Roese2902fad2007-01-31 16:56:10 +0100450#endif /* CONFIG_440GRX */
Stefan Roese887e2ec2006-09-07 11:51:23 +0200451
Stefan Roese95981772007-01-13 08:01:03 +0100452 case PVR_440SP_6_RAB:
453 puts("SP Rev. A/B");
454 strcpy(addstr, "RAID 6 support");
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100455 break;
456
Stefan Roese95981772007-01-13 08:01:03 +0100457 case PVR_440SP_RAB:
458 puts("SP Rev. A/B");
459 strcpy(addstr, "No RAID 6 support");
460 break;
461
462 case PVR_440SP_6_RC:
463 puts("SP Rev. C");
464 strcpy(addstr, "RAID 6 support");
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100465 break;
466
Stefan Roesee732fae2006-11-28 16:09:24 +0100467 case PVR_440SP_RC:
468 puts("SP Rev. C");
Stefan Roese95981772007-01-13 08:01:03 +0100469 strcpy(addstr, "No RAID 6 support");
470 break;
471
472 case PVR_440SPe_6_RA:
473 puts("SPe Rev. A");
474 strcpy(addstr, "RAID 6 support");
Stefan Roesee732fae2006-11-28 16:09:24 +0100475 break;
476
Marian Balakowicz6c5879f2006-06-30 16:30:46 +0200477 case PVR_440SPe_RA:
Marian Balakowiczfe84b482006-07-03 23:42:36 +0200478 puts("SPe Rev. A");
Stefan Roese95981772007-01-13 08:01:03 +0100479 strcpy(addstr, "No RAID 6 support");
480 break;
481
482 case PVR_440SPe_6_RB:
483 puts("SPe Rev. B");
484 strcpy(addstr, "RAID 6 support");
Marian Balakowicz6c5879f2006-06-30 16:30:46 +0200485 break;
Marian Balakowiczfe84b482006-07-03 23:42:36 +0200486
Marian Balakowicz6c5879f2006-06-30 16:30:46 +0200487 case PVR_440SPe_RB:
Marian Balakowiczfe84b482006-07-03 23:42:36 +0200488 puts("SPe Rev. B");
Stefan Roese95981772007-01-13 08:01:03 +0100489 strcpy(addstr, "No RAID 6 support");
Marian Balakowicz6c5879f2006-06-30 16:30:46 +0200490 break;
Marian Balakowiczfe84b482006-07-03 23:42:36 +0200491
Stefan Roese2801b2d2008-03-11 15:05:50 +0100492 case PVR_460EX_RA:
493 puts("EX Rev. A");
494 strcpy(addstr, "No Security/Kasumi support");
495 break;
496
497 case PVR_460EX_SE_RA:
498 puts("EX Rev. A");
499 strcpy(addstr, "Security/Kasumi support");
500 break;
501
502 case PVR_460GT_RA:
503 puts("GT Rev. A");
504 strcpy(addstr, "No Security/Kasumi support");
505 break;
506
507 case PVR_460GT_SE_RA:
508 puts("GT Rev. A");
509 strcpy(addstr, "Security/Kasumi support");
510 break;
511
wdenk8bde7f72003-06-27 21:31:46 +0000512 default:
Stefan Roese17f50f222005-08-04 17:09:16 +0200513 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000514 break;
515 }
Stefan Roese3d9569b2005-11-27 19:36:26 +0100516
517 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
Stefan Roesee01bd212007-03-21 13:38:59 +0100518 sys_info.freqPLB / 1000000,
519 get_OPB_freq() / 1000000,
Stefan Roesedbbd1252007-10-05 17:10:59 +0200520 sys_info.freqEBC / 1000000);
Stefan Roese3d9569b2005-11-27 19:36:26 +0100521
Stefan Roeseedf0b542006-10-18 15:59:35 +0200522 if (addstr[0] != 0)
523 printf(" %s\n", addstr);
524
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100525#if defined(I2C_BOOTROM)
526 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese90e6f412007-04-18 12:05:59 +0200527#endif /* I2C_BOOTROM */
Stefan Roese887e2ec2006-09-07 11:51:23 +0200528#if defined(SDR0_PINSTP_SHIFT)
Benoît Monine3cbe1f2007-06-04 08:36:05 +0200529 printf (" Bootstrap Option %c - ", bootstrap_char[bootstrap_option()]);
Stefan Roese887e2ec2006-09-07 11:51:23 +0200530 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
Wolfgang Denkba999c52006-10-20 17:54:33 +0200531#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese3d9569b2005-11-27 19:36:26 +0100532
Stefan Roesedbbd1252007-10-05 17:10:59 +0200533#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100534 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese3d9569b2005-11-27 19:36:26 +0100535#endif
536
Stefan Roese6e7fb6e2005-11-29 18:18:21 +0100537#if defined(PCI_ASYNC)
538 if (pci_async_enabled()) {
Stefan Roese3d9569b2005-11-27 19:36:26 +0100539 printf (", PCI async ext clock used");
540 } else {
541 printf (", PCI sync clock at %lu MHz",
542 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
543 }
544#endif
545
Stefan Roesedbbd1252007-10-05 17:10:59 +0200546#if defined(CONFIG_PCI) && !defined(CONFIG_405EX)
Stefan Roese3d9569b2005-11-27 19:36:26 +0100547 putc('\n');
548#endif
549
Stefan Roesedbbd1252007-10-05 17:10:59 +0200550#if defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX)
Stefan Roese3d9569b2005-11-27 19:36:26 +0100551 printf (" 16 kB I-Cache 16 kB D-Cache");
552#elif defined(CONFIG_440)
553 printf (" 32 kB I-Cache 32 kB D-Cache");
554#else
555 printf (" 16 kB I-Cache %d kB D-Cache",
556 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
557#endif
558#endif /* !defined(CONFIG_IOP480) */
559
560#if defined(CONFIG_IOP480)
561 printf ("PLX IOP480 (PVR=%08x)", pvr);
562 printf (" at %s MHz:", strmhz(buf, clock));
563 printf (" %u kB I-Cache", 4);
564 printf (" %u kB D-Cache", 2);
565#endif
566
567#endif /* !defined(CONFIG_405) */
568
569 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000570
571 return 0;
572}
573
Rafal Jaworowski692519b2006-08-10 12:43:17 +0200574int ppc440spe_revB() {
575 unsigned int pvr;
576
577 pvr = get_pvr();
Stefan Roese5a5c5692007-01-15 09:46:29 +0100578 if ((pvr == PVR_440SPe_6_RB) || (pvr == PVR_440SPe_RB))
Rafal Jaworowski692519b2006-08-10 12:43:17 +0200579 return 1;
580 else
581 return 0;
582}
wdenkc6097192002-11-03 00:24:07 +0000583
584/* ------------------------------------------------------------------------- */
585
wdenk8bde7f72003-06-27 21:31:46 +0000586int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000587{
Stefan Roese1f94d162006-11-27 14:48:41 +0100588#if defined(CONFIG_BOARD_RESET)
589 board_reset();
Stefan Roese1729b922006-11-27 14:52:04 +0100590#else
Stefan Roese1c2ce222006-11-27 14:12:17 +0100591#if defined(CFG_4xx_RESET_TYPE)
592 mtspr(dbcr0, CFG_4xx_RESET_TYPE << 28);
Stefan Roesec157d8e2005-08-01 16:41:48 +0200593#else
wdenk8bde7f72003-06-27 21:31:46 +0000594 /*
595 * Initiate system reset in debug control register DBCR
596 */
Stefan Roesef3443862006-10-07 11:30:52 +0200597 mtspr(dbcr0, 0x30000000);
Stefan Roese1729b922006-11-27 14:52:04 +0100598#endif /* defined(CFG_4xx_RESET_TYPE) */
Stefan Roesef3443862006-10-07 11:30:52 +0200599#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roesec157d8e2005-08-01 16:41:48 +0200600
wdenkc6097192002-11-03 00:24:07 +0000601 return 1;
602}
603
wdenkc6097192002-11-03 00:24:07 +0000604
605/*
606 * Get timebase clock frequency
607 */
608unsigned long get_tbclk (void)
609{
Stefan Roese3d9569b2005-11-27 19:36:26 +0100610#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000611 sys_info_t sys_info;
612
613 get_sys_info(&sys_info);
614 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000615#else
Stefan Roese3d9569b2005-11-27 19:36:26 +0100616 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000617#endif
618
619}
620
621
622#if defined(CONFIG_WATCHDOG)
Stefan Roesec7f69c32007-11-09 12:18:54 +0100623void watchdog_reset(void)
wdenkc6097192002-11-03 00:24:07 +0000624{
625 int re_enable = disable_interrupts();
626 reset_4xx_watchdog();
627 if (re_enable) enable_interrupts();
628}
629
Stefan Roesec7f69c32007-11-09 12:18:54 +0100630void reset_4xx_watchdog(void)
wdenkc6097192002-11-03 00:24:07 +0000631{
632 /*
633 * Clear TSR(WIS) bit
634 */
635 mtspr(tsr, 0x40000000);
636}
637#endif /* CONFIG_WATCHDOG */