summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-12-05 13:38:32 -0600
committerTom Rini <[email protected]>2025-12-05 13:38:32 -0600
commit384d3785df4dbe452f9fbb4bd9c9c9e986cdc205 (patch)
tree93df78019fee580bc6a1691ac585eb86f5bc83a5
parent1a5e3be3aca271901c3d4c5e0d5fd23c27e258b6 (diff)
parentc4594242aafc3452948a6b57dfbaacdfb4ed0860 (diff)
Merge patch series "led: remove unused legacy LED code"
Quentin Schulz <[email protected]> says: Only the Siemens corvus board seems to be using these two status LEDs from the legacy LED API. Since we're trying to get rid of the last users of the legacy LED API, let's migrate Corvus to the modern LED API instead, which uses DM. For Corvus's case, it also uses DM_GPIO (already enabled in defconfig). Since there was no use for the green status_led (not compiled in), it simply is removed without migrating it to the modern API. If need be, we can always add a new gpio-led in the FDT. Note that I do not own a Siemens Corvus board so it's a bit of a shot in the dark whether it'll work on the first try, only build tested. The red LED should be on whenever reaching U-Boot proper CLI, if not we have an issue. The LED should be controllable with the led command from U-Boot proper CLI. Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/arm/dts/at91sam9g45-corvus.dts11
-rw-r--r--arch/arm/lib/crt0.S3
-rw-r--r--board/siemens/corvus/board.c22
-rw-r--r--cmd/legacy_led.c12
-rw-r--r--common/board_f.c16
-rw-r--r--configs/corvus_defconfig2
-rw-r--r--doc/api/led.rst19
-rw-r--r--drivers/led/Kconfig28
-rw-r--r--drivers/misc/gpio_led.c30
-rw-r--r--include/status_led.h16
10 files changed, 13 insertions, 146 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 <[email protected]>
*/
/dts-v1/;
+#include <dt-bindings/leds/common.h>
#include "at91sam9g45.dtsi"
/ {
@@ -106,4 +107,14 @@
status = "okay";
};
};
+
+ leds {
+ compatible = "gpio-leds";
+
+ red_led: led-0 {
+ gpios = <&pioD 31 GPIO_ACTIVE_HIGH>;
+ color = <LED_COLOR_ID_RED>;
+ default-state = "on";
+ };
+ };
};
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/board/siemens/corvus/board.c b/board/siemens/corvus/board.c
index a8714e055d7..4c83774fceb 100644
--- a/board/siemens/corvus/board.c
+++ b/board/siemens/corvus/board.c
@@ -52,28 +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 */
- gpio_request(AT91_PIN_PD0, "green led"); /* this is the user2 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);
-}
-
-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)
diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
index 609a4b08e0a..4e0d09522ad 100644
--- a/cmd/legacy_led.c
+++ b/cmd/legacy_led.c
@@ -45,12 +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
{ NULL, 0, NULL, NULL, NULL }
};
@@ -162,12 +156,6 @@ U_BOOT_CMD(
"5|"
#endif
#endif
-#ifdef CONFIG_LED_STATUS_GREEN
- "green|"
-#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 224cc0ac561..df2b0dc899b 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -55,22 +55,6 @@
DECLARE_GLOBAL_DATA_PTR;
/*
- * TODO([email protected]): 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) {}
-__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
* just pass it around to each function in this file?
*
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
diff --git a/doc/api/led.rst b/doc/api/led.rst
index 6488416c8b9..9ae3f5fe252 100644
--- a/doc/api/led.rst
+++ b/doc/api/led.rst
@@ -57,10 +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). Other similar color LED's macros are
-CONFIG_STATUS_LED_GREEN.
-
General LED functions
~~~~~~~~~~~~~~~~~~~~~
The following functions should be defined:
@@ -72,21 +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
-- 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.
-
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 1077792efb0..cc715ceb286 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -400,34 +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_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..1e2f83cca93 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -50,33 +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
-
-#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..c3ff399b1ae 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -65,20 +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);
-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_ */