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