Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <debug_uart.h> |
| 8 | #include <dm.h> |
| 9 | #include <dm/pinctrl.h> |
| 10 | #include <ram.h> |
| 11 | #include <spl.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <asm/arch/cru_rk3368.h> |
| 14 | #include <asm/arch/grf_rk3368.h> |
| 15 | #include <asm/arch/hardware.h> |
| 16 | #include <asm/arch/periph.h> |
| 17 | #include <asm/arch/timer.h> |
| 18 | |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 19 | void board_debug_uart_init(void) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | void board_init_f(ulong dummy) |
| 24 | { |
| 25 | struct udevice *pinctrl; |
| 26 | struct udevice *dev; |
| 27 | int ret; |
| 28 | |
| 29 | ret = spl_early_init(); |
| 30 | if (ret) { |
| 31 | debug("spl_early_init() failed: %d\n", ret); |
| 32 | hang(); |
| 33 | } |
| 34 | |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 35 | /* Set up our preloader console */ |
| 36 | ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); |
| 37 | if (ret) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 38 | pr_err("%s: pinctrl init failed: %d\n", __func__, ret); |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 39 | hang(); |
| 40 | } |
| 41 | |
| 42 | ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0); |
| 43 | if (ret) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 44 | pr_err("%s: failed to set up console UART\n", __func__); |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 45 | hang(); |
| 46 | } |
| 47 | |
| 48 | preloader_console_init(); |
| 49 | |
| 50 | ret = uclass_get_device(UCLASS_RAM, 0, &dev); |
| 51 | if (ret) { |
| 52 | debug("DRAM init failed: %d\n", ret); |
| 53 | return; |
| 54 | } |
| 55 | } |
| 56 | |
Philipp Tomsich | a900e7c | 2017-06-12 10:33:20 +0200 | [diff] [blame] | 57 | u32 spl_boot_device(void) |
| 58 | { |
| 59 | return BOOT_DEVICE_MMC1; |
| 60 | } |
| 61 | |
| 62 | #ifdef CONFIG_SPL_LOAD_FIT |
| 63 | int board_fit_config_name_match(const char *name) |
| 64 | { |
| 65 | /* Just empty function now - can't decide what to choose */ |
| 66 | debug("%s: %s\n", __func__, name); |
| 67 | |
| 68 | return 0; |
| 69 | } |
| 70 | #endif |