Suniel Mahesh | f1cd07b | 2020-02-03 19:20:04 +0530 | [diff] [blame] | 1 | // 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 Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 8 | #include <log.h> |
Suniel Mahesh | f1cd07b | 2020-02-03 19:20:04 +0530 | [diff] [blame] | 9 | #include <asm/arch-rockchip/periph.h> |
| 10 | #include <power/regulator.h> |
Suniel Mahesh | fe65e71 | 2020-02-03 19:20:05 +0530 | [diff] [blame] | 11 | #include <spl_gpio.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <asm/arch-rockchip/gpio.h> |
Suniel Mahesh | f1cd07b | 2020-02-03 19:20:04 +0530 | [diff] [blame] | 14 | |
| 15 | #ifndef CONFIG_SPL_BUILD |
| 16 | int board_early_init_f(void) |
| 17 | { |
| 18 | struct udevice *regulator; |
| 19 | int ret; |
| 20 | |
| 21 | ret = regulator_get_by_platname("vcc5v0_host", ®ulator); |
| 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); |
| 30 | out: |
| 31 | return 0; |
| 32 | } |
| 33 | #endif |
Suniel Mahesh | fe65e71 | 2020-02-03 19:20:05 +0530 | [diff] [blame] | 34 | |
| 35 | #if defined(CONFIG_TPL_BUILD) |
| 36 | |
Suniel Mahesh | fe65e71 | 2020-02-03 19:20:05 +0530 | [diff] [blame] | 37 | #define GPIO0_BASE 0xff720000 |
| 38 | |
| 39 | int board_early_init_f(void) |
| 40 | { |
| 41 | struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; |
Suniel Mahesh | fe65e71 | 2020-02-03 19:20:05 +0530 | [diff] [blame] | 42 | |
Suniel Mahesh | 0092730 | 2020-04-02 18:22:30 +0530 | [diff] [blame] | 43 | /* Turn on red LED, indicating full power mode */ |
Suniel Mahesh | fe65e71 | 2020-02-03 19:20:05 +0530 | [diff] [blame] | 44 | spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | #endif |