blob: 1965985a0f4eb96a9347146cdecf80ea05bb8e86 [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>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Kever Yangca09f9a2019-07-22 19:59:24 +08009
10#ifdef CONFIG_SPL_BUILD
11static int setup_led(void)
12{
13#ifdef CONFIG_SPL_LED
14 struct udevice *dev;
15 char *led_name;
16 int ret;
17
18 led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led");
19 if (!led_name)
20 return 0;
21 ret = led_get_by_label(led_name, &dev);
22 if (ret) {
23 debug("%s: get=%d\n", __func__, ret);
24 return ret;
25 }
26 ret = led_set_on(dev, 1);
27 if (ret)
28 return ret;
29#endif
30
31 return 0;
32}
33
34void spl_board_init(void)
35{
36 int ret;
37
38 ret = setup_led();
39 if (ret) {
40 debug("LED ret=%d\n", ret);
41 hang();
42 }
43}
44#endif