blob: abb76585cf8eea0679e4d9db7f09f671236cd5c8 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Kever Yang0d3d7832016-07-19 21:16:59 +08002/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
Kever Yang0d3d7832016-07-19 21:16:59 +08004 */
Philipp Tomsich3df66262017-09-29 19:27:54 +02005
Kever Yang0d3d7832016-07-19 21:16:59 +08006#include <common.h>
Kever Yang6d26c062016-08-16 17:58:13 +08007#include <dm.h>
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080010#include <asm/arch-rockchip/periph.h>
Kever Yangb1395292016-08-24 12:02:22 +080011#include <power/regulator.h>
Kever Yang0d3d7832016-07-19 21:16:59 +080012
Kever Yang804c9f12019-07-22 20:02:18 +080013#ifndef CONFIG_SPL_BUILD
14int board_early_init_f(void)
Kever Yang0d3d7832016-07-19 21:16:59 +080015{
Mark Kettenisc741f532019-06-21 22:57:20 +020016 struct udevice *regulator;
Kever Yang6d26c062016-08-16 17:58:13 +080017 int ret;
18
Kever Yangb1395292016-08-24 12:02:22 +080019 ret = regulator_get_by_platname("vcc5v0_host", &regulator);
20 if (ret) {
21 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
22 goto out;
23 }
24
25 ret = regulator_set_enable(regulator, true);
Kever Yang804c9f12019-07-22 20:02:18 +080026 if (ret)
27 debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
Kever Yangb1395292016-08-24 12:02:22 +080028
Kever Yang6d26c062016-08-16 17:58:13 +080029out:
Kever Yang0d3d7832016-07-19 21:16:59 +080030 return 0;
31}
Kever Yang804c9f12019-07-22 20:02:18 +080032#endif