board: rk3399: Drop explicit uart enablement in spl_board_init
[project/bcm63xx/u-boot.git] / board / rockchip / evb_rk3399 / evb-rk3399.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
4 */
5
6 #include <common.h>
7 #include <dm.h>
8 #include <dm/pinctrl.h>
9 #include <asm/arch-rockchip/periph.h>
10 #include <power/regulator.h>
11 #include <spl.h>
12
13 int board_init(void)
14 {
15 struct udevice *pinctrl, *regulator;
16 int ret;
17
18 /*
19 * The PWM do not have decicated interrupt number in dts and can
20 * not get periph_id by pinctrl framework, so let's init them here.
21 * The PWM2 and PWM3 are for pwm regulater.
22 */
23 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
24 if (ret) {
25 debug("%s: Cannot find pinctrl device\n", __func__);
26 goto out;
27 }
28
29 /* Enable pwm0 for panel backlight */
30 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0);
31 if (ret) {
32 debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__, ret);
33 goto out;
34 }
35
36 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
37 if (ret) {
38 debug("%s PWM2 pinctrl init fail!\n", __func__);
39 goto out;
40 }
41
42 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
43 if (ret) {
44 debug("%s PWM3 pinctrl init fail!\n", __func__);
45 goto out;
46 }
47
48 ret = regulators_enable_boot_on(false);
49 if (ret)
50 debug("%s: Cannot enable boot on regulator\n", __func__);
51
52 ret = regulator_get_by_platname("vcc5v0_host", &regulator);
53 if (ret) {
54 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
55 goto out;
56 }
57
58 ret = regulator_set_enable(regulator, true);
59 if (ret) {
60 debug("%s vcc5v0-host-en set fail!\n", __func__);
61 goto out;
62 }
63
64 out:
65 return 0;
66 }
67
68 void spl_board_init(void)
69 {
70 preloader_console_init();
71
72 return;
73 }