1 /* Copyright 2013 Freescale Semiconductor, Inc.
3 * SPDX-License-Identifier: GPL-2.0+
13 #include "../common/qixis.h"
14 #include "b4860qds_qixis.h"
16 DECLARE_GLOBAL_DATA_PTR;
18 phys_size_t get_effective_memsize(void)
20 return CONFIG_SYS_L3_SIZE;
23 unsigned long get_board_sys_clk(void)
25 u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
27 switch ((sysclk_conf & 0x0C) >> 2) {
38 unsigned long get_board_ddr_clk(void)
40 u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
42 switch (ddrclk_conf & 0x03) {
53 void board_init_f(ulong bootflag)
55 u32 plat_ratio, sys_clk, uart_clk;
56 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
58 /* Memcpy existing GD at CONFIG_SPL_GD_ADDR */
59 memcpy((void *)CONFIG_SPL_GD_ADDR, (void *)gd, sizeof(gd_t));
61 /* Update GD pointer */
62 gd = (gd_t *)(CONFIG_SPL_GD_ADDR);
64 /* compiler optimization barrier needed for GCC >= 3.4 */
65 __asm__ __volatile__("" : : : "memory");
69 /* initialize selected port with appropriate baud rate */
70 sys_clk = get_board_sys_clk();
71 plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
72 uart_clk = sys_clk * plat_ratio / 2;
74 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
75 uart_clk / 16 / CONFIG_BAUDRATE);
77 relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
80 void board_init_r(gd_t *gd, ulong dest_addr)
84 bd = (bd_t *)(gd + sizeof(gd_t));
85 memset(bd, 0, sizeof(bd_t));
87 bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
88 bd->bi_memsize = CONFIG_SYS_L3_SIZE;
92 mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
93 CONFIG_SPL_RELOC_MALLOC_SIZE);
94 gd->flags |= GD_FLG_FULL_MALLOC_INIT;
96 #ifndef CONFIG_SPL_NAND_BOOT
100 /* relocate environment function pointers etc. */
101 nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
102 (uchar *)CONFIG_ENV_ADDR);
103 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
113 #ifdef CONFIG_SPL_NAND_BOOT