blob: a3f784f0a3a0ef1232aa9cb041db3010a6190270 [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>
Kever Yangca09f9a2019-07-22 19:59:24 +08007
8#ifdef CONFIG_SPL_BUILD
9static 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
32void 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