blob: 9c5c9109b1923b30b3816200c854a0c31c07b170 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
Stefan Roese31ce7de2006-05-10 14:10:41 +02002 * (C) Copyright 2000-2006
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 +020040#if !defined(CONFIG_405)
41DECLARE_GLOBAL_DATA_PTR;
42#endif
43
Stefan Roese03687752006-10-07 11:30:52 +020044#if defined(CONFIG_BOARD_RESET)
45void board_reset(void);
46#endif
47
Stefan Roese99644742005-11-29 18:18:21 +010048#if defined(CONFIG_440)
49#define FREQ_EBC (sys_info.freqEPB)
50#else
51#define FREQ_EBC (sys_info.freqPLB / sys_info.pllExtBusDiv)
Stefan Roese42f2a822005-11-27 19:36:26 +010052#endif
53
Stefan Roese42fbddd2006-09-07 11:51:23 +020054#if defined(CONFIG_405GP) || \
55 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
56 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010057
58#define PCI_ASYNC
59
60int pci_async_enabled(void)
61{
62#if defined(CONFIG_405GP)
63 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010064#endif
65
Stefan Roese42fbddd2006-09-07 11:51:23 +020066#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
67 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010068 unsigned long val;
69
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010070 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010071 return (val & SDR0_SDSTP1_PAME_MASK);
72#endif
73}
74#endif
75
Stefan Roesee2c34122005-11-29 19:13:38 +010076#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && !defined(CONFIG_405)
Stefan Roese99644742005-11-29 18:18:21 +010077int pci_arbiter_enabled(void)
78{
79#if defined(CONFIG_405GP)
80 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
81#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010082
Stefan Roese99644742005-11-29 18:18:21 +010083#if defined(CONFIG_405EP)
84 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010085#endif
86
87#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010088 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
89#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010090
Stefan Roese42fbddd2006-09-07 11:51:23 +020091#if defined(CONFIG_440GX) || \
92 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
93 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
94 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010095 unsigned long val;
96
97 mfsdr(sdr_sdstp1, val);
98 return (val & SDR0_SDSTP1_PAE_MASK);
Stefan Roese42f2a822005-11-27 19:36:26 +010099#endif
Stefan Roese99644742005-11-29 18:18:21 +0100100}
101#endif
102
Stefan Roese42fbddd2006-09-07 11:51:23 +0200103#if defined(CONFIG_405EP) || defined(CONFIG_440GX) || \
104 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
105 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
106 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese42f2a822005-11-27 19:36:26 +0100107
Stefan Roese99644742005-11-29 18:18:21 +0100108#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100109
Stefan Roese99644742005-11-29 18:18:21 +0100110int i2c_bootrom_enabled(void)
111{
112#if defined(CONFIG_405EP)
113 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200114#else
Stefan Roese99644742005-11-29 18:18:21 +0100115 unsigned long val;
116
117 mfsdr(sdr_sdcs, val);
118 return (val & SDR0_SDCS_SDD);
119#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200120}
121
122#if defined(CONFIG_440GX)
123#define SDR0_PINSTP_SHIFT 29
124static char *bootstrap_str[] = {
125 "EBC (16 bits)",
126 "EBC (8 bits)",
127 "EBC (32 bits)",
128 "EBC (8 bits)",
129 "PCI",
130 "I2C (Addr 0x54)",
131 "Reserved",
132 "I2C (Addr 0x50)",
133};
134#endif
135
136#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
137#define SDR0_PINSTP_SHIFT 30
138static char *bootstrap_str[] = {
139 "EBC (8 bits)",
140 "PCI",
141 "I2C (Addr 0x54)",
142 "I2C (Addr 0x50)",
143};
144#endif
145
146#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
147#define SDR0_PINSTP_SHIFT 29
148static char *bootstrap_str[] = {
149 "EBC (8 bits)",
150 "PCI",
151 "NAND (8 bits)",
152 "EBC (16 bits)",
153 "EBC (16 bits)",
154 "I2C (Addr 0x54)",
155 "PCI",
156 "I2C (Addr 0x52)",
157};
158#endif
159
160#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
161#define SDR0_PINSTP_SHIFT 29
162static char *bootstrap_str[] = {
163 "EBC (8 bits)",
164 "EBC (16 bits)",
165 "EBC (16 bits)",
166 "NAND (8 bits)",
167 "PCI",
168 "I2C (Addr 0x54)",
169 "PCI",
170 "I2C (Addr 0x52)",
171};
172#endif
173
174#if defined(SDR0_PINSTP_SHIFT)
175static int bootstrap_option(void)
176{
177 unsigned long val;
178
179 mfsdr(sdr_pinstp, val);
180 return ((val & 0xe0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100181}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200182#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100183#endif
184
185
wdenkc6097192002-11-03 00:24:07 +0000186#if defined(CONFIG_440)
Stefan Roese42f2a822005-11-27 19:36:26 +0100187static int do_chip_reset(unsigned long sys0, unsigned long sys1);
wdenkc6097192002-11-03 00:24:07 +0000188#endif
189
wdenkc6097192002-11-03 00:24:07 +0000190
191int checkcpu (void)
192{
Stefan Roese42f2a822005-11-27 19:36:26 +0100193#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100194 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000195 ulong clock = gd->cpu_clk;
196 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000197
Stefan Roese42f2a822005-11-27 19:36:26 +0100198#if !defined(CONFIG_IOP480)
Wolfgang Denk65505432006-10-20 17:54:33 +0200199 char addstr[64] = "";
Stefan Roese42f2a822005-11-27 19:36:26 +0100200 sys_info_t sys_info;
wdenkc6097192002-11-03 00:24:07 +0000201
202 puts ("CPU: ");
203
204 get_sys_info(&sys_info);
205
Stefan Roese42f2a822005-11-27 19:36:26 +0100206 puts("AMCC PowerPC 4");
207
208#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP)
209 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000210#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100211#if defined(CONFIG_440)
212 puts("40");
stroese434979e2003-05-23 11:18:02 +0000213#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100214
wdenkc6097192002-11-03 00:24:07 +0000215 switch (pvr) {
216 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100217 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000218 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100219
wdenkc6097192002-11-03 00:24:07 +0000220 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100221 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000222 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100223
wdenkc6097192002-11-03 00:24:07 +0000224 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100225 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000226 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100227
wdenkc35ba4e2004-03-14 22:25:36 +0000228#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100229 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
230 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000231 break;
232#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100233
wdenkc6097192002-11-03 00:24:07 +0000234 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100235 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000236 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100237
wdenkc6097192002-11-03 00:24:07 +0000238 case PVR_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100239 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000240 break;
wdenkc6097192002-11-03 00:24:07 +0000241
Stefan Roese42f2a822005-11-27 19:36:26 +0100242#ifdef CONFIG_405CR
243 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
244 puts("CR Rev. C");
245 break;
wdenkc6097192002-11-03 00:24:07 +0000246#endif
247
Stefan Roese42f2a822005-11-27 19:36:26 +0100248 case PVR_405GPR_RB:
249 puts("GPr Rev. B");
250 break;
wdenkc6097192002-11-03 00:24:07 +0000251
Stefan Roese42f2a822005-11-27 19:36:26 +0100252 case PVR_405EP_RB:
253 puts("EP Rev. B");
254 break;
wdenkc6097192002-11-03 00:24:07 +0000255
256#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000257 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200258 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000259 /* See errata 1.12: CHIP_4 */
260 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
261 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
262 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
263 "Resetting chip ...\n");
264 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
265 do_chip_reset ( mfdcr(cpc0_strp0),
266 mfdcr(cpc0_strp1) );
267 }
wdenkc6097192002-11-03 00:24:07 +0000268 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100269
wdenk57b2d802003-06-27 21:31:46 +0000270 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200271 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000272 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100273
wdenk544e9732004-02-06 23:19:44 +0000274 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200275 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000276 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100277
wdenk544e9732004-02-06 23:19:44 +0000278 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200279 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000280 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100281
stroesec0125272005-04-07 05:33:41 +0000282 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200283 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000284 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100285
Stefan Roese08fb4042005-11-01 10:08:03 +0100286 case PVR_440GX_RF:
287 puts("GX Rev. F");
288 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100289
Stefan Roese326c9712005-08-01 16:41:48 +0200290 case PVR_440EP_RA:
291 puts("EP Rev. A");
292 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100293
Stefan Roese95258d52005-10-04 15:00:30 +0200294#ifdef CONFIG_440EP
295 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200296 puts("EP Rev. B");
297 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200298
299 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
300 puts("EP Rev. C");
301 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200302#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100303
Stefan Roese95258d52005-10-04 15:00:30 +0200304#ifdef CONFIG_440GR
305 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
306 puts("GR Rev. A");
307 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200308
Stefan Roese96467d62006-05-18 19:21:53 +0200309 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200310 puts("GR Rev. B");
311 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200312#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100313#endif /* CONFIG_440 */
314
Stefan Roese42fbddd2006-09-07 11:51:23 +0200315 case PVR_440EPX1_RA:
Stefan Roese11dd8812006-10-18 15:59:35 +0200316 puts("EPx Rev. A");
317 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200318 break;
319
320 case PVR_440EPX2_RA:
Stefan Roese11dd8812006-10-18 15:59:35 +0200321 puts("EPx Rev. A");
322 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200323 break;
324
325 case PVR_440GRX1_RA:
Stefan Roese11dd8812006-10-18 15:59:35 +0200326 puts("GRx Rev. A");
327 strcpy(addstr, "Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200328 break;
329
330 case PVR_440GRX2_RA:
Stefan Roese11dd8812006-10-18 15:59:35 +0200331 puts("GRx Rev. A");
332 strcpy(addstr, "No Security/Kasumi support");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200333 break;
334
Stefan Roese99644742005-11-29 18:18:21 +0100335 case PVR_440SP_RA:
336 puts("SP Rev. A");
337 break;
338
339 case PVR_440SP_RB:
340 puts("SP Rev. B");
341 break;
342
Stefan Roesec6d59302006-11-28 16:09:24 +0100343 case PVR_440SP_RC:
344 puts("SP Rev. C");
345 break;
346
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200347 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200348 puts("SPe Rev. A");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200349 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200350
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200351 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200352 puts("SPe Rev. B");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200353 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200354
wdenk57b2d802003-06-27 21:31:46 +0000355 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200356 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000357 break;
358 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100359
360 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
361 sys_info.freqPLB / 1000000,
362 sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
363 FREQ_EBC / 1000000);
364
Stefan Roese11dd8812006-10-18 15:59:35 +0200365 if (addstr[0] != 0)
366 printf(" %s\n", addstr);
367
Stefan Roese99644742005-11-29 18:18:21 +0100368#if defined(I2C_BOOTROM)
369 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200370#if defined(SDR0_PINSTP_SHIFT)
371 printf (" Bootstrap Option %c - ", (char)bootstrap_option() + 'A');
372 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
Wolfgang Denk65505432006-10-20 17:54:33 +0200373#endif /* SDR0_PINSTP_SHIFT */
374#endif /* I2C_BOOTROM */
Stefan Roese42f2a822005-11-27 19:36:26 +0100375
Stefan Roese99644742005-11-29 18:18:21 +0100376#if defined(CONFIG_PCI)
377 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100378#endif
379
Stefan Roese99644742005-11-29 18:18:21 +0100380#if defined(PCI_ASYNC)
381 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100382 printf (", PCI async ext clock used");
383 } else {
384 printf (", PCI sync clock at %lu MHz",
385 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
386 }
wdenkc6097192002-11-03 00:24:07 +0000387#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100388
Stefan Roese99644742005-11-29 18:18:21 +0100389#if defined(CONFIG_PCI)
Stefan Roese42f2a822005-11-27 19:36:26 +0100390 putc('\n');
391#endif
392
393#if defined(CONFIG_405EP)
394 printf (" 16 kB I-Cache 16 kB D-Cache");
395#elif defined(CONFIG_440)
396 printf (" 32 kB I-Cache 32 kB D-Cache");
397#else
398 printf (" 16 kB I-Cache %d kB D-Cache",
399 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
400#endif
401#endif /* !defined(CONFIG_IOP480) */
402
403#if defined(CONFIG_IOP480)
404 printf ("PLX IOP480 (PVR=%08x)", pvr);
405 printf (" at %s MHz:", strmhz(buf, clock));
406 printf (" %u kB I-Cache", 4);
407 printf (" %u kB D-Cache", 2);
408#endif
409
410#endif /* !defined(CONFIG_405) */
411
412 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000413
414 return 0;
415}
416
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200417#if defined (CONFIG_440SPE)
418int ppc440spe_revB() {
419 unsigned int pvr;
420
421 pvr = get_pvr();
422 if (pvr == PVR_440SPe_RB)
423 return 1;
424 else
425 return 0;
426}
427#endif
wdenkc6097192002-11-03 00:24:07 +0000428
429/* ------------------------------------------------------------------------- */
430
wdenk57b2d802003-06-27 21:31:46 +0000431int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000432{
Stefan Roeseecf05b22006-11-27 14:48:41 +0100433#if defined(CONFIG_BOARD_RESET)
434 board_reset();
Stefan Roesea5232952006-11-27 14:52:04 +0100435#else
Stefan Roese2a4a9432006-11-27 14:12:17 +0100436#if defined(CFG_4xx_RESET_TYPE)
437 mtspr(dbcr0, CFG_4xx_RESET_TYPE << 28);
Stefan Roese326c9712005-08-01 16:41:48 +0200438#else
wdenk57b2d802003-06-27 21:31:46 +0000439 /*
440 * Initiate system reset in debug control register DBCR
441 */
Stefan Roese03687752006-10-07 11:30:52 +0200442 mtspr(dbcr0, 0x30000000);
Stefan Roesea5232952006-11-27 14:52:04 +0100443#endif /* defined(CFG_4xx_RESET_TYPE) */
Stefan Roese03687752006-10-07 11:30:52 +0200444#endif /* defined(CONFIG_BOARD_RESET) */
Stefan Roese326c9712005-08-01 16:41:48 +0200445
wdenkc6097192002-11-03 00:24:07 +0000446 return 1;
447}
448
449#if defined(CONFIG_440)
Stefan Roese42f2a822005-11-27 19:36:26 +0100450static int do_chip_reset (unsigned long sys0, unsigned long sys1)
wdenkc6097192002-11-03 00:24:07 +0000451{
wdenka4685fe2003-09-03 14:03:26 +0000452 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
453 * reset.
454 */
455 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
456 mtdcr (cpc0_sys0, sys0);
457 mtdcr (cpc0_sys1, sys1);
458 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
459 mtspr (dbcr0, 0x20000000); /* Reset the chip */
wdenkc6097192002-11-03 00:24:07 +0000460
wdenka4685fe2003-09-03 14:03:26 +0000461 return 1;
wdenkc6097192002-11-03 00:24:07 +0000462}
463#endif
464
465
466/*
467 * Get timebase clock frequency
468 */
469unsigned long get_tbclk (void)
470{
Stefan Roese42f2a822005-11-27 19:36:26 +0100471#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000472 sys_info_t sys_info;
473
474 get_sys_info(&sys_info);
475 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000476#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100477 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000478#endif
479
480}
481
482
483#if defined(CONFIG_WATCHDOG)
484void
485watchdog_reset(void)
486{
487 int re_enable = disable_interrupts();
488 reset_4xx_watchdog();
489 if (re_enable) enable_interrupts();
490}
491
492void
493reset_4xx_watchdog(void)
494{
495 /*
496 * Clear TSR(WIS) bit
497 */
498 mtspr(tsr, 0x40000000);
499}
500#endif /* CONFIG_WATCHDOG */