Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 2 | /* |
3 | * (C) Copyright 2016 Rockchip Electronics Co., Ltd | ||||
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 4 | */ |
Philipp Tomsich | fb74064 | 2017-09-29 19:27:54 +0200 | [diff] [blame] | 5 | |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 6 | #include <common.h> |
Kever Yang | ad05138 | 2016-08-16 17:58:13 +0800 | [diff] [blame] | 7 | #include <dm.h> |
8 | #include <dm/pinctrl.h> | ||||
Kever Yang | 15f09a1 | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 9 | #include <asm/arch-rockchip/periph.h> |
Kever Yang | 05c6e30 | 2016-08-24 12:02:22 +0800 | [diff] [blame] | 10 | #include <power/regulator.h> |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 11 | |
Kever Yang | 54b012f | 2019-07-22 20:02:18 +0800 | [diff] [blame^] | 12 | #ifndef CONFIG_SPL_BUILD |
13 | int board_early_init_f(void) | ||||
14 | { | ||||
15 | struct udevice *regulator; | ||||
16 | int ret; | ||||
17 | |||||
18 | ret = regulator_get_by_platname("vcc5v0_host", ®ulator); | ||||
19 | if (ret) { | ||||
20 | debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret); | ||||
21 | goto out; | ||||
22 | } | ||||
23 | |||||
24 | ret = regulator_set_enable(regulator, true); | ||||
25 | if (ret) | ||||
26 | debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret); | ||||
27 | |||||
28 | out: | ||||
29 | return 0; | ||||
30 | } | ||||
31 | |||||
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 32 | int board_init(void) |
33 | { | ||||
Mark Kettenis | 7c7ce36 | 2019-06-21 22:57:20 +0200 | [diff] [blame] | 34 | struct udevice *regulator; |
Kever Yang | ad05138 | 2016-08-16 17:58:13 +0800 | [diff] [blame] | 35 | int ret; |
36 | |||||
Kever Yang | 400b4ac | 2017-04-12 12:00:06 +0800 | [diff] [blame] | 37 | ret = regulators_enable_boot_on(false); |
Kever Yang | be3fcd0 | 2016-09-23 15:57:20 +0800 | [diff] [blame] | 38 | if (ret) |
Kever Yang | 400b4ac | 2017-04-12 12:00:06 +0800 | [diff] [blame] | 39 | debug("%s: Cannot enable boot on regulator\n", __func__); |
Kever Yang | be3fcd0 | 2016-09-23 15:57:20 +0800 | [diff] [blame] | 40 | |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 41 | return 0; |
42 | } | ||||
Kever Yang | 54b012f | 2019-07-22 20:02:18 +0800 | [diff] [blame^] | 43 | #endif |