Commit 13cfbe51357bf3275b14046e0031ea2b7fdaf8ce
Committed by
Tom Rini
1 parent
d375ebbcb6
Exists in
v2017.01-smarct4x
and in
30 other branches
allow LED initialization without STATUS_LED_BOOT
For current U-Boot to initialize status LEDs via status_led_init(), it is required to have both CONFIG_STATUS_LED and STATUS_LED_BOOT defined. This may be a particular concern with GPIO LEDs, where __led_init() is required to correctly set up the GPIO (gpio_request and gpio_direction_output). Without STATUS_LED_BOOT the initialization isn't called, which could leave the user with a non-functional "led" command - due to the fact that the LED routines in gpio_led.c use gpio_set_value() just fine, but the GPIO never got set up properly in the first place. I think having CONFIG_STATUS_LED is sufficient to justify a corresponding call to status_led_init(), even with no STATUS_LED_BOOT defined. To do so, common/board_r.c needs call that routine, so it now is exposed via status_led.h. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> [trini: Add dummy __led_init to pca9551_led.c] Signed-off-by: Tom Rini <trini@konsulko.com>
Showing 4 changed files with 13 additions and 5 deletions Side-by-side Diff
common/board_r.c
... | ... | @@ -544,11 +544,14 @@ |
544 | 544 | } |
545 | 545 | #endif |
546 | 546 | |
547 | -#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) | |
547 | +#if defined(CONFIG_STATUS_LED) | |
548 | 548 | static int initr_status_led(void) |
549 | 549 | { |
550 | +#if defined(STATUS_LED_BOOT) | |
550 | 551 | status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING); |
551 | - | |
552 | +#else | |
553 | + status_led_init(); | |
554 | +#endif | |
552 | 555 | return 0; |
553 | 556 | } |
554 | 557 | #endif |
... | ... | @@ -835,7 +838,7 @@ |
835 | 838 | || defined(CONFIG_M68K) |
836 | 839 | timer_init, /* initialize timer */ |
837 | 840 | #endif |
838 | -#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) | |
841 | +#if defined(CONFIG_STATUS_LED) | |
839 | 842 | initr_status_led, |
840 | 843 | #endif |
841 | 844 | /* PPC has a udelay(20) here dating from 2002. Why? */ |
drivers/misc/pca9551_led.c
... | ... | @@ -116,8 +116,12 @@ |
116 | 116 | } |
117 | 117 | |
118 | 118 | /* |
119 | - * Functions referenced by cmd_led.c | |
119 | + * Functions referenced by cmd_led.c or status_led.c | |
120 | 120 | */ |
121 | +void __led_init(led_id_t id, int state) | |
122 | +{ | |
123 | +} | |
124 | + | |
121 | 125 | void __led_set(led_id_t mask, int state) |
122 | 126 | { |
123 | 127 | if (state == STATUS_LED_OFF) |
drivers/misc/status_led.c