Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | ec3be54 | 2015-08-30 16:55:41 -0600 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2015 Google, Inc |
Simon Glass | ec3be54 | 2015-08-30 16:55:41 -0600 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 7 | #include <hang.h> |
Kever Yang | ca09f9a | 2019-07-22 19:59:24 +0800 | [diff] [blame] | 8 | |
| 9 | #ifdef CONFIG_SPL_BUILD |
| 10 | static int setup_led(void) |
| 11 | { |
| 12 | #ifdef CONFIG_SPL_LED |
| 13 | struct udevice *dev; |
| 14 | char *led_name; |
| 15 | int ret; |
| 16 | |
| 17 | led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led"); |
| 18 | if (!led_name) |
| 19 | return 0; |
| 20 | ret = led_get_by_label(led_name, &dev); |
| 21 | if (ret) { |
| 22 | debug("%s: get=%d\n", __func__, ret); |
| 23 | return ret; |
| 24 | } |
| 25 | ret = led_set_on(dev, 1); |
| 26 | if (ret) |
| 27 | return ret; |
| 28 | #endif |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | void spl_board_init(void) |
| 34 | { |
| 35 | int ret; |
| 36 | |
| 37 | ret = setup_led(); |
| 38 | if (ret) { |
| 39 | debug("LED ret=%d\n", ret); |
| 40 | hang(); |
| 41 | } |
| 42 | } |
| 43 | #endif |