blob: 7c3a8036549ecbe267083b47a9eb684ed8c879d7 [file] [log] [blame]
Suniel Maheshf1cd07b2020-02-03 19:20:04 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
4 */
5
6#include <common.h>
7#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Suniel Maheshf1cd07b2020-02-03 19:20:04 +05309#include <asm/arch-rockchip/periph.h>
10#include <power/regulator.h>
Suniel Maheshfe65e712020-02-03 19:20:05 +053011#include <spl_gpio.h>
12#include <asm/io.h>
13#include <asm/arch-rockchip/gpio.h>
Suniel Maheshf1cd07b2020-02-03 19:20:04 +053014
15#ifndef CONFIG_SPL_BUILD
16int board_early_init_f(void)
17{
18 struct udevice *regulator;
19 int ret;
20
21 ret = regulator_get_by_platname("vcc5v0_host", &regulator);
22 if (ret) {
23 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
24 goto out;
25 }
26
27 ret = regulator_set_enable(regulator, true);
28 if (ret)
29 debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
30out:
31 return 0;
32}
33#endif
Suniel Maheshfe65e712020-02-03 19:20:05 +053034
35#if defined(CONFIG_TPL_BUILD)
36
Suniel Maheshfe65e712020-02-03 19:20:05 +053037#define GPIO0_BASE 0xff720000
38
39int board_early_init_f(void)
40{
41 struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE;
Suniel Maheshfe65e712020-02-03 19:20:05 +053042
Suniel Mahesh00927302020-04-02 18:22:30 +053043 /* Turn on red LED, indicating full power mode */
Suniel Maheshfe65e712020-02-03 19:20:05 +053044 spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1);
45
46 return 0;
47}
48#endif