2 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <dm/pinctrl.h>
10 #include <dm/uclass-internal.h>
11 #include <asm/arch/periph.h>
12 #include <power/regulator.h>
15 DECLARE_GLOBAL_DATA_PTR;
19 struct udevice *pinctrl, *regulator;
23 * The PWM do not have decicated interrupt number in dts and can
24 * not get periph_id by pinctrl framework, so let's init them here.
25 * The PWM2 and PWM3 are for pwm regulater.
27 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
29 debug("%s: Cannot find pinctrl device\n", __func__);
33 /* Enable pwm0 for panel backlight */
34 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0);
36 debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__, ret);
40 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
42 debug("%s PWM2 pinctrl init fail!\n", __func__);
46 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
48 debug("%s PWM3 pinctrl init fail!\n", __func__);
52 ret = regulators_enable_boot_on(false);
54 debug("%s: Cannot enable boot on regulator\n", __func__);
56 ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
58 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
62 ret = regulator_set_enable(regulator, true);
64 debug("%s vcc5v0-host-en set fail!\n", __func__);
72 void spl_board_init(void)
74 struct udevice *pinctrl;
77 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
79 debug("%s: Cannot find pinctrl device\n", __func__);
83 /* Enable debug UART */
84 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
86 debug("%s: Failed to set up console UART\n", __func__);
90 preloader_console_init();
93 printf("%s: Error %d\n", __func__, ret);
95 /* No way to report error here */