2 * Copyright 2004,2007 Freescale Semiconductor, Inc.
3 * (C) Copyright 2002, 2003 Motorola Inc.
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/cache.h>
36 uint lcrr; /* local bus clock ratio register */
37 uint clkdiv; /* clock divider portion of lcrr */
43 volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
83 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
93 case PVR_FAM(PVR_85xx):
100 printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
102 get_sys_info(&sysinfo);
104 puts("Clock Configuration:\n");
105 printf(" CPU:%4lu MHz, ", sysinfo.freqProcessor / 1000000);
106 printf("CCB:%4lu MHz,\n", sysinfo.freqSystemBus / 1000000);
108 ddr_ratio = ((gur->porpllsr) & 0x00003e00) >> 9;
111 printf(" DDR:%4lu MHz, ", sysinfo.freqDDRBus / 2000000);
114 printf(" DDR:%4lu MHz (Synchronous), ", sysinfo.freqDDRBus / 2000000);
117 printf(" DDR:%4lu MHz (Asynchronous), ", sysinfo.freqDDRBus / 2000000);
121 #if defined(CFG_LBC_LCRR)
125 volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
130 clkdiv = lcrr & 0x0f;
131 if (clkdiv == 2 || clkdiv == 4 || clkdiv == 8) {
132 #if defined(CONFIG_MPC8548) || defined(CONFIG_MPC8544)
134 * Yes, the entire PQ38 family use the same
135 * bit-representation for twice the clock divider values.
139 printf("LBC:%4lu MHz\n",
140 sysinfo.freqSystemBus / 1000000 / clkdiv);
142 printf("LBC: unknown (lcrr: 0x%08x)\n", lcrr);
145 if (ver == SVR_8560) {
146 printf("CPM: %lu Mhz\n",
147 sysinfo.freqSystemBus / 1000000);
150 puts("L1: D-cache 32 kB enabled\n I-cache 32 kB enabled\n");
156 /* ------------------------------------------------------------------------- */
158 int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
165 /* e500 v2 core has reset control register */
166 volatile unsigned int * rstcr;
167 rstcr = (volatile unsigned int *)(CFG_IMMR + 0xE00B0);
168 *rstcr = 0x2; /* HRESET_REQ */
171 * Initiate hard reset in debug control register DBCR0
172 * Make sure MSR[DE] = 1
174 unsigned long val, msr;
189 * Get timebase clock frequency
191 unsigned long get_tbclk (void)
196 get_sys_info(&sys_info);
197 return ((sys_info.freqSystemBus + 7L) / 8L);
201 #if defined(CONFIG_WATCHDOG)
205 int re_enable = disable_interrupts();
206 reset_85xx_watchdog();
207 if (re_enable) enable_interrupts();
211 reset_85xx_watchdog(void)
214 * Clear TSR(WIS) bit by writing 1
217 val = mfspr(SPRN_TSR);
219 mtspr(SPRN_TSR, val);
221 #endif /* CONFIG_WATCHDOG */
223 #if defined(CONFIG_DDR_ECC)
224 void dma_init(void) {
225 volatile ccsr_dma_t *dma = (void *)(CFG_MPC85xx_DMA_ADDR);
227 dma->satr0 = 0x02c40000;
228 dma->datr0 = 0x02c40000;
229 dma->sr0 = 0xfffffff; /* clear any errors */
230 asm("sync; isync; msync");
234 uint dma_check(void) {
235 volatile ccsr_dma_t *dma = (void *)(CFG_MPC85xx_DMA_ADDR);
236 volatile uint status = dma->sr0;
238 /* While the channel is busy, spin */
239 while((status & 4) == 4) {
243 /* clear MR0[CS] channel start bit */
244 dma->mr0 &= 0x00000001;
245 asm("sync;isync;msync");
248 printf ("DMA Error: status = %x\n", status);
253 int dma_xfer(void *dest, uint count, void *src) {
254 volatile ccsr_dma_t *dma = (void *)(CFG_MPC85xx_DMA_ADDR);
256 dma->dar0 = (uint) dest;
257 dma->sar0 = (uint) src;
259 dma->mr0 = 0xf000004;
260 asm("sync;isync;msync");
261 dma->mr0 = 0xf000005;
262 asm("sync;isync;msync");