blob: c7e93a358db8e75237f2c407a6f07d244d3af84a [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Kever Yanga381bcf2016-07-19 21:16:59 +08002/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
Kever Yanga381bcf2016-07-19 21:16:59 +08004 */
Philipp Tomsichfb740642017-09-29 19:27:54 +02005
Kever Yanga381bcf2016-07-19 21:16:59 +08006#include <common.h>
Kever Yangad051382016-08-16 17:58:13 +08007#include <dm.h>
8#include <dm/pinctrl.h>
Kever Yang15f09a12019-03-28 11:01:23 +08009#include <asm/arch-rockchip/periph.h>
Kever Yang05c6e302016-08-24 12:02:22 +080010#include <power/regulator.h>
Kever Yanga381bcf2016-07-19 21:16:59 +080011
Kever Yang54b012f2019-07-22 20:02:18 +080012#ifndef CONFIG_SPL_BUILD
13int board_early_init_f(void)
14{
15 struct udevice *regulator;
16 int ret;
17
18 ret = regulator_get_by_platname("vcc5v0_host", &regulator);
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
28out:
29 return 0;
30}
31
Kever Yanga381bcf2016-07-19 21:16:59 +080032int board_init(void)
33{
Mark Kettenis7c7ce362019-06-21 22:57:20 +020034 struct udevice *regulator;
Kever Yangad051382016-08-16 17:58:13 +080035 int ret;
36
Kever Yang400b4ac2017-04-12 12:00:06 +080037 ret = regulators_enable_boot_on(false);
Kever Yangbe3fcd02016-09-23 15:57:20 +080038 if (ret)
Kever Yang400b4ac2017-04-12 12:00:06 +080039 debug("%s: Cannot enable boot on regulator\n", __func__);
Kever Yangbe3fcd02016-09-23 15:57:20 +080040
Kever Yanga381bcf2016-07-19 21:16:59 +080041 return 0;
42}
Kever Yang54b012f2019-07-22 20:02:18 +080043#endif