blob: 94478dbb109ea3c7e3a86907cc96636bc4159219 [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 Roese99644742005-11-29 18:18:21 +010044#if defined(CONFIG_440)
45#define FREQ_EBC (sys_info.freqEPB)
46#else
47#define FREQ_EBC (sys_info.freqPLB / sys_info.pllExtBusDiv)
Stefan Roese42f2a822005-11-27 19:36:26 +010048#endif
49
Stefan Roese42fbddd2006-09-07 11:51:23 +020050#if defined(CONFIG_405GP) || \
51 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
52 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010053
54#define PCI_ASYNC
55
56int pci_async_enabled(void)
57{
58#if defined(CONFIG_405GP)
59 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010060#endif
61
Stefan Roese42fbddd2006-09-07 11:51:23 +020062#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
63 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
Stefan Roese99644742005-11-29 18:18:21 +010064 unsigned long val;
65
Wolfgang Denkaaa7c002005-12-12 16:06:05 +010066 mfsdr(sdr_sdstp1, val);
Stefan Roese99644742005-11-29 18:18:21 +010067 return (val & SDR0_SDSTP1_PAME_MASK);
68#endif
69}
70#endif
71
Stefan Roesee2c34122005-11-29 19:13:38 +010072#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && !defined(CONFIG_405)
Stefan Roese99644742005-11-29 18:18:21 +010073int pci_arbiter_enabled(void)
74{
75#if defined(CONFIG_405GP)
76 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
77#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010078
Stefan Roese99644742005-11-29 18:18:21 +010079#if defined(CONFIG_405EP)
80 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
Stefan Roese42f2a822005-11-27 19:36:26 +010081#endif
82
83#if defined(CONFIG_440GP)
Stefan Roese99644742005-11-29 18:18:21 +010084 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
85#endif
Stefan Roese42f2a822005-11-27 19:36:26 +010086
Stefan Roese42fbddd2006-09-07 11:51:23 +020087#if defined(CONFIG_440GX) || \
88 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
89 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
90 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese99644742005-11-29 18:18:21 +010091 unsigned long val;
92
93 mfsdr(sdr_sdstp1, val);
94 return (val & SDR0_SDSTP1_PAE_MASK);
Stefan Roese42f2a822005-11-27 19:36:26 +010095#endif
Stefan Roese99644742005-11-29 18:18:21 +010096}
97#endif
98
Stefan Roese42fbddd2006-09-07 11:51:23 +020099#if defined(CONFIG_405EP) || defined(CONFIG_440GX) || \
100 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
101 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
102 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
Stefan Roese42f2a822005-11-27 19:36:26 +0100103
Stefan Roese99644742005-11-29 18:18:21 +0100104#define I2C_BOOTROM
Stefan Roese42f2a822005-11-27 19:36:26 +0100105
Stefan Roese99644742005-11-29 18:18:21 +0100106int i2c_bootrom_enabled(void)
107{
108#if defined(CONFIG_405EP)
109 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
Stefan Roese42fbddd2006-09-07 11:51:23 +0200110#else
Stefan Roese99644742005-11-29 18:18:21 +0100111 unsigned long val;
112
113 mfsdr(sdr_sdcs, val);
114 return (val & SDR0_SDCS_SDD);
115#endif
Stefan Roese42fbddd2006-09-07 11:51:23 +0200116}
117
118#if defined(CONFIG_440GX)
119#define SDR0_PINSTP_SHIFT 29
120static char *bootstrap_str[] = {
121 "EBC (16 bits)",
122 "EBC (8 bits)",
123 "EBC (32 bits)",
124 "EBC (8 bits)",
125 "PCI",
126 "I2C (Addr 0x54)",
127 "Reserved",
128 "I2C (Addr 0x50)",
129};
130#endif
131
132#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
133#define SDR0_PINSTP_SHIFT 30
134static char *bootstrap_str[] = {
135 "EBC (8 bits)",
136 "PCI",
137 "I2C (Addr 0x54)",
138 "I2C (Addr 0x50)",
139};
140#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};
154#endif
155
156#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
157#define SDR0_PINSTP_SHIFT 29
158static char *bootstrap_str[] = {
159 "EBC (8 bits)",
160 "EBC (16 bits)",
161 "EBC (16 bits)",
162 "NAND (8 bits)",
163 "PCI",
164 "I2C (Addr 0x54)",
165 "PCI",
166 "I2C (Addr 0x52)",
167};
168#endif
169
170#if defined(SDR0_PINSTP_SHIFT)
171static int bootstrap_option(void)
172{
173 unsigned long val;
174
175 mfsdr(sdr_pinstp, val);
176 return ((val & 0xe0000000) >> SDR0_PINSTP_SHIFT);
Stefan Roese99644742005-11-29 18:18:21 +0100177}
Stefan Roese42fbddd2006-09-07 11:51:23 +0200178#endif /* SDR0_PINSTP_SHIFT */
Stefan Roese42f2a822005-11-27 19:36:26 +0100179#endif
180
181
wdenkc6097192002-11-03 00:24:07 +0000182#if defined(CONFIG_440)
Stefan Roese42f2a822005-11-27 19:36:26 +0100183static int do_chip_reset(unsigned long sys0, unsigned long sys1);
wdenkc6097192002-11-03 00:24:07 +0000184#endif
185
wdenkc6097192002-11-03 00:24:07 +0000186
187int checkcpu (void)
188{
Stefan Roese42f2a822005-11-27 19:36:26 +0100189#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
Stefan Roese42f2a822005-11-27 19:36:26 +0100190 uint pvr = get_pvr();
wdenkc6097192002-11-03 00:24:07 +0000191 ulong clock = gd->cpu_clk;
192 char buf[32];
wdenkc6097192002-11-03 00:24:07 +0000193
Stefan Roese42f2a822005-11-27 19:36:26 +0100194#if !defined(CONFIG_IOP480)
195 sys_info_t sys_info;
wdenkc6097192002-11-03 00:24:07 +0000196
197 puts ("CPU: ");
198
199 get_sys_info(&sys_info);
200
Stefan Roese42f2a822005-11-27 19:36:26 +0100201 puts("AMCC PowerPC 4");
202
203#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP)
204 puts("05");
wdenkc6097192002-11-03 00:24:07 +0000205#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100206#if defined(CONFIG_440)
207 puts("40");
stroese434979e2003-05-23 11:18:02 +0000208#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100209
wdenkc6097192002-11-03 00:24:07 +0000210 switch (pvr) {
211 case PVR_405GP_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100212 puts("GP Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000213 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100214
wdenkc6097192002-11-03 00:24:07 +0000215 case PVR_405GP_RC:
Stefan Roese42f2a822005-11-27 19:36:26 +0100216 puts("GP Rev. C");
wdenkc6097192002-11-03 00:24:07 +0000217 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100218
wdenkc6097192002-11-03 00:24:07 +0000219 case PVR_405GP_RD:
Stefan Roese42f2a822005-11-27 19:36:26 +0100220 puts("GP Rev. D");
wdenkc6097192002-11-03 00:24:07 +0000221 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100222
wdenkc35ba4e2004-03-14 22:25:36 +0000223#ifdef CONFIG_405GP
Stefan Roese42f2a822005-11-27 19:36:26 +0100224 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
225 puts("GP Rev. E");
wdenkc6097192002-11-03 00:24:07 +0000226 break;
227#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100228
wdenkc6097192002-11-03 00:24:07 +0000229 case PVR_405CR_RA:
Stefan Roese42f2a822005-11-27 19:36:26 +0100230 puts("CR Rev. A");
wdenkc6097192002-11-03 00:24:07 +0000231 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100232
wdenkc6097192002-11-03 00:24:07 +0000233 case PVR_405CR_RB:
Stefan Roese42f2a822005-11-27 19:36:26 +0100234 puts("CR Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000235 break;
wdenkc6097192002-11-03 00:24:07 +0000236
Stefan Roese42f2a822005-11-27 19:36:26 +0100237#ifdef CONFIG_405CR
238 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
239 puts("CR Rev. C");
240 break;
wdenkc6097192002-11-03 00:24:07 +0000241#endif
242
Stefan Roese42f2a822005-11-27 19:36:26 +0100243 case PVR_405GPR_RB:
244 puts("GPr Rev. B");
245 break;
wdenkc6097192002-11-03 00:24:07 +0000246
Stefan Roese42f2a822005-11-27 19:36:26 +0100247 case PVR_405EP_RB:
248 puts("EP Rev. B");
249 break;
wdenkc6097192002-11-03 00:24:07 +0000250
251#if defined(CONFIG_440)
wdenk57b2d802003-06-27 21:31:46 +0000252 case PVR_440GP_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200253 puts("GP Rev. B");
wdenka4685fe2003-09-03 14:03:26 +0000254 /* See errata 1.12: CHIP_4 */
255 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
256 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
257 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
258 "Resetting chip ...\n");
259 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
260 do_chip_reset ( mfdcr(cpc0_strp0),
261 mfdcr(cpc0_strp1) );
262 }
wdenkc6097192002-11-03 00:24:07 +0000263 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100264
wdenk57b2d802003-06-27 21:31:46 +0000265 case PVR_440GP_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200266 puts("GP Rev. C");
wdenk544e9732004-02-06 23:19:44 +0000267 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100268
wdenk544e9732004-02-06 23:19:44 +0000269 case PVR_440GX_RA:
Stefan Roese326c9712005-08-01 16:41:48 +0200270 puts("GX Rev. A");
wdenk544e9732004-02-06 23:19:44 +0000271 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100272
wdenk544e9732004-02-06 23:19:44 +0000273 case PVR_440GX_RB:
Stefan Roese326c9712005-08-01 16:41:48 +0200274 puts("GX Rev. B");
wdenkc6097192002-11-03 00:24:07 +0000275 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100276
stroesec0125272005-04-07 05:33:41 +0000277 case PVR_440GX_RC:
Stefan Roese326c9712005-08-01 16:41:48 +0200278 puts("GX Rev. C");
stroesec0125272005-04-07 05:33:41 +0000279 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100280
Stefan Roese08fb4042005-11-01 10:08:03 +0100281 case PVR_440GX_RF:
282 puts("GX Rev. F");
283 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100284
Stefan Roese326c9712005-08-01 16:41:48 +0200285 case PVR_440EP_RA:
286 puts("EP Rev. A");
287 break;
Stefan Roese42f2a822005-11-27 19:36:26 +0100288
Stefan Roese95258d52005-10-04 15:00:30 +0200289#ifdef CONFIG_440EP
290 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
Stefan Roese326c9712005-08-01 16:41:48 +0200291 puts("EP Rev. B");
292 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200293
294 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
295 puts("EP Rev. C");
296 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200297#endif /* CONFIG_440EP */
Stefan Roese42f2a822005-11-27 19:36:26 +0100298
Stefan Roese95258d52005-10-04 15:00:30 +0200299#ifdef CONFIG_440GR
300 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
301 puts("GR Rev. A");
302 break;
Stefan Roese31ce7de2006-05-10 14:10:41 +0200303
Stefan Roese96467d62006-05-18 19:21:53 +0200304 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
Stefan Roese31ce7de2006-05-10 14:10:41 +0200305 puts("GR Rev. B");
306 break;
Stefan Roese95258d52005-10-04 15:00:30 +0200307#endif /* CONFIG_440GR */
Stefan Roese42f2a822005-11-27 19:36:26 +0100308#endif /* CONFIG_440 */
309
Stefan Roese42fbddd2006-09-07 11:51:23 +0200310 case PVR_440EPX1_RA:
311 puts("EPx Rev. A - Security/Kasumi support");
312 break;
313
314 case PVR_440EPX2_RA:
315 puts("EPx Rev. A - No Security/Kasumi support");
316 break;
317
318 case PVR_440GRX1_RA:
319 puts("GRx Rev. A - Security/Kasumi support");
320 break;
321
322 case PVR_440GRX2_RA:
323 puts("GRx Rev. A - No Security/Kasumi support");
324 break;
325
Stefan Roese99644742005-11-29 18:18:21 +0100326 case PVR_440SP_RA:
327 puts("SP Rev. A");
328 break;
329
330 case PVR_440SP_RB:
331 puts("SP Rev. B");
332 break;
333
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200334 case PVR_440SPe_RA:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200335 puts("SPe Rev. A");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200336 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200337
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200338 case PVR_440SPe_RB:
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200339 puts("SPe Rev. B");
Marian Balakowicz49d0eee2006-06-30 16:30:46 +0200340 break;
Marian Balakowicz11b8c432006-07-03 23:42:36 +0200341
wdenk57b2d802003-06-27 21:31:46 +0000342 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200343 printf (" UNKNOWN (PVR=%08x)", pvr);
wdenkc6097192002-11-03 00:24:07 +0000344 break;
345 }
Stefan Roese42f2a822005-11-27 19:36:26 +0100346
347 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
348 sys_info.freqPLB / 1000000,
349 sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
350 FREQ_EBC / 1000000);
351
Stefan Roese99644742005-11-29 18:18:21 +0100352#if defined(I2C_BOOTROM)
353 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
Stefan Roese42fbddd2006-09-07 11:51:23 +0200354#if defined(SDR0_PINSTP_SHIFT)
355 printf (" Bootstrap Option %c - ", (char)bootstrap_option() + 'A');
356 printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
357#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100358#endif
359
Stefan Roese99644742005-11-29 18:18:21 +0100360#if defined(CONFIG_PCI)
361 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
Stefan Roese42f2a822005-11-27 19:36:26 +0100362#endif
363
Stefan Roese99644742005-11-29 18:18:21 +0100364#if defined(PCI_ASYNC)
365 if (pci_async_enabled()) {
Stefan Roese42f2a822005-11-27 19:36:26 +0100366 printf (", PCI async ext clock used");
367 } else {
368 printf (", PCI sync clock at %lu MHz",
369 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
370 }
wdenkc6097192002-11-03 00:24:07 +0000371#endif
Stefan Roese42f2a822005-11-27 19:36:26 +0100372
Stefan Roese99644742005-11-29 18:18:21 +0100373#if defined(CONFIG_PCI)
Stefan Roese42f2a822005-11-27 19:36:26 +0100374 putc('\n');
375#endif
376
377#if defined(CONFIG_405EP)
378 printf (" 16 kB I-Cache 16 kB D-Cache");
379#elif defined(CONFIG_440)
380 printf (" 32 kB I-Cache 32 kB D-Cache");
381#else
382 printf (" 16 kB I-Cache %d kB D-Cache",
383 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
384#endif
385#endif /* !defined(CONFIG_IOP480) */
386
387#if defined(CONFIG_IOP480)
388 printf ("PLX IOP480 (PVR=%08x)", pvr);
389 printf (" at %s MHz:", strmhz(buf, clock));
390 printf (" %u kB I-Cache", 4);
391 printf (" %u kB D-Cache", 2);
392#endif
393
394#endif /* !defined(CONFIG_405) */
395
396 putc ('\n');
wdenkc6097192002-11-03 00:24:07 +0000397
398 return 0;
399}
400
Rafal Jaworowskia2e7ef02006-08-10 12:43:17 +0200401#if defined (CONFIG_440SPE)
402int ppc440spe_revB() {
403 unsigned int pvr;
404
405 pvr = get_pvr();
406 if (pvr == PVR_440SPe_RB)
407 return 1;
408 else
409 return 0;
410}
411#endif
wdenkc6097192002-11-03 00:24:07 +0000412
413/* ------------------------------------------------------------------------- */
414
wdenk57b2d802003-06-27 21:31:46 +0000415int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenkc6097192002-11-03 00:24:07 +0000416{
Stefan Roese326c9712005-08-01 16:41:48 +0200417#if defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)
418 /*give reset to BCSR*/
419 *(unsigned char*)(CFG_BCSR_BASE | 0x06) = 0x09;
420
421#else
422
wdenk57b2d802003-06-27 21:31:46 +0000423 /*
424 * Initiate system reset in debug control register DBCR
425 */
wdenkc6097192002-11-03 00:24:07 +0000426 __asm__ __volatile__("lis 3, 0x3000" ::: "r3");
427#if defined(CONFIG_440)
428 __asm__ __volatile__("mtspr 0x134, 3");
429#else
430 __asm__ __volatile__("mtspr 0x3f2, 3");
431#endif
Stefan Roese326c9712005-08-01 16:41:48 +0200432
433#endif/* defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)*/
wdenkc6097192002-11-03 00:24:07 +0000434 return 1;
435}
436
437#if defined(CONFIG_440)
Stefan Roese42f2a822005-11-27 19:36:26 +0100438static int do_chip_reset (unsigned long sys0, unsigned long sys1)
wdenkc6097192002-11-03 00:24:07 +0000439{
wdenka4685fe2003-09-03 14:03:26 +0000440 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
441 * reset.
442 */
443 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
444 mtdcr (cpc0_sys0, sys0);
445 mtdcr (cpc0_sys1, sys1);
446 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
447 mtspr (dbcr0, 0x20000000); /* Reset the chip */
wdenkc6097192002-11-03 00:24:07 +0000448
wdenka4685fe2003-09-03 14:03:26 +0000449 return 1;
wdenkc6097192002-11-03 00:24:07 +0000450}
451#endif
452
453
454/*
455 * Get timebase clock frequency
456 */
457unsigned long get_tbclk (void)
458{
Stefan Roese42f2a822005-11-27 19:36:26 +0100459#if !defined(CONFIG_IOP480)
wdenkc6097192002-11-03 00:24:07 +0000460 sys_info_t sys_info;
461
462 get_sys_info(&sys_info);
463 return (sys_info.freqProcessor);
wdenkc6097192002-11-03 00:24:07 +0000464#else
Stefan Roese42f2a822005-11-27 19:36:26 +0100465 return (66000000);
wdenkc6097192002-11-03 00:24:07 +0000466#endif
467
468}
469
470
471#if defined(CONFIG_WATCHDOG)
472void
473watchdog_reset(void)
474{
475 int re_enable = disable_interrupts();
476 reset_4xx_watchdog();
477 if (re_enable) enable_interrupts();
478}
479
480void
481reset_4xx_watchdog(void)
482{
483 /*
484 * Clear TSR(WIS) bit
485 */
486 mtspr(tsr, 0x40000000);
487}
488#endif /* CONFIG_WATCHDOG */