1 /* Copyright 2013 Freescale Semiconductor, Inc.
3 * SPDX-License-Identifier: GPL-2.0+
12 #include <fsl_esdhc.h>
13 #include <spi_flash.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;
26 struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
30 /* Clock configuration to access CPLD using IFC(GPCM) */
31 setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
33 #ifdef CONFIG_P1010RDB_PB
34 setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_GPIO01_DRVVBUS);
37 /* initialize selected port with appropriate baud rate */
38 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
40 gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
42 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
43 gd->bus_clk / 16 / CONFIG_BAUDRATE);
45 #ifdef CONFIG_SPL_MMC_BOOT
46 puts("\nSD boot...\n");
47 #elif defined(CONFIG_SPL_SPI_BOOT)
48 puts("\nSPI Flash boot...\n");
50 /* copy code to RAM and jump to it - this should not return */
51 /* NOTE - code has to be copied out of NAND buffer before
52 * other blocks can be read.
54 relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
57 void board_init_r(gd_t *gd, ulong dest_addr)
59 /* Pointer is writable since we allocated a register for it */
60 gd = (gd_t *)CONFIG_SPL_GD_ADDR;
63 memset(gd, 0, sizeof(gd_t));
64 bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
65 memset(bd, 0, sizeof(bd_t));
67 bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
68 bd->bi_memsize = CONFIG_SYS_L2_SIZE;
72 mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
73 CONFIG_SPL_RELOC_MALLOC_SIZE);
75 #ifndef CONFIG_SPL_NAND_BOOT
78 #ifdef CONFIG_SPL_MMC_BOOT
82 /* relocate environment function pointers etc. */
83 #ifdef CONFIG_SPL_NAND_BOOT
84 nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
85 (uchar *)CONFIG_ENV_ADDR);
86 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
94 gd->ram_size = initdram(0);
95 #ifdef CONFIG_SPL_NAND_BOOT
96 puts("\nTertiary program loader running in sram...");
98 puts("\nSecond program loader running in sram...");
101 #ifdef CONFIG_SPL_MMC_BOOT
103 #elif defined(CONFIG_SPL_SPI_BOOT)
105 #elif defined(CONFIG_SPL_NAND_BOOT)