From bb35d28701a3fac735c2dc891643086b80abfab3 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Wed, 19 Nov 2025 18:01:12 +0100 Subject: corvus: remove green led support green_led_on and green_led_off are only called by the legacy LED command (CONFIG_LED_STATUS_CMD) when CONFIG_LED_STATUS_GREEN is enabled, both of which aren't enabled for corvus, so let's simply remove it as it's dead code. Signed-off-by: Quentin Schulz Reviewed-by: Heiko Schocher --- board/siemens/corvus/board.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c index a8714e055d7..670bcab484c 100644 --- a/board/siemens/corvus/board.c +++ b/board/siemens/corvus/board.c @@ -53,7 +53,6 @@ static void corvus_request_gpio(void) gpio_request(AT91_PIN_PB18, "SPICS1"); gpio_request(AT91_PIN_PB3, "SPICS0"); gpio_request(AT91_PIN_PD31, "red led"); /* this is the user1 led */ - gpio_request(AT91_PIN_PD0, "green led"); /* this is the user2 led */ } void red_led_on(void) @@ -66,16 +65,6 @@ void red_led_off(void) gpio_set_value(AT91_PIN_PD31, 0); } -void green_led_on(void) -{ - gpio_set_value(AT91_PIN_PD0, 0); -} - -void green_led_off(void) -{ - gpio_set_value(AT91_PIN_PD0, 1); -} - static void corvus_nand_hw_init(void) { struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC; -- cgit v1.3.1 From 16415e9563ec04241c58f0a85cd2fc1d89f3033e Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Wed, 19 Nov 2025 18:01:13 +0100 Subject: led: remove support for green status led in legacy API The last user of it was removed in a previous commit so let's remove its support entirely. Signed-off-by: Quentin Schulz Reviewed-by: Heiko Schocher --- cmd/legacy_led.c | 6 ------ common/board_f.c | 2 -- doc/api/led.rst | 5 +---- drivers/led/Kconfig | 14 -------------- drivers/misc/gpio_led.c | 12 ------------ include/status_led.h | 4 ---- 6 files changed, 1 insertion(+), 42 deletions(-) diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 609a4b08e0a..2c6d606f48b 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -45,9 +45,6 @@ static const led_tbl_t led_commands[] = { { "5", CONFIG_LED_STATUS_BIT5, NULL, NULL, NULL }, #endif #endif -#ifdef CONFIG_LED_STATUS_GREEN - { "green", CONFIG_LED_STATUS_GREEN, green_led_off, green_led_on, NULL }, -#endif #ifdef CONFIG_LED_STATUS_RED { "red", CONFIG_LED_STATUS_RED, red_led_off, red_led_on, NULL }, #endif @@ -162,9 +159,6 @@ U_BOOT_CMD( "5|" #endif #endif -#ifdef CONFIG_LED_STATUS_GREEN - "green|" -#endif #ifdef CONFIG_LED_STATUS_RED "red|" #endif diff --git a/common/board_f.c b/common/board_f.c index 224cc0ac561..74571cb6d91 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -67,8 +67,6 @@ DECLARE_GLOBAL_DATA_PTR; */ __weak void red_led_on(void) {} __weak void red_led_off(void) {} -__weak void green_led_on(void) {} -__weak void green_led_off(void) {} /* * Why is gd allocated a register? Prior to reloc it might be better to diff --git a/doc/api/led.rst b/doc/api/led.rst index 6488416c8b9..6889f487851 100644 --- a/doc/api/led.rst +++ b/doc/api/led.rst @@ -58,8 +58,7 @@ CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting. This must be a valid LED number (0-5). CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be -a valid LED number (0-5). Other similar color LED's macros are -CONFIG_STATUS_LED_GREEN. +a valid LED number (0-5). General LED functions ~~~~~~~~~~~~~~~~~~~~~ @@ -81,8 +80,6 @@ The functions names explain their purpose. - red_LED_on - red_LED_off -- green_LED_on -- green_LED_off These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define these functions in the board specific source. diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 1077792efb0..6b043f9a522 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -414,20 +414,6 @@ config LED_STATUS_RED endif # LED_STATUS_RED_ENABLE -config LED_STATUS_GREEN_ENABLE - bool "Enable green LED" - help - Enable green status LED. - -if LED_STATUS_GREEN_ENABLE - -config LED_STATUS_GREEN - int "Green LED identification" - help - Valid enabled LED device number (0-5). - -endif # LED_STATUS_GREEN_ENABLE - config LED_STATUS_CMD bool "Enable status LED commands" diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index e806b1f241f..a1432a53440 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -67,16 +67,4 @@ void red_led_off(void) } #endif -#ifdef CONFIG_LED_STATUS_GREEN -void green_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_ON); -} - -void green_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_OFF); -} -#endif - #endif /* CONFIG_GPIO_LED_STUBS */ diff --git a/include/status_led.h b/include/status_led.h index 85e583f18c8..8e8b19f8c19 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -72,13 +72,9 @@ static inline void status_led_boot_blink(void) { } #ifndef __ASSEMBLY__ void red_led_on(void); void red_led_off(void); -void green_led_on(void); -void green_led_off(void); #else .extern red_led_on .extern red_led_off - .extern green_led_on - .extern green_led_off #endif #endif /* _STATUS_LED_H_ */ -- cgit v1.3.1 From b06e52f2ea937077b3ff8296e4a67648138ac897 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Wed, 19 Nov 2025 18:01:14 +0100 Subject: corvus: migrate red LED to the modern API red_led_on is either called from the legacy LED shell command (which is disabled for corvus) or from arm-specific assembly code right before jumping into board_init_r() in U-Boot proper. Let's migrate to use the more modern LED subsystem by migrating to DM. The default-state is set to on to mimic red_led_on() from the arm-specific assembly code as a missing default-state FDT property currently means the LED is not probed except if explicitly done via the led shell command. Note though that this is running much later in the boot process, once DM is started. Signed-off-by: Quentin Schulz Reviewed-by: Heiko Schocher --- arch/arm/dts/at91sam9g45-corvus.dts | 11 +++++++++++ board/siemens/corvus/board.c | 11 ----------- configs/corvus_defconfig | 2 ++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/dts/at91sam9g45-corvus.dts b/arch/arm/dts/at91sam9g45-corvus.dts index 67be80bb2b3..acc05994650 100644 --- a/arch/arm/dts/at91sam9g45-corvus.dts +++ b/arch/arm/dts/at91sam9g45-corvus.dts @@ -10,6 +10,7 @@ * 2011 Nicolas Ferre */ /dts-v1/; +#include #include "at91sam9g45.dtsi" / { @@ -106,4 +107,14 @@ status = "okay"; }; }; + + leds { + compatible = "gpio-leds"; + + red_led: led-0 { + gpios = <&pioD 31 GPIO_ACTIVE_HIGH>; + color = ; + default-state = "on"; + }; + }; }; diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c index 670bcab484c..4c83774fceb 100644 --- a/board/siemens/corvus/board.c +++ b/board/siemens/corvus/board.c @@ -52,17 +52,6 @@ static void corvus_request_gpio(void) gpio_request(AT91_PIN_PD3, "USB1"); gpio_request(AT91_PIN_PB18, "SPICS1"); gpio_request(AT91_PIN_PB3, "SPICS0"); - gpio_request(AT91_PIN_PD31, "red led"); /* this is the user1 led */ -} - -void red_led_on(void) -{ - gpio_set_value(AT91_PIN_PD31, 1); -} - -void red_led_off(void) -{ - gpio_set_value(AT91_PIN_PD31, 0); } static void corvus_nand_hw_init(void) diff --git a/configs/corvus_defconfig b/configs/corvus_defconfig index fe7d53bcdd8..3d16b9e3abe 100644 --- a/configs/corvus_defconfig +++ b/configs/corvus_defconfig @@ -75,6 +75,8 @@ CONFIG_CLK_AT91=y CONFIG_DFU_NAND=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000 CONFIG_AT91_GPIO=y +CONFIG_LED=y +CONFIG_LED_GPIO=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT=y -- cgit v1.3.1 From c4594242aafc3452948a6b57dfbaacdfb4ed0860 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Wed, 19 Nov 2025 18:01:15 +0100 Subject: led: remove support for red LED in legacy API To the exception of red_led_on in the arm-specific assembly code, all code interacting with the red status LED was guarded by the CONFIG_LED_STATUS_RED symbol, which is enabled in none of the upstream defconfigs. Since the last board which overrode the weak red_led_on function got migrated to the new LED mechanism, there's also no user of the arm-specific assembly code anymore, therefore it can be removed along the other unreachable code sections. Signed-off-by: Quentin Schulz Reviewed-by: Heiko Schocher --- arch/arm/lib/crt0.S | 3 --- cmd/legacy_led.c | 6 ------ common/board_f.c | 14 -------------- doc/api/led.rst | 16 ---------------- drivers/led/Kconfig | 14 -------------- drivers/misc/gpio_led.c | 18 ------------------ include/status_led.h | 12 ------------ 7 files changed, 83 deletions(-) diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 9acaf2cddef..d10c129705d 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -183,9 +183,6 @@ here: movne r9, r0 # endif -#if ! defined(CONFIG_XPL_BUILD) - bl red_led_on -#endif /* call board_init_r(gd_t *id, ulong dest_addr) */ mov r0, r9 /* gd_t */ ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 2c6d606f48b..4e0d09522ad 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -44,9 +44,6 @@ static const led_tbl_t led_commands[] = { #ifdef CONFIG_LED_STATUS5 { "5", CONFIG_LED_STATUS_BIT5, NULL, NULL, NULL }, #endif -#endif -#ifdef CONFIG_LED_STATUS_RED - { "red", CONFIG_LED_STATUS_RED, red_led_off, red_led_on, NULL }, #endif { NULL, 0, NULL, NULL, NULL } }; @@ -158,9 +155,6 @@ U_BOOT_CMD( #ifdef CONFIG_LED_STATUS5 "5|" #endif -#endif -#ifdef CONFIG_LED_STATUS_RED - "red|" #endif "all] [on|off|toggle|blink] [blink-freq in ms]", "[led_name] [on|off|toggle|blink] sets or clears led(s)" diff --git a/common/board_f.c b/common/board_f.c index 74571cb6d91..df2b0dc899b 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -54,20 +54,6 @@ DECLARE_GLOBAL_DATA_PTR; -/* - * TODO(sjg@chromium.org): IMO this code should be - * refactored to a single function, something like: - * - * void led_set_state(enum led_colour_t colour, int on); - */ -/************************************************************************ - * Coloured LED functionality - ************************************************************************ - * May be supplied by boards if desired - */ -__weak void red_led_on(void) {} -__weak void red_led_off(void) {} - /* * Why is gd allocated a register? Prior to reloc it might be better to * just pass it around to each function in this file? diff --git a/doc/api/led.rst b/doc/api/led.rst index 6889f487851..9ae3f5fe252 100644 --- a/doc/api/led.rst +++ b/doc/api/led.rst @@ -57,9 +57,6 @@ Some other LED macros CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting. This must be a valid LED number (0-5). -CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be -a valid LED number (0-5). - General LED functions ~~~~~~~~~~~~~~~~~~~~~ The following functions should be defined: @@ -71,19 +68,6 @@ __led_set is called to change the state of the LED. __led_toggle is called to toggle the current state of the LED. -Colour LED ----------- - -Colour LED's are at present only used by ARM. - -The functions names explain their purpose. - -- red_LED_on -- red_LED_off - -These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define -these functions in the board specific source. - TBD : Describe older board dependent macros similar to what is done for TBD : Describe general support via asm/status_led.h diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 6b043f9a522..cc715ceb286 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -400,20 +400,6 @@ config LED_STATUS_BOOT endif # LED_STATUS_BOOT_ENABLE -config LED_STATUS_RED_ENABLE - bool "Enable red LED" - help - Enable red status LED. - -if LED_STATUS_RED_ENABLE - -config LED_STATUS_RED - int "Red LED identification" - help - Valid enabled LED device number. - -endif # LED_STATUS_RED_ENABLE - config LED_STATUS_CMD bool "Enable status LED commands" diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index a1432a53440..1e2f83cca93 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -50,21 +50,3 @@ void __led_toggle(led_id_t mask) { gpio_set_value(mask, !gpio_get_value(mask)); } - -#ifdef CONFIG_GPIO_LED_STUBS - -/* 'generic' override of colored LED stubs, to use GPIO functions instead */ - -#ifdef CONFIG_LED_STATUS_RED -void red_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON); -} - -void red_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF); -} -#endif - -#endif /* CONFIG_GPIO_LED_STUBS */ diff --git a/include/status_led.h b/include/status_led.h index 8e8b19f8c19..c3ff399b1ae 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -65,16 +65,4 @@ static inline void status_led_set(int led, int state) { } static inline void status_led_boot_blink(void) { } #endif /* CONFIG_LED_STATUS */ - -/* - * Coloured LEDs API - */ -#ifndef __ASSEMBLY__ -void red_led_on(void); -void red_led_off(void); -#else - .extern red_led_on - .extern red_led_off -#endif - #endif /* _STATUS_LED_H_ */ -- cgit v1.3.1