2 * Copyright 2009 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/immap_85xx.h>
13 #include <asm/fsl_ddr_sdram.h>
14 #include <asm/fsl_law.h>
16 #define SYSCLK_MASK 0x00200000
17 #define BOARDREV_MASK 0x10100000
18 #define BOARDREV_B 0x10100000
19 #define BOARDREV_C 0x00100000
21 #define SYSCLK_66 66666666
22 #define SYSCLK_50 50000000
23 #define SYSCLK_100 100000000
25 DECLARE_GLOBAL_DATA_PTR
;
27 void board_init_f(ulong bootflag
)
29 uint plat_ratio
, bus_clk
, sys_clk
= 0;
30 volatile ccsr_gur_t
*gur
= (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR
);
31 volatile ccsr_gpio_t
*pgpio
= (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR
);
32 uint val
, temp
, sysclk_mask
;
35 sysclk_mask
= val
& SYSCLK_MASK
;
36 temp
= val
& BOARDREV_MASK
;
37 if (temp
== BOARDREV_C
) {
42 } else if (temp
== BOARDREV_B
) {
49 plat_ratio
= gur
->porpllsr
& 0x0000003e;
51 bus_clk
= plat_ratio
* sys_clk
;
52 NS16550_init((NS16550_t
)CONFIG_SYS_NS16550_COM1
,
53 bus_clk
/ 16 / CONFIG_BAUDRATE
);
55 puts("\nNAND boot... ");
57 /* copy code to DDR and jump to it - this should not return */
58 /* NOTE - code has to be copied out of NAND buffer before
59 * other blocks can be read.
61 relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP
, 0,
62 CONFIG_SYS_NAND_U_BOOT_RELOC
);
65 void board_init_r(gd_t
*gd
, ulong dest_addr
)
73 NS16550_putc((NS16550_t
)CONFIG_SYS_NS16550_COM1
, '\r');
75 NS16550_putc((NS16550_t
)CONFIG_SYS_NS16550_COM1
, c
);
78 void puts(const char *str
)