From: Patrick Delaunay Date: Fri, 27 Jul 2018 14:37:09 +0000 (+0200) Subject: sandbox: led: use new function to configure default state X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=17585e2dc33c23b3ea37daf485ced880c8fea3f8;p=u-boot.git sandbox: led: use new function to configure default state Initialize the led with the default state defined in device tree in board_init and solve issue with test for led default state. Reviewed-by: Simon Glass Signed-off-by: Patrick Delaunay --- diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 195f620834..0e87674826 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,14 @@ int dram_init(void) return 0; } +int board_init(void) +{ + if (IS_ENABLED(CONFIG_LED)) + led_default_state(); + + return 0; +} + #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { diff --git a/common/board_r.c b/common/board_r.c index 64f257409c..9402c0ef21 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -690,7 +690,8 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_DM initr_dm, #endif -#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) +#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \ + defined(CONFIG_SANDBOX) board_init, /* Setup chipselects */ #endif /* diff --git a/test/dm/led.c b/test/dm/led.c index 0071f216bb..00de7b3997 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -32,6 +32,9 @@ static int dm_test_led_default_state(struct unit_test_state *uts) { struct udevice *dev; + /* configure the default state (auto-probe) */ + led_default_state(); + /* Check that we handle the default-state property correctly. */ ut_assertok(led_get_by_label("sandbox:default_on", &dev)); ut_asserteq(LEDST_ON, led_get_state(dev));