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