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>
17 DECLARE_GLOBAL_DATA_PTR;
20 * Default board reset function
27 void board_reset(void) __attribute__((weak, alias("__board_reset")));
36 char buf1[32], buf2[32];
37 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
38 volatile ccsr_gur_t *gur = &immap->im_gur;
40 uint msscr0 = mfspr(MSSCR0);
46 if (cpu_numcores() > 1) {
48 puts("Unicore software on multiprocessor system!!\n"
49 "To enable mutlticore build define CONFIG_MP\n");
58 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
62 major = PVR_E600_MAJ(pvr);
63 minor = PVR_E600_MIN(pvr);
65 printf("e600 Core %d", (msscr0 & 0x20) ? 1 : 0);
66 if (gur->pordevsr & MPC86xx_PORDEVSR_CORE1TE)
67 puts("\n Core1Translation Enabled");
68 debug(" (MSSCR0=%x, PORDEVSR=%x)", msscr0, gur->pordevsr);
70 printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
72 get_sys_info(&sysinfo);
74 puts("Clock Configuration:\n");
75 printf(" CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freq_processor));
76 printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freq_systembus));
77 printf(" DDR:%-4s MHz (%s MT/s data rate), ",
78 strmhz(buf1, sysinfo.freq_systembus / 2),
79 strmhz(buf2, sysinfo.freq_systembus));
81 if (sysinfo.freq_localbus > LCRR_CLKDIV) {
82 printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freq_localbus));
84 printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
85 sysinfo.freq_localbus);
88 puts("L1: D-cache 32 KiB enabled\n");
89 puts(" I-cache 32 KiB enabled\n");
92 if (get_l2cr() & 0x80000000) {
93 #if defined(CONFIG_MPC8610)
95 #elif defined(CONFIG_MPC8641)
98 puts(" KiB enabled\n");
107 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
109 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
110 volatile ccsr_gur_t *gur = &immap->im_gur;
112 /* Attempt board-specific reset */
115 /* Next try asserting HRESET_REQ */
116 out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
126 * Get timebase clock frequency
133 get_sys_info(&sys_info);
134 return (sys_info.freq_systembus + 3L) / 4L;
138 #if defined(CONFIG_WATCHDOG)
142 #if defined(CONFIG_MPC8610)
144 * This actually feed the hard enabled watchdog.
146 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
147 volatile ccsr_wdt_t *wdt = &immap->im_wdt;
148 volatile ccsr_gur_t *gur = &immap->im_gur;
149 u32 tmp = gur->pordevsr;
157 #endif /* CONFIG_WATCHDOG */
160 * Print out the state of various machine registers.
161 * Currently prints out LAWs, BR0/OR0, and BATs
163 void mpc86xx_reginfo(void)
171 * Set the DDR BATs to reflect the actual size of DDR.
173 * dram_size is the actual size of DDR, in bytes
175 * Note: we assume that CONFIG_MAX_MEM_MAPPED is 2G or smaller as we only
176 * are using a single BAT to cover DDR.
178 * If this is not true, (e.g. CONFIG_MAX_MEM_MAPPED is 2GB but HID0_XBSEN
179 * is not defined) then we might have a situation where U-Boot will attempt
180 * to relocated itself outside of the region mapped by DBAT0.
181 * This will cause a machine check.
183 * Currently we are limited to power of two sized DDR since we only use a
184 * single bat. If a non-power of two size is used that is less than
185 * CONFIG_MAX_MEM_MAPPED u-boot will crash.
188 void setup_ddr_bat(phys_addr_t dram_size)
190 unsigned long batu, bl;
192 bl = TO_BATU_BL(min(dram_size, CONFIG_MAX_MEM_MAPPED));
194 if (BATU_SIZE(bl) != dram_size) {
195 u64 sz = (u64)dram_size - BATU_SIZE(bl);
196 print_size(sz, " left unmapped\n");
199 batu = bl | BATU_VS | BATU_VP;
200 write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L);
201 write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L);