blob: 92d40ee43ae6078c7ca04d11ea35219ed468a2c7 [file] [log] [blame]
Kever Yangc34643e2019-04-02 20:41:24 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
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 <asm/io.h>
12#include <asm/arch-rockchip/bootrom.h>
13#include <asm/arch-rockchip/timer.h>
14
15u32 spl_boot_device(void)
16{
17 return BOOT_DEVICE_MMC1;
18}
19
20void board_init_f(ulong dummy)
21{
22 struct udevice *dev;
23 int ret;
24
25 /*
26 * Debug UART can be used from here if required:
27 *
28 * debug_uart_init();
29 * printch('a');
30 * printhex8(0x1234);
31 * printascii("string");
32 */
33 debug_uart_init();
34 printascii("TPL Init");
35
36 ret = spl_early_init();
37 if (ret) {
38 debug("spl_early_init() failed: %d\n", ret);
39 hang();
40 }
41
42 rockchip_timer_init();
43 printf("timer init done\n");
44 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
45 if (ret) {
46 printf("DRAM init failed: %d\n", ret);
47 return;
48 }
49
50#if defined(CONFIG_TPL_ROCKCHIP_BACK_TO_BROM) && !defined(CONFIG_TPL_BOARD_INIT)
51 back_to_bootrom(BROM_BOOT_NEXTSTAGE);
52#endif
53}