2 * Copyright 2006,2009-2010 Freescale Semiconductor, Inc.
4 * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
6 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/cache.h>
15 #include <asm/fsl_law.h>
18 DECLARE_GLOBAL_DATA_PTR;
21 * Default board reset function
28 void board_reset(void) __attribute__((weak, alias("__board_reset")));
37 char buf1[32], buf2[32];
38 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
39 volatile ccsr_gur_t *gur = &immap->im_gur;
41 uint msscr0 = mfspr(MSSCR0);
47 if (cpu_numcores() > 1) {
49 puts("Unicore software on multiprocessor system!!\n"
50 "To enable mutlticore build define CONFIG_MP\n");
59 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
63 major = PVR_E600_MAJ(pvr);
64 minor = PVR_E600_MIN(pvr);
66 printf("e600 Core %d", (msscr0 & 0x20) ? 1 : 0);
67 if (gur->pordevsr & MPC86xx_PORDEVSR_CORE1TE)
68 puts("\n Core1Translation Enabled");
69 debug(" (MSSCR0=%x, PORDEVSR=%x)", msscr0, gur->pordevsr);
71 printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
73 get_sys_info(&sysinfo);
75 puts("Clock Configuration:\n");
76 printf(" CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freq_processor));
77 printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freq_systembus));
78 printf(" DDR:%-4s MHz (%s MT/s data rate), ",
79 strmhz(buf1, sysinfo.freq_systembus / 2),
80 strmhz(buf2, sysinfo.freq_systembus));
82 if (sysinfo.freq_localbus > LCRR_CLKDIV) {
83 printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freq_localbus));
85 printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
86 sysinfo.freq_localbus);
89 puts("L1: D-cache 32 KiB enabled\n");
90 puts(" I-cache 32 KiB enabled\n");
93 if (get_l2cr() & 0x80000000) {
94 #if defined(CONFIG_ARCH_MPC8610)
96 #elif defined(CONFIG_ARCH_MPC8641)
99 puts(" KiB enabled\n");
108 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
110 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
111 volatile ccsr_gur_t *gur = &immap->im_gur;
113 /* Attempt board-specific reset */
116 /* Next try asserting HRESET_REQ */
117 out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
127 * Get timebase clock frequency
134 get_sys_info(&sys_info);
135 return (sys_info.freq_systembus + 3L) / 4L;
139 #if defined(CONFIG_WATCHDOG)
143 #if defined(CONFIG_ARCH_MPC8610)
145 * This actually feed the hard enabled watchdog.
147 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
148 volatile ccsr_wdt_t *wdt = &immap->im_wdt;
149 volatile ccsr_gur_t *gur = &immap->im_gur;
150 u32 tmp = gur->pordevsr;
158 #endif /* CONFIG_WATCHDOG */
161 * Print out the state of various machine registers.
162 * Currently prints out LAWs, BR0/OR0, and BATs
164 void print_reginfo(void)
172 * Set the DDR BATs to reflect the actual size of DDR.
174 * dram_size is the actual size of DDR, in bytes
176 * Note: we assume that CONFIG_MAX_MEM_MAPPED is 2G or smaller as we only
177 * are using a single BAT to cover DDR.
179 * If this is not true, (e.g. CONFIG_MAX_MEM_MAPPED is 2GB but HID0_XBSEN
180 * is not defined) then we might have a situation where U-Boot will attempt
181 * to relocated itself outside of the region mapped by DBAT0.
182 * This will cause a machine check.
184 * Currently we are limited to power of two sized DDR since we only use a
185 * single bat. If a non-power of two size is used that is less than
186 * CONFIG_MAX_MEM_MAPPED u-boot will crash.
189 void setup_ddr_bat(phys_addr_t dram_size)
191 unsigned long batu, bl;
193 bl = TO_BATU_BL(min(dram_size, CONFIG_MAX_MEM_MAPPED));
195 if (BATU_SIZE(bl) != dram_size) {
196 u64 sz = (u64)dram_size - BATU_SIZE(bl);
197 print_size(sz, " left unmapped\n");
200 batu = bl | BATU_VS | BATU_VP;
201 write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L);
202 write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L);