0f5ef3a09a434b290012530c9f639ed07d9e5f39
[project/bcm63xx/u-boot.git] / board / vamrs / rock960_rk3399 / rock960-rk3399.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
4 */
5
6 #include <common.h>
7 #include <dm.h>
8 #include <dm/pinctrl.h>
9 #include <dm/uclass-internal.h>
10 #include <asm/arch-rockchip/periph.h>
11 #include <power/regulator.h>
12 #include <spl.h>
13
14 int board_init(void)
15 {
16 int ret;
17
18 ret = regulators_enable_boot_on(false);
19 if (ret)
20 debug("%s: Cannot enable boot on regulator\n", __func__);
21
22 return 0;
23 }
24
25 void spl_board_init(void)
26 {
27 struct udevice *pinctrl;
28 int ret;
29
30 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
31 if (ret) {
32 debug("%s: Cannot find pinctrl device\n", __func__);
33 goto err;
34 }
35
36 /* Enable debug UART */
37 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
38 if (ret) {
39 debug("%s: Failed to set up console UART\n", __func__);
40 goto err;
41 }
42
43 preloader_console_init();
44 return;
45 err:
46 printf("%s: Error %d\n", __func__, ret);
47
48 /* No way to report error here */
49 hang();
50 }