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