1 /* 2 * Copyright (C) 2017 Amarula Solutions 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <debug_uart.h> 9 #include <dm.h> 10 #include <ram.h> 11 #include <spl.h> 12 #include <version.h> 13 #include <asm/io.h> 14 #include <asm/arch/bootrom.h> 15 #include <asm/arch/clock.h> 16 #include <asm/arch/grf_rk3288.h> 17 #include <asm/arch/periph.h> 18 #include <asm/arch/pmu_rk3288.h> 19 #include <asm/arch/sys_proto.h> 20 #include <asm/arch/timer.h> 21 22 DECLARE_GLOBAL_DATA_PTR; 23 24 #define GRF_BASE 0xff770000 25 void board_init_f(ulong dummy) 26 { 27 struct udevice *dev; 28 int ret; 29 30 /* Example code showing how to enable the debug UART on RK3288 */ 31 /* Enable early UART on the RK3288 */ 32 struct rk3288_grf * const grf = (void *)GRF_BASE; 33 34 rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT | 35 GPIO7C6_MASK << GPIO7C6_SHIFT, 36 GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT | 37 GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT); 38 /* 39 * Debug UART can be used from here if required: 40 * 41 * debug_uart_init(); 42 * printch('a'); 43 * printhex8(0x1234); 44 * printascii("string"); 45 */ 46 debug_uart_init(); 47 48 ret = spl_early_init(); 49 if (ret) { 50 debug("spl_early_init() failed: %d\n", ret); 51 hang(); 52 } 53 54 rockchip_timer_init(); 55 configure_l2ctlr(); 56 57 ret = rockchip_get_clk(&dev); 58 if (ret) { 59 debug("CLK init failed: %d\n", ret); 60 return; 61 } 62 63 ret = uclass_get_device(UCLASS_RAM, 0, &dev); 64 if (ret) { 65 debug("DRAM init failed: %d\n", ret); 66 return; 67 } 68 } 69 70 void board_return_to_bootrom(void) 71 { 72 back_to_bootrom(BROM_BOOT_NEXTSTAGE); 73 } 74 75 u32 spl_boot_device(void) 76 { 77 return BOOT_DEVICE_BOOTROM; 78 } 79 80 void spl_board_init(void) 81 { 82 puts("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ 83 U_BOOT_TIME ")\n"); 84 } 85