blob: a2b0eb5a996c09b687cffc0fc413ac86085549b4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glassec3be542015-08-30 16:55:41 -06002/*
3 * (C) Copyright 2015 Google, Inc
Simon Glassec3be542015-08-30 16:55:41 -06004 */
5
6#include <common.h>
Simon Glassf11478f2019-12-28 10:45:07 -07007#include <hang.h>
Kever Yangca09f9a2019-07-22 19:59:24 +08008
9#ifdef CONFIG_SPL_BUILD
10static 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
33void 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