1 /*
2  * (C) Copyright 2015 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <debug_uart.h>
9 #include <asm/io.h>
10 #include <asm/arch/bootrom.h>
11 #include <asm/arch/grf_rk3036.h>
12 #include <asm/arch/hardware.h>
13 #include <asm/arch/sdram_rk3036.h>
14 #include <asm/arch/timer.h>
15 #include <asm/arch/uart.h>
16 
17 #define GRF_BASE	0x20008000
18 
19 #define DEBUG_UART_BASE	0x20068000
20 
21 void board_init_f(ulong dummy)
22 {
23 #ifdef EARLY_DEBUG
24 	struct rk3036_grf * const grf = (void *)GRF_BASE;
25 	/*
26 	 * NOTE: sd card and debug uart use same iomux in rk3036,
27 	 * so if you enable uart,
28 	 * you can not boot from sdcard
29 	 */
30 	rk_clrsetreg(&grf->gpio1c_iomux,
31 		     GPIO1C3_MASK << GPIO1C3_SHIFT |
32 		     GPIO1C2_MASK << GPIO1C2_SHIFT,
33 		     GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
34 		     GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
35 	debug_uart_init();
36 #endif
37 	rockchip_timer_init();
38 	sdram_init();
39 
40 	/* return to maskrom */
41 	back_to_bootrom(BROM_BOOT_NEXTSTAGE);
42 }
43 
44 /* Place Holders */
45 void board_init_r(gd_t *id, ulong dest_addr)
46 {
47 	/*
48 	 * Function attribute is no-return
49 	 * This Function never executes
50 	 */
51 	while (1)
52 		;
53 }
54