[PATCH 3/4] corvus: migrate red LED to the modern API

Heiko Schocher hs at nabladev.com
Thu Nov 20 10:21:29 CET 2025


Hello Quentin,

again added Adrian...

On 19.11.25 18:01, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at cherry.de>
> 
> 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 <quentin.schulz at cherry.de>
> ---
>   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 <nicolas.ferre at atmel.com>
>    */
>   /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/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
> 

Thanks!

Reviewed-by: Heiko Schocher <hs at nabladev.com>

bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic


More information about the U-Boot mailing list