1 /* Copyright 2013 Freescale Semiconductor, Inc.
3 * SPDX-License-Identifier: GPL-2.0+
8 #include <environment.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 phys_size_t get_effective_memsize(void)
19 return CONFIG_SYS_L2_SIZE;
22 void board_init_f(ulong bootflag)
25 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
29 /* initialize selected port with appropriate baud rate */
30 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
32 gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
34 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
35 gd->bus_clk / 16 / CONFIG_BAUDRATE);
37 /* copy code to RAM and jump to it - this should not return */
38 /* NOTE - code has to be copied out of NAND buffer before
39 * other blocks can be read.
41 relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
44 void board_init_r(gd_t *gd, ulong dest_addr)
46 /* Pointer is writable since we allocated a register for it */
47 gd = (gd_t *)CONFIG_SPL_GD_ADDR;
50 memset(gd, 0, sizeof(gd_t));
51 bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
52 memset(bd, 0, sizeof(bd_t));
54 bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
55 bd->bi_memsize = CONFIG_SYS_L2_SIZE;
59 mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
60 CONFIG_SPL_RELOC_MALLOC_SIZE);
61 gd->flags |= GD_FLG_FULL_MALLOC_INIT;
63 /* relocate environment function pointers etc. */
64 nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
65 (uchar *)CONFIG_ENV_ADDR);
66 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
67 gd->env_valid = ENV_VALID;
73 #ifdef CONFIG_SPL_NAND_BOOT