Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Amarula Solutions |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 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> |
Philipp Tomsich | 9ba112b | 2019-04-30 00:00:38 +0200 | [diff] [blame] | 13 | #include <asm/arch-rockchip/bootrom.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 14 | #include <asm/arch-rockchip/clock.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 15 | #include <asm/arch-rockchip/sys_proto.h> |
| 16 | #include <asm/arch-rockchip/timer.h> |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 17 | |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 18 | void board_init_f(ulong dummy) |
| 19 | { |
| 20 | struct udevice *dev; |
| 21 | int ret; |
| 22 | |
Kever Yang | abfed9b | 2019-03-29 09:09:04 +0800 | [diff] [blame] | 23 | #ifdef CONFIG_DEBUG_UART |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 24 | /* |
| 25 | * Debug UART can be used from here if required: |
| 26 | * |
| 27 | * debug_uart_init(); |
| 28 | * printch('a'); |
| 29 | * printhex8(0x1234); |
| 30 | * printascii("string"); |
| 31 | */ |
| 32 | debug_uart_init(); |
Kever Yang | abfed9b | 2019-03-29 09:09:04 +0800 | [diff] [blame] | 33 | #endif |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 34 | ret = spl_early_init(); |
| 35 | if (ret) { |
| 36 | debug("spl_early_init() failed: %d\n", ret); |
| 37 | hang(); |
| 38 | } |
| 39 | |
| 40 | rockchip_timer_init(); |
| 41 | configure_l2ctlr(); |
| 42 | |
| 43 | ret = rockchip_get_clk(&dev); |
| 44 | if (ret) { |
| 45 | debug("CLK init failed: %d\n", ret); |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | ret = uclass_get_device(UCLASS_RAM, 0, &dev); |
| 50 | if (ret) { |
| 51 | debug("DRAM init failed: %d\n", ret); |
| 52 | return; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void board_return_to_bootrom(void) |
| 57 | { |
Philipp Tomsich | 7234c73 | 2017-10-10 16:21:16 +0200 | [diff] [blame] | 58 | back_to_bootrom(BROM_BOOT_NEXTSTAGE); |
Jagan Teki | 387fd4b | 2017-09-27 23:03:12 +0530 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | u32 spl_boot_device(void) |
| 62 | { |
| 63 | return BOOT_DEVICE_BOOTROM; |
| 64 | } |
| 65 | |
| 66 | void spl_board_init(void) |
| 67 | { |
| 68 | puts("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ |
| 69 | U_BOOT_TIME ")\n"); |
| 70 | } |