2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-08-30 22:55:41 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2015 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-12-28 17:45:07 +00:00
|
|
|
#include <hang.h>
|
2020-08-20 09:32:52 +00:00
|
|
|
#include <led.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2021-08-07 13:24:01 +00:00
|
|
|
#include <dm/ofnode.h>
|
2019-07-22 11:59:24 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
static int setup_led(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_SPL_LED
|
|
|
|
struct udevice *dev;
|
|
|
|
char *led_name;
|
|
|
|
int ret;
|
|
|
|
|
2021-08-07 13:24:01 +00:00
|
|
|
led_name = ofnode_conf_read_str("u-boot,boot-led");
|
2019-07-22 11:59:24 +00:00
|
|
|
if (!led_name)
|
|
|
|
return 0;
|
|
|
|
ret = led_get_by_label(led_name, &dev);
|
|
|
|
if (ret) {
|
|
|
|
debug("%s: get=%d\n", __func__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2020-08-20 09:32:52 +00:00
|
|
|
ret = led_set_state(dev, LEDST_ON);
|
2019-07-22 11:59:24 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void spl_board_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = setup_led();
|
|
|
|
if (ret) {
|
|
|
|
debug("LED ret=%d\n", ret);
|
|
|
|
hang();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|