2 * (C) Copyright 2000-2006
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>
40 #if !defined(CONFIG_405)
41 DECLARE_GLOBAL_DATA_PTR;
45 #if defined(CONFIG_440)
46 #define FREQ_EBC (sys_info.freqEPB)
48 #define FREQ_EBC (sys_info.freqPLB / sys_info.pllExtBusDiv)
51 #if defined(CONFIG_405GP) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
55 int pci_async_enabled(void)
57 #if defined(CONFIG_405GP)
58 return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
61 #if defined(CONFIG_440EP) || defined(CONFIG_440GR)
64 mfsdr(sdr_sdstp1, val);
65 return (val & SDR0_SDSTP1_PAME_MASK);
70 #if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && !defined(CONFIG_405)
71 int pci_arbiter_enabled(void)
73 #if defined(CONFIG_405GP)
74 return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
77 #if defined(CONFIG_405EP)
78 return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
81 #if defined(CONFIG_440GP)
82 return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
85 #if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SP)
88 mfsdr(sdr_sdstp1, val);
89 return (val & SDR0_SDSTP1_PAE_MASK);
94 #if defined(CONFIG_405EP)|| defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
95 defined(CONFIG_440GX) || defined(CONFIG_440SP)
99 int i2c_bootrom_enabled(void)
101 #if defined(CONFIG_405EP)
102 return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
105 #if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SP)
108 mfsdr(sdr_sdcs, val);
109 return (val & SDR0_SDCS_SDD);
115 #if defined(CONFIG_440)
116 static int do_chip_reset(unsigned long sys0, unsigned long sys1);
122 #if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
123 uint pvr = get_pvr();
124 ulong clock = gd->cpu_clk;
127 #if !defined(CONFIG_IOP480)
132 get_sys_info(&sys_info);
134 puts("AMCC PowerPC 4");
136 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP)
139 #if defined(CONFIG_440)
157 case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
171 case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
184 #if defined(CONFIG_440)
187 /* See errata 1.12: CHIP_4 */
188 if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
189 (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
190 puts ( "\n\t CPC0_SYSx DCRs corrupted. "
191 "Resetting chip ...\n");
192 udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
193 do_chip_reset ( mfdcr(cpc0_strp0),
223 case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
227 case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
230 #endif /* CONFIG_440EP */
233 case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
237 case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
240 #endif /* CONFIG_440GR */
241 #endif /* CONFIG_440 */
252 printf (" UNKNOWN (PVR=%08x)", pvr);
256 printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
257 sys_info.freqPLB / 1000000,
258 sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
261 #if defined(I2C_BOOTROM)
262 printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
265 #if defined(CONFIG_PCI)
266 printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
269 #if defined(PCI_ASYNC)
270 if (pci_async_enabled()) {
271 printf (", PCI async ext clock used");
273 printf (", PCI sync clock at %lu MHz",
274 sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
278 #if defined(CONFIG_PCI)
282 #if defined(CONFIG_405EP)
283 printf (" 16 kB I-Cache 16 kB D-Cache");
284 #elif defined(CONFIG_440)
285 printf (" 32 kB I-Cache 32 kB D-Cache");
287 printf (" 16 kB I-Cache %d kB D-Cache",
288 ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
290 #endif /* !defined(CONFIG_IOP480) */
292 #if defined(CONFIG_IOP480)
293 printf ("PLX IOP480 (PVR=%08x)", pvr);
294 printf (" at %s MHz:", strmhz(buf, clock));
295 printf (" %u kB I-Cache", 4);
296 printf (" %u kB D-Cache", 2);
299 #endif /* !defined(CONFIG_405) */
307 /* ------------------------------------------------------------------------- */
309 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
311 #if defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)
312 /*give reset to BCSR*/
313 *(unsigned char*)(CFG_BCSR_BASE | 0x06) = 0x09;
318 * Initiate system reset in debug control register DBCR
320 __asm__ __volatile__("lis 3, 0x3000" ::: "r3");
321 #if defined(CONFIG_440)
322 __asm__ __volatile__("mtspr 0x134, 3");
324 __asm__ __volatile__("mtspr 0x3f2, 3");
327 #endif/* defined(CONFIG_YOSEMITE) || defined(CONFIG_YELLOWSTONE)*/
331 #if defined(CONFIG_440)
332 static int do_chip_reset (unsigned long sys0, unsigned long sys1)
334 /* Changes to cpc0_sys0 and cpc0_sys1 require chip
337 mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
338 mtdcr (cpc0_sys0, sys0);
339 mtdcr (cpc0_sys1, sys1);
340 mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
341 mtspr (dbcr0, 0x20000000); /* Reset the chip */
349 * Get timebase clock frequency
351 unsigned long get_tbclk (void)
353 #if !defined(CONFIG_IOP480)
356 get_sys_info(&sys_info);
357 return (sys_info.freqProcessor);
365 #if defined(CONFIG_WATCHDOG)
369 int re_enable = disable_interrupts();
370 reset_4xx_watchdog();
371 if (re_enable) enable_interrupts();
375 reset_4xx_watchdog(void)
380 mtspr(tsr, 0x40000000);
382 #endif /* CONFIG_WATCHDOG */