Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / board / firefly / firefly-rk3288 / firefly-rk3288.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2015 Google, Inc
4  */
5
6 #include <common.h>
7 #include <hang.h>
8 #include <led.h>
9 #include <log.h>
10
11 #ifdef CONFIG_SPL_BUILD
12 DECLARE_GLOBAL_DATA_PTR;
13 static int setup_led(void)
14 {
15 #ifdef CONFIG_SPL_LED
16         struct udevice *dev;
17         char *led_name;
18         int ret;
19
20         led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led");
21         if (!led_name)
22                 return 0;
23         ret = led_get_by_label(led_name, &dev);
24         if (ret) {
25                 debug("%s: get=%d\n", __func__, ret);
26                 return ret;
27         }
28         ret = led_set_state(dev, LEDST_ON);
29         if (ret)
30                 return ret;
31 #endif
32
33         return 0;
34 }
35
36 void spl_board_init(void)
37 {
38         int ret;
39
40         ret = setup_led();
41         if (ret) {
42                 debug("LED ret=%d\n", ret);
43                 hang();
44         }
45 }
46 #endif