blob: b055ed4aee00d09c39d4e70eb9546f0950c1a4ad [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Philipp Tomsicha900e7c2017-06-12 10:33:20 +02002/*
3 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
Philipp Tomsicha900e7c2017-06-12 10:33:20 +02004 */
5
6#include <common.h>
7#include <debug_uart.h>
8#include <dm.h>
Philipp Tomsicha900e7c2017-06-12 10:33:20 +02009#include <ram.h>
10#include <spl.h>
11#include <asm/io.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080012#include <asm/arch-rockchip/periph.h>
Simon Glassf473eba2019-01-21 14:53:31 -070013#include <dm/pinctrl.h>
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020014
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020015void board_init_f(ulong dummy)
16{
17 struct udevice *pinctrl;
18 struct udevice *dev;
19 int ret;
20
21 ret = spl_early_init();
22 if (ret) {
23 debug("spl_early_init() failed: %d\n", ret);
24 hang();
25 }
26
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020027 /* Set up our preloader console */
28 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
29 if (ret) {
Masahiro Yamada81e10422017-09-16 14:10:41 +090030 pr_err("%s: pinctrl init failed: %d\n", __func__, ret);
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020031 hang();
32 }
33
34 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0);
35 if (ret) {
Masahiro Yamada81e10422017-09-16 14:10:41 +090036 pr_err("%s: failed to set up console UART\n", __func__);
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020037 hang();
38 }
39
40 preloader_console_init();
41
42 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
43 if (ret) {
44 debug("DRAM init failed: %d\n", ret);
45 return;
46 }
47}
48
Philipp Tomsicha900e7c2017-06-12 10:33:20 +020049u32 spl_boot_device(void)
50{
51 return BOOT_DEVICE_MMC1;
52}
53
54#ifdef CONFIG_SPL_LOAD_FIT
55int board_fit_config_name_match(const char *name)
56{
57 /* Just empty function now - can't decide what to choose */
58 debug("%s: %s\n", __func__, name);
59
60 return 0;
61}
62#endif