2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
27 * written or collected and sometimes rewritten by
28 * Magnus Damm <damm@bitsmart.com>
30 * minor modifications by
31 * Wolfgang Denk <wd@denx.de>
37 #include <asm/cache.h>
41 #if defined(CONFIG_405GP)
42 #define PCI_ARBITER_ENABLED (mfdcr(strap) & PSR_PCI_ARBIT_EN)
43 #define PCI_ASYNC_ENABLED (mfdcr(strap) & PSR_PCI_ASYNC_EN)
46 #if defined(CONFIG_405EP)
47 #define PCI_ARBITER_ENABLED (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN)
48 #define I2C_BOOTROM_ENABLED (mfdcr(cpc0_boot) & CPC0_BOOT_SEP)
51 #if defined(CONFIG_440EP) || defined(CONFIG_440GR)
52 #define SDR0_SDSTP1_PAE (0x80000000 >> 21)
53 #define SDR0_SDSTP1_PAME (0x80000000 >> 27)
55 #define PCI_ARBITER_ENABLED (mfdcr(cpc0_strp1) & SDR0_SDSTP1_PAE)
56 #define PCI_ASYNC_ENABLED (mfdcr(cpc0_strp1) & SDR0_SDSTP1_PAME)
59 #if defined(CONFIG_440GP)
60 #define CPC0_STRP1_PAE (0x80000000 >> 11)
62 #define PCI_ARBITER_ENABLED (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE)
65 #if defined(CONFIG_440GX)
66 #define SDR0_SDSTP1_PAE (0x80000000 >> 13)
68 #define PCI_ARBITER_ENABLED (mfdcr(cpc0_strp1) & SDR0_SDSTP1_PAE)
71 #if defined(CONFIG_440)
72 #define FREQ_EBC (sys_info.freqEPB)
74 #define FREQ_EBC (sys_info.freqPLB / sys_info.pllExtBusDiv)
78 #if defined(CONFIG_440)
79 static int do_chip_reset(unsigned long sys0, unsigned long sys1);
85 #if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
86 DECLARE_GLOBAL_DATA_PTR;
88 ulong clock = gd->cpu_clk;
91 #if !defined(CONFIG_IOP480)
96 get_sys_info(&sys_info);
98 puts("AMCC PowerPC 4");
100 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP)
103 #if defined(CONFIG_440)
121 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
135 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
148 #if defined(CONFIG_440)
151 /* See errata 1.12: CHIP_4 */
152 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
153 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
154 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
155 "Resetting chip ...\n");
156 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
157 do_chip_reset ( mfdcr(cpc0_strp0),
187 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
190 #endif /* CONFIG_440EP */
193 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
196 #endif /* CONFIG_440GR */
197 #endif /* CONFIG_440 */
200 printf (" UNKNOWN (PVR=%08x)", pvr);
204 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
205 sys_info.freqPLB / 1000000,
206 sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
209 #if defined(I2C_BOOTROM_ENABLED)
210 printf (" IIC Boot EEPROM %sabled\n", I2C_BOOTROM_ENABLED ? "en" : "dis");
213 #if defined(PCI_ARBITER_ENABLED)
214 printf (" %sternal PCI arbiter enabled",
215 (PCI_ARBITER_ENABLED) ? "In" : "Ex");
218 #if defined(PCI_ASYNC_ENABLED)
219 if (PCI_ASYNC_ENABLED) {
220 printf (", PCI async ext clock used");
222 printf (", PCI sync clock at %lu MHz",
223 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
227 #if defined(PCI_ARBITER_ENABLED) || defined(PCI_ASYNC_ENABLED)
231 #if defined(CONFIG_405EP)
232 printf (" 16 kB I-Cache 16 kB D-Cache");
233 #elif defined(CONFIG_440)
234 printf (" 32 kB I-Cache 32 kB D-Cache");
236 printf (" 16 kB I-Cache %d kB D-Cache",
237 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
239 #endif /* !defined(CONFIG_IOP480) */
241 #if defined(CONFIG_IOP480)
242 printf ("PLX IOP480 (PVR=%08x)", pvr);
243 printf (" at %s MHz:", strmhz(buf, clock));
244 printf (" %u kB I-Cache", 4);
245 printf (" %u kB D-Cache", 2);
248 #endif /* !defined(CONFIG_405) */
256 /* ------------------------------------------------------------------------- */
258 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
260 #if defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)
261 /*give reset to BCSR*/
262 *(unsigned char*)(CFG_BCSR_BASE | 0x06) = 0x09;
267 * Initiate system reset in debug control register DBCR
269 __asm__ __volatile__("lis 3, 0x3000" ::: "r3");
270 #if defined(CONFIG_440)
271 __asm__ __volatile__("mtspr 0x134, 3");
273 __asm__ __volatile__("mtspr 0x3f2, 3");
276 #endif/* defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)*/
280 #if defined(CONFIG_440)
281 static int do_chip_reset (unsigned long sys0, unsigned long sys1)
283 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
286 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
287 mtdcr (cpc0_sys0, sys0);
288 mtdcr (cpc0_sys1, sys1);
289 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
290 mtspr (dbcr0, 0x20000000); /* Reset the chip */
298 * Get timebase clock frequency
300 unsigned long get_tbclk (void)
302 #if !defined(CONFIG_IOP480)
305 get_sys_info(&sys_info);
306 return (sys_info.freqProcessor);
314 #if defined(CONFIG_WATCHDOG)
318 int re_enable = disable_interrupts();
319 reset_4xx_watchdog();
320 if (re_enable) enable_interrupts();
324 reset_4xx_watchdog(void)
329 mtspr(tsr, 0x40000000);
331 #endif /* CONFIG_WATCHDOG */