1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2004,2009-2011 Freescale Semiconductor, Inc.
5 * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
9 * cpu_init.c - low level cpu init
12 #include <asm-offsets.h>
18 #include <asm/fsl_law.h>
19 #include <asm/fsl_serdes.h>
22 extern void srio_init(void);
24 DECLARE_GLOBAL_DATA_PTR;
27 * Breathe some life into the CPU...
29 * Set up the memory map
30 * initialize a bunch of registers
35 /* Pointer is writable since we allocated a register for it */
36 gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
38 /* Clear initial global data */
39 memset ((void *) gd, 0, sizeof (gd_t));
47 init_early_memctl_regs();
49 #if defined(CONFIG_FSL_DMA)
53 /* enable the timebase bit in HID0 */
54 set_hid0(get_hid0() | 0x4000000);
56 /* enable EMCP, SYNCBE | ABE bits in HID1 */
57 set_hid1(get_hid1() | 0x80000C00);
61 * initialize higher level parts of CPU like timers
65 /* needs to be in ram since code uses global static vars */
68 #ifdef CONFIG_SYS_SRIO
72 #if defined(CONFIG_MP)
78 #ifdef CONFIG_ADDR_MAP
79 /* Initialize address mapping array */
80 void init_addr_map(void)
83 ppc_bat_t bat = DBAT0;
85 unsigned long upper, lower;
87 for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++, bat++) {
88 if (read_bat(bat, &upper, &lower) != -1) {
89 if (!BATU_VALID(upper))
92 size = BATU_SIZE(upper);
93 addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower),
96 #ifdef CONFIG_HIGH_BATS
97 /* High bats are not contiguous with low BAT numbers */