1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
8 #include <dm/pinctrl.h>
9 #include <dm/uclass-internal.h>
10 #include <asm/arch-rockchip/periph.h>
11 #include <power/regulator.h>
16 struct udevice
*pinctrl
, *regulator
;
20 * The PWM do not have decicated interrupt number in dts and can
21 * not get periph_id by pinctrl framework, so let's init them here.
22 * The PWM2 and PWM3 are for pwm regulater.
24 ret
= uclass_get_device(UCLASS_PINCTRL
, 0, &pinctrl
);
26 debug("%s: Cannot find pinctrl device\n", __func__
);
30 /* Enable pwm0 for panel backlight */
31 ret
= pinctrl_request_noflags(pinctrl
, PERIPH_ID_PWM0
);
33 debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__
, ret
);
37 ret
= pinctrl_request_noflags(pinctrl
, PERIPH_ID_PWM2
);
39 debug("%s PWM2 pinctrl init fail!\n", __func__
);
43 ret
= pinctrl_request_noflags(pinctrl
, PERIPH_ID_PWM3
);
45 debug("%s PWM3 pinctrl init fail!\n", __func__
);
49 ret
= regulators_enable_boot_on(false);
51 debug("%s: Cannot enable boot on regulator\n", __func__
);
53 ret
= regulator_get_by_platname("vcc5v0_host", ®ulator
);
55 debug("%s vcc5v0_host init fail! ret %d\n", __func__
, ret
);
59 ret
= regulator_set_enable(regulator
, true);
61 debug("%s vcc5v0-host-en set fail!\n", __func__
);
69 void spl_board_init(void)
71 struct udevice
*pinctrl
;
74 ret
= uclass_get_device(UCLASS_PINCTRL
, 0, &pinctrl
);
76 debug("%s: Cannot find pinctrl device\n", __func__
);
80 /* Enable debug UART */
81 ret
= pinctrl_request_noflags(pinctrl
, PERIPH_ID_UART_DBG
);
83 debug("%s: Failed to set up console UART\n", __func__
);
87 preloader_console_init();
90 printf("%s: Error %d\n", __func__
, ret
);
92 /* No way to report error here */