2 * Copyright 2011 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
11 #include <linux/compiler.h>
12 #include <asm/fsl_law.h>
13 #include <fsl_ddr_sdram.h>
14 #include <asm/global_data.h>
16 DECLARE_GLOBAL_DATA_PTR;
17 #define SYSCLK_MASK 0x00200000
18 #define BOARDREV_MASK 0x10100000
20 #define SYSCLK_66 66666666
21 #define SYSCLK_100 100000000
23 unsigned long get_board_sys_clk(ulong dummy)
25 ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
26 u32 val_gpdat, sysclk_gpio;
28 val_gpdat = in_be32(&pgpio->gpdat);
29 sysclk_gpio = val_gpdat & SYSCLK_MASK;
39 void board_init_f(ulong bootflag)
42 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
44 #if defined(CONFIG_SYS_NAND_BR_PRELIM) && defined(CONFIG_SYS_NAND_OR_PRELIM)
45 set_lbc_br(0, CONFIG_SYS_NAND_BR_PRELIM);
46 set_lbc_or(0, CONFIG_SYS_NAND_OR_PRELIM);
49 /* initialize selected port with appropriate baud rate */
50 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
52 gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
54 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
55 gd->bus_clk / 16 / CONFIG_BAUDRATE);
57 puts("\nNAND boot... ");
59 /* copy code to RAM and jump to it - this should not return */
60 /* NOTE - code has to be copied out of NAND buffer before
61 * other blocks can be read.
63 relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
66 void board_init_r(gd_t *gd, ulong dest_addr)
68 puts("\nSecond program loader running in sram...");
75 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
77 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
80 void puts(const char *str)