[PATCH] board: softing: vining: migrate to modern LED framework

Chee, Tien Fong tienfong.chee at altera.com
Mon Dec 1 04:58:36 CET 2025


On 20/11/2025 1:19 am, Quentin Schulz wrote:
> [CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]
>
> From: Quentin Schulz<quentin.schulz at cherry.de>
>
> This migrates from the legacy LED API to use the modern LED framework
> which makes use of the FDT.
>
> Signed-off-by: Quentin Schulz<quentin.schulz at cherry.de>
> ---
> This migrates the Softing VIN|ING FPGA board to use the modern LED API.
>
> I do not own such board so I cannot test it. I'm a bit unsure about the
> port and pin in the port to use for the GPIO LEDs. The numbering for the
> GPIO controller in arch/arm/dts/socfpga_cyclone5_vining_fpga.dts seems
> incorrect too (29 pins in GPIO0 means 0..28, 29 pins in GPIO1, means
> 29..57). I'm unsure about the polarity as well.
>
> The GPIO LEDs are only automatically probed (and controlled) if they
> have a default-state. In our case, the LEDs are init to off as far as I
> could tell, so we add the default-state property to each node and set it
> to off. To be able to lit LED_STATUS1 and LED_STATUS2, we need to access
> them via their label.
>
> This is only build tested as I do not own the board. Would appreciate if
> anyone could test it. As far as I understood, all LEDs should be turned
> off automatically during boot by U-Boot and then two LEDs should be
> turned on. One should be able to control all 4 LEDs from U-Boot proper
> CLI with the led command.
>
> This is a follow-up to:
> -https://lore.kernel.org/u-boot/20251112-led-old-dt-v1-0-2892d49517db@cherry.de/
> -https://lore.kernel.org/u-boot/20251114162417.4054006-1-patrice.chotard@foss.st.com/
> -https://lore.kernel.org/u-boot/20251119-legacy-led-unused-code-v1-0-bc0ae1235baa@cherry.de/
> -https://lore.kernel.org/all/20251119-corvus-led-red-green-v1-0-ce86b8d59dfc@cherry.de/
>
> to continue the effort of getting rid of the legacy LED API. This series
> depends on the series listed above.
>
> Multiple other smaller series are coming. I split the whole thing into
> different chunks as separate series:
>   - "shot in the dark" migration of Socfpga Softing Vining board (this
>     series)
>   - removal of LED support for a board with no easy migration path
>   - make Sunxi community bear the cost of maintaining the last part of the
>     legacy API by making it Sunxi-specific,
>   - migrate Olinuxino to new API (which requires net/bootp.c to use the
>     new API at the same time) + remove everything related to legacy LED
>     API,
> ---
>   .../dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi   | 26 ++++++++++++++++++++++
>   board/softing/vining_fpga/socfpga.c                | 12 +++++++---
>   configs/socfpga_vining_fpga_defconfig              | 13 ++---------
>   3 files changed, 37 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi b/arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi
> index 330949c0184..bf5e12ec90c 100644
> --- a/arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi
> +++ b/arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi
> @@ -13,6 +13,32 @@
>                  spi0 = "/soc/spi at ff705000";
>                  udc0 = &usb1;
>          };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               led-0 {
> +                       default-state = "off";
> +                       gpios = <&portb 20 GPIO_ACTIVE_HIGH>;
> +               };
> +
> +               led-1 {
> +                       default-state = "off";
> +                       gpios = <&portb 25 GPIO_ACTIVE_HIGH>;
> +                       label = "status_1";
> +               };
> +
> +               led-2 {
> +                       default-state = "off";
> +                       gpios = <&portb 26 GPIO_ACTIVE_HIGH>;
> +                       label = "status_2";
> +               };
> +
> +               led-3 {
> +                       default-state = "off";
> +                       gpios = <&portc 7 GPIO_ACTIVE_HIGH>;
> +               };
> +       };
>   };
>
>   &mmc {
> diff --git a/board/softing/vining_fpga/socfpga.c b/board/softing/vining_fpga/socfpga.c
> index ec2c7ea3631..475c19f2781 100644
> --- a/board/softing/vining_fpga/socfpga.c
> +++ b/board/softing/vining_fpga/socfpga.c
> @@ -8,7 +8,7 @@
>   #include <env.h>
>   #include <init.h>
>   #include <net.h>
> -#include <status_led.h>
> +#include <led.h>
>   #include <asm/arch/reset_manager.h>
>   #include <asm/global_data.h>
>   #include <asm/io.h>
> @@ -24,10 +24,16 @@ DECLARE_GLOBAL_DATA_PTR;
>   int board_late_init(void)
>   {
>          const unsigned int usb_nrst_gpio = 35;
> +       struct udevice *dev;
>          int ret;
>
> -       status_led_set(1, CONFIG_LED_STATUS_ON);
> -       status_led_set(2, CONFIG_LED_STATUS_ON);
> +       ret = led_get_by_label("status_1", &dev);
> +       if (!ret)
> +               led_set_state(dev, LEDST_ON);
> +
> +       ret = led_get_by_label("status_2", &dev);
> +       if (!ret)
> +               led_set_state(dev, LEDST_ON);
>
>          /* Address of boot parameters for ATAG (if ATAG is used) */
>          gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
> index f3b6cb717b3..396b7a9715d 100644
> --- a/configs/socfpga_vining_fpga_defconfig
> +++ b/configs/socfpga_vining_fpga_defconfig
> @@ -78,17 +78,8 @@ CONFIG_SYS_DFU_DATA_BUF_SIZE=0x1000000
>   CONFIG_DWAPB_GPIO=y
>   CONFIG_DM_I2C=y
>   CONFIG_SYS_I2C_DW=y
> -CONFIG_LED_STATUS=y
> -CONFIG_LED_STATUS_GPIO=y
> -CONFIG_LED_STATUS0=y
> -CONFIG_LED_STATUS_BIT=48
> -CONFIG_LED_STATUS1=y
> -CONFIG_LED_STATUS_BIT1=53
> -CONFIG_LED_STATUS2=y
> -CONFIG_LED_STATUS_BIT2=54
> -CONFIG_LED_STATUS3=y
> -CONFIG_LED_STATUS_BIT3=65
> -CONFIG_LED_STATUS_CMD=y
> +CONFIG_LED=y
> +CONFIG_LED_GPIO=y
>   CONFIG_MISC=y
>   CONFIG_I2C_EEPROM=y
>   CONFIG_SYS_I2C_EEPROM_ADDR=0x50


Acked-by: Tien Fong Chee <tien.fong.chee at altera.com>

Best regards,
Tien Fong


More information about the U-Boot mailing list