2 * Copyright 2006 Freescale Semiconductor
4 * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <asm/cache.h>
31 #if defined(CONFIG_OF_FLAT_TREE)
42 uint lcrr; /* local bus clock ratio register */
43 uint clkdiv; /* clock divider portion of lcrr */
44 volatile immap_t *immap = (immap_t *) CFG_IMMR;
45 volatile ccsr_gur_t *gur = &immap->im_gur;
47 puts("Freescale PowerPC\n");
58 case PVR_VER(PVR_86xx):
60 uint msscr0 = mfspr(MSSCR0);
61 printf("E600 Core %d", (msscr0 & 0x20) ? 1 : 0 );
62 if (gur->pordevsr & MPC86xx_PORDEVSR_CORE1TE)
63 puts("\n Core1Translation Enabled");
64 debug(" (MSSCR0=%x, PORDEVSR=%x)", msscr0, gur->pordevsr);
71 printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
81 if (SVR_SUBVER(svr) == 1) {
94 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
96 get_sys_info(&sysinfo);
99 printf("CPU:%4lu MHz, ", sysinfo.freqProcessor / 1000000);
100 printf("MPX:%4lu MHz, ", sysinfo.freqSystemBus / 1000000);
101 printf("DDR:%4lu MHz, ", sysinfo.freqSystemBus / 2000000);
103 #if defined(CFG_LBC_LCRR)
107 volatile immap_t *immap = (immap_t *) CFG_IMMR;
108 volatile ccsr_lbc_t *lbc = &immap->im_lbc;
113 clkdiv = lcrr & 0x0f;
114 if (clkdiv == 2 || clkdiv == 4 || clkdiv == 8) {
115 printf("LBC:%4lu MHz\n",
116 sysinfo.freqSystemBus / 1000000 / clkdiv);
118 printf(" LBC: unknown (lcrr: 0x%08x)\n", lcrr);
122 if (get_l2cr() & 0x80000000)
132 soft_restart(unsigned long addr)
134 #ifndef CONFIG_MPC8641HPCN
137 * SRR0 has system reset vector, SRR1 has default MSR value
138 * rfi restores MSR from SRR1 and sets the PC to the SRR0 value
141 __asm__ __volatile__ ("mtspr 26, %0" :: "r" (addr));
142 __asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
143 __asm__ __volatile__ ("mtspr 27, 4");
144 __asm__ __volatile__ ("rfi");
146 #else /* CONFIG_MPC8641HPCN */
148 out8(PIXIS_BASE + PIXIS_RST, 0);
150 #endif /* !CONFIG_MPC8641HPCN */
152 while (1) ; /* not reached */
157 * No generic way to do board reset. Simply call soft_reset.
160 do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
162 #ifndef CONFIG_MPC8641HPCN
164 #ifdef CFG_RESET_ADDRESS
165 ulong addr = CFG_RESET_ADDRESS;
168 * note: when CFG_MONITOR_BASE points to a RAM address,
169 * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
170 * address. Better pick an address known to be invalid on your
171 * system and assign it to CFG_RESET_ADDRESS.
173 ulong addr = CFG_MONITOR_BASE - sizeof(ulong);
176 /* flush and disable I/D cache */
177 __asm__ __volatile__ ("mfspr 3, 1008" ::: "r3");
178 __asm__ __volatile__ ("ori 5, 5, 0xcc00" ::: "r5");
179 __asm__ __volatile__ ("ori 4, 3, 0xc00" ::: "r4");
180 __asm__ __volatile__ ("andc 5, 3, 5" ::: "r5");
181 __asm__ __volatile__ ("sync");
182 __asm__ __volatile__ ("mtspr 1008, 4");
183 __asm__ __volatile__ ("isync");
184 __asm__ __volatile__ ("sync");
185 __asm__ __volatile__ ("mtspr 1008, 5");
186 __asm__ __volatile__ ("isync");
187 __asm__ __volatile__ ("sync");
191 #else /* CONFIG_MPC8641HPCN */
193 out8(PIXIS_BASE + PIXIS_RST, 0);
195 #endif /* !CONFIG_MPC8641HPCN */
197 while (1) ; /* not reached */
202 * Get timebase clock frequency
209 get_sys_info(&sys_info);
210 return (sys_info.freqSystemBus + 3L) / 4L;
214 #if defined(CONFIG_WATCHDOG)
219 #endif /* CONFIG_WATCHDOG */
222 #if defined(CONFIG_DDR_ECC)
226 volatile immap_t *immap = (immap_t *) CFG_IMMR;
227 volatile ccsr_dma_t *dma = &immap->im_dma;
229 dma->satr0 = 0x00040000;
230 dma->datr0 = 0x00040000;
237 volatile immap_t *immap = (immap_t *) CFG_IMMR;
238 volatile ccsr_dma_t *dma = &immap->im_dma;
239 volatile uint status = dma->sr0;
241 /* While the channel is busy, spin */
242 while ((status & 4) == 4) {
247 printf("DMA Error: status = %x\n", status);
253 dma_xfer(void *dest, uint count, void *src)
255 volatile immap_t *immap = (immap_t *) CFG_IMMR;
256 volatile ccsr_dma_t *dma = &immap->im_dma;
258 dma->dar0 = (uint) dest;
259 dma->sar0 = (uint) src;
261 dma->mr0 = 0xf000004;
263 dma->mr0 = 0xf000005;
268 #endif /* CONFIG_DDR_ECC */
271 #ifdef CONFIG_OF_FLAT_TREE
273 ft_cpu_setup(void *blob, bd_t *bd)
279 clock = bd->bi_busfreq;
280 p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
282 *p = cpu_to_be32(clock);
284 p = ft_get_prop(blob, "/" OF_SOC "/serial@4500/clock-frequency", &len);
286 *p = cpu_to_be32(clock);
288 p = ft_get_prop(blob, "/" OF_SOC "/serial@4600/clock-frequency", &len);
290 *p = cpu_to_be32(clock);
292 #if defined(CONFIG_TSEC1)
293 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/mac-address", &len);
295 memcpy(p, bd->bi_enetaddr, 6);
296 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/local-mac-address", &len);
298 memcpy(p, bd->bi_enetaddr, 6);
301 #if defined(CONFIG_TSEC2)
302 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/mac-address", &len);
304 memcpy(p, bd->bi_enet1addr, 6);
305 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/local-mac-address", &len);
307 memcpy(p, bd->bi_enet1addr, 6);
310 #if defined(CONFIG_TSEC3)
311 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@26000/mac-address", &len);
313 memcpy(p, bd->bi_enet2addr, 6);
314 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@26000/local-mac-address", &len);
316 memcpy(p, bd->bi_enet2addr, 6);
319 #if defined(CONFIG_TSEC4)
320 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@27000/mac-address", &len);
322 memcpy(p, bd->bi_enet3addr, 6);
323 p = ft_get_prop(blob, "/" OF_SOC "/ethernet@27000/local-mac-address", &len);
325 memcpy(p, bd->bi_enet3addr, 6);