[PATCH v2 00/25] led: Remove old status-LED code

There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2: - Combine code-removal and defconfig changes - Add a patch to enable LED and LED_BOOT for these boards - Add a patch to enable LED and LED_BOOT for these boards - Enable LED on the 5 affected platforms - Reorder patches for bisectability
Simon Glass (25): eb_cpu5282: Drop status-LED code and enable LED vining_fpga: Drop status-LED code mx23_olinuxino: Drop status-LED code mx23_olinuxino: pinephone: Enable LED socfpga_vining_fpga: Enable LED led: Drop LED_STATUS_BOARD_SPECIFIC arm: Drop old LED support common: doc: Drop old LED support st: stm32f429: Drop old LED code led: Make the LED config common led: Drop LED_STATUS from Kconfig led: Drop the legacy LED command misc: Drop gpio_led driver pca9551_led: Delete driver misc: status_led: Delete driver m68k: Drop unused status_led.h header file powerpc: Drop status-LED code igep00x0: Drop unused status_led.h header file sunxi: Drop status-LED code common: Drop status-LED code in board_r image: Drop unused status_led.h header file ide: Drop unused status_led.h header file mpc83xx: Drop status-LED code net: Drop status-LED code led: Drop status_led header file
arch/arm/lib/crt0.S | 4 - arch/m68k/lib/bootm.c | 3 - arch/powerpc/lib/interrupts.c | 6 - board/BuS/eb_cpu5282/eb_cpu5282.c | 20 -- board/isee/igep00x0/igep00x0.c | 1 - board/olimex/mx23_olinuxino/mx23_olinuxino.c | 7 - board/softing/vining_fpga/socfpga.c | 4 - board/st/stm32f429-discovery/Makefile | 1 - board/st/stm32f429-discovery/led.c | 39 --- board/sunxi/board.c | 6 - boot/image.c | 4 - cmd/Makefile | 1 - cmd/ide.c | 4 - cmd/legacy_led.c | 185 ---------- common/board_f.c | 22 -- common/board_r.c | 27 -- configs/eb_cpu5282_defconfig | 8 +- configs/eb_cpu5282_internal_defconfig | 8 +- configs/mx23_olinuxino_defconfig | 10 +- configs/pinephone_defconfig | 7 +- configs/socfpga_vining_fpga_defconfig | 13 +- doc/README.LED | 77 ----- drivers/led/Kconfig | 342 +------------------ drivers/misc/Kconfig | 13 - drivers/misc/Makefile | 3 - drivers/misc/gpio_led.c | 106 ------ drivers/misc/pca9551_led.c | 170 --------- drivers/misc/status_led.c | 124 ------- drivers/timer/mpc83xx_timer.c | 5 - include/configs/eb_cpu5282.h | 6 - include/status_led.h | 115 ------- net/bootp.c | 7 - net/net.c | 33 -- 33 files changed, 21 insertions(+), 1360 deletions(-) delete mode 100644 board/st/stm32f429-discovery/led.c delete mode 100644 cmd/legacy_led.c delete mode 100644 doc/README.LED delete mode 100644 drivers/misc/gpio_led.c delete mode 100644 drivers/misc/pca9551_led.c delete mode 100644 drivers/misc/status_led.c delete mode 100644 include/status_led.h

Drop this old code. Swtich the LED options to use the new approach, in the same commit, to maintain build-bisectability.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Combine code-removal and defconfig changes
board/BuS/eb_cpu5282/eb_cpu5282.c | 20 -------------------- configs/eb_cpu5282_defconfig | 8 ++------ configs/eb_cpu5282_internal_defconfig | 8 ++------ include/configs/eb_cpu5282.h | 6 ------ 4 files changed, 4 insertions(+), 38 deletions(-)
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c index c254da62bf4..cdd862c57d2 100644 --- a/board/BuS/eb_cpu5282/eb_cpu5282.c +++ b/board/BuS/eb_cpu5282/eb_cpu5282.c @@ -14,7 +14,6 @@ #include <bmp_layout.h> #include <env.h> #include <init.h> -#include <status_led.h> #include <bus_vcxk.h>
/*---------------------------------------------------------------------------*/ @@ -160,25 +159,6 @@ int misc_init_r(void) return 1; }
-void __led_toggle(led_id_t mask) -{ - MCFGPTA_GPTPORT ^= (1 << 3); -} - -void __led_init(led_id_t mask, int state) -{ - __led_set(mask, state); - MCFGPTA_GPTDDR |= (1 << 3); -} - -void __led_set(led_id_t mask, int state) -{ - if (state == CONFIG_LED_STATUS_ON) - MCFGPTA_GPTPORT |= (1 << 3); - else - MCFGPTA_GPTPORT &= ~(1 << 3); -} - /*---------------------------------------------------------------------------*/
/* EOF EB+MCF-EV123.c */ diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig index 271dbdf4dbb..c51a5db262e 100644 --- a/configs/eb_cpu5282_defconfig +++ b/configs/eb_cpu5282_defconfig @@ -35,12 +35,8 @@ CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=8 -CONFIG_LED_STATUS_BOOT_ENABLE=y -CONFIG_LED_STATUS_BOOT=0 -CONFIG_LED_STATUS_CMD=y +CONFIG_LED=y +CONFIG_LED_BOOT=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y diff --git a/configs/eb_cpu5282_internal_defconfig b/configs/eb_cpu5282_internal_defconfig index 89a7925dffa..3627d25b990 100644 --- a/configs/eb_cpu5282_internal_defconfig +++ b/configs/eb_cpu5282_internal_defconfig @@ -33,12 +33,8 @@ CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=8 -CONFIG_LED_STATUS_BOOT_ENABLE=y -CONFIG_LED_STATUS_BOOT=0 -CONFIG_LED_STATUS_CMD=y +CONFIG_LED=y +CONFIG_LED_BOOT=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y diff --git a/include/configs/eb_cpu5282.h b/include/configs/eb_cpu5282.h index 26e4ade34ee..a4d1338c8fa 100644 --- a/include/configs/eb_cpu5282.h +++ b/include/configs/eb_cpu5282.h @@ -14,12 +14,6 @@
#define CFG_SYS_UART_PORT (0)
-/*----------------------------------------------------------------------* - * Options * - *----------------------------------------------------------------------*/ - -#define STATUS_LED_ACTIVE 0 - /*----------------------------------------------------------------------* * Configuration for environment * * Environment is in the second sector of the first 256k of flash *

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/softing/vining_fpga/socfpga.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/board/softing/vining_fpga/socfpga.c b/board/softing/vining_fpga/socfpga.c index ec2c7ea3631..700184cc575 100644 --- a/board/softing/vining_fpga/socfpga.c +++ b/board/softing/vining_fpga/socfpga.c @@ -8,7 +8,6 @@ #include <env.h> #include <init.h> #include <net.h> -#include <status_led.h> #include <asm/arch/reset_manager.h> #include <asm/global_data.h> #include <asm/io.h> @@ -26,9 +25,6 @@ int board_late_init(void) const unsigned int usb_nrst_gpio = 35; int ret;
- status_led_set(1, CONFIG_LED_STATUS_ON); - status_led_set(2, CONFIG_LED_STATUS_ON); - /* Address of boot parameters for ATAG (if ATAG is used) */ gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/olimex/mx23_olinuxino/mx23_olinuxino.c | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index b2bb6678c23..78136c1620a 100644 --- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c +++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c @@ -13,9 +13,6 @@ #include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> -#ifdef CONFIG_LED_STATUS -#include <status_led.h> -#endif #include <linux/delay.h>
DECLARE_GLOBAL_DATA_PTR; @@ -61,9 +58,5 @@ int board_init(void) /* Adress of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE) - status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE); -#endif - return 0; }

On 10/21/24 1:38 PM, Simon Glass wrote:
This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org
Why not enable the new DM LED here to avoid breakage ?
DTTO for the other boards ?

Drop the STATUS_LED options and enable LED and LED_BOOT instead, since this is the new way to access the LED functionality.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Add a patch to enable LED and LED_BOOT for these boards
configs/mx23_olinuxino_defconfig | 10 ++-------- configs/pinephone_defconfig | 7 ++----- 2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/configs/mx23_olinuxino_defconfig b/configs/mx23_olinuxino_defconfig index 3016f750e64..c1319077891 100644 --- a/configs/mx23_olinuxino_defconfig +++ b/configs/mx23_olinuxino_defconfig @@ -39,14 +39,8 @@ CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y CONFIG_MXS_GPIO=y -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS_GPIO=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=778 -CONFIG_LED_STATUS_STATE=2 -CONFIG_LED_STATUS_BOOT_ENABLE=y -CONFIG_LED_STATUS_BOOT=0 -CONFIG_LED_STATUS_CMD=y +CONFIG_LED=y +CONFIG_LED_BOOT=y CONFIG_MMC_MXS=y CONFIG_CONS_INDEX=0 CONFIG_DM_SERIAL=y diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig index 9d39204a439..272fce1c1a4 100644 --- a/configs/pinephone_defconfig +++ b/configs/pinephone_defconfig @@ -11,8 +11,5 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_PINEPHONE_DT_SELECTION=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2" -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS_GPIO=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=114 -CONFIG_LED_STATUS_STATE=2 +CONFIG_LED=y +CONFIG_LED_BOOT=y

Hi Simon,
Drop the STATUS_LED options and enable LED and LED_BOOT instead, since this is the new way to access the LED functionality.
Should this be two commits? The subject reads as pinephone is part of another device.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Add a patch to enable LED and LED_BOOT for these boards
configs/mx23_olinuxino_defconfig | 10 ++-------- configs/pinephone_defconfig | 7 ++----- 2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/configs/mx23_olinuxino_defconfig b/configs/mx23_olinuxino_defconfig index 3016f750e64..c1319077891 100644 --- a/configs/mx23_olinuxino_defconfig +++ b/configs/mx23_olinuxino_defconfig @@ -39,14 +39,8 @@ CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y CONFIG_MXS_GPIO=y -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS_GPIO=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=778 -CONFIG_LED_STATUS_STATE=2 -CONFIG_LED_STATUS_BOOT_ENABLE=y -CONFIG_LED_STATUS_BOOT=0 -CONFIG_LED_STATUS_CMD=y +CONFIG_LED=y +CONFIG_LED_BOOT=y CONFIG_MMC_MXS=y CONFIG_CONS_INDEX=0 CONFIG_DM_SERIAL=y diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig index 9d39204a439..272fce1c1a4 100644 --- a/configs/pinephone_defconfig +++ b/configs/pinephone_defconfig @@ -11,8 +11,5 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_PINEPHONE_DT_SELECTION=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2" -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS_GPIO=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=114 -CONFIG_LED_STATUS_STATE=2 +CONFIG_LED=y
+CONFIG_LED_BOOT=y
2.43.0

Drop the STATUS_LED options and enable LED and LED_BOOT instead, since this is the new way to access the LED functionality.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Add a patch to enable LED and LED_BOOT for these boards
configs/socfpga_vining_fpga_defconfig | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig index 094e9186fca..94018752b40 100644 --- a/configs/socfpga_vining_fpga_defconfig +++ b/configs/socfpga_vining_fpga_defconfig @@ -77,17 +77,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_BOOT=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y CONFIG_SYS_I2C_EEPROM_ADDR=0x50

This is not used by any board and there is a driver model version of LEDs. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
cmd/legacy_led.c | 40 ---------------------------------------- drivers/led/Kconfig | 6 ------ include/status_led.h | 13 +------------ 3 files changed, 1 insertion(+), 58 deletions(-)
diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 50de7e89d8f..ef2135e0dba 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -24,26 +24,6 @@ struct led_tbl_s { typedef struct led_tbl_s led_tbl_t;
static const led_tbl_t led_commands[] = { -#ifdef CONFIG_LED_STATUS_BOARD_SPECIFIC -#ifdef CONFIG_LED_STATUS0 - { "0", CONFIG_LED_STATUS_BIT, NULL, NULL, NULL }, -#endif -#ifdef CONFIG_LED_STATUS1 - { "1", CONFIG_LED_STATUS_BIT1, NULL, NULL, NULL }, -#endif -#ifdef CONFIG_LED_STATUS2 - { "2", CONFIG_LED_STATUS_BIT2, NULL, NULL, NULL }, -#endif -#ifdef CONFIG_LED_STATUS3 - { "3", CONFIG_LED_STATUS_BIT3, NULL, NULL, NULL }, -#endif -#ifdef CONFIG_LED_STATUS4 - { "4", CONFIG_LED_STATUS_BIT4, NULL, NULL, NULL }, -#endif -#ifdef CONFIG_LED_STATUS5 - { "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 @@ -148,26 +128,6 @@ int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) U_BOOT_CMD( led, 4, 1, do_legacy_led, "[" -#ifdef CONFIG_LED_STATUS_BOARD_SPECIFIC -#ifdef CONFIG_LED_STATUS0 - "0|" -#endif -#ifdef CONFIG_LED_STATUS1 - "1|" -#endif -#ifdef CONFIG_LED_STATUS2 - "2|" -#endif -#ifdef CONFIG_LED_STATUS3 - "3|" -#endif -#ifdef CONFIG_LED_STATUS4 - "4|" -#endif -#ifdef CONFIG_LED_STATUS5 - "5|" -#endif -#endif #ifdef CONFIG_LED_STATUS_GREEN "green|" #endif diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index c98cbf92fab..268118a6c3a 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -166,12 +166,6 @@ config LED_STATUS_GPIO The status LED can be connected to a GPIO pin. In such cases, the gpio_led driver can be used as a status LED backend implementation.
-config LED_STATUS_BOARD_SPECIFIC - bool "Specific board" - default y - help - LED support is only for a specific board. - comment "LEDs parameters"
config LED_STATUS0 diff --git a/include/status_led.h b/include/status_led.h index 1282022253e..59cf9f89956 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -61,23 +61,12 @@ static inline void status_led_boot_blink(void) * ADVICE: Define in your board configuration file rather than * filling this file up with lots of custom board stuff. */ - -#elif defined(CONFIG_LED_STATUS_BOARD_SPECIFIC) -/* led_id_t is unsigned long mask */ -typedef unsigned long led_id_t; - -extern void __led_toggle (led_id_t mask); -extern void __led_init (led_id_t mask, int state); -extern void __led_set (led_id_t mask, int state); -void __led_blink(led_id_t mask, int freq); #else # error Status LED configuration missing #endif /************************************************************************/
-#ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC -# include <asm/status_led.h> -#endif +#include <asm/status_led.h>
#else

This has been replaced with a new LED framework, so drop this old code.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/lib/crt0.S | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 3e4906e273d..a691d844847 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -185,10 +185,6 @@ here: movne r9, r0 # endif
-#if ! defined(CONFIG_XPL_BUILD) - bl coloured_LED_init - 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 */

This has been replaced with a new LED framework, so drop this old code and documentation.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
common/board_f.c | 22 -------------- doc/README.LED | 77 ------------------------------------------------ 2 files changed, 99 deletions(-) delete mode 100644 doc/README.LED
diff --git a/common/board_f.c b/common/board_f.c index f1bd70fdd6c..ad77d8db2d5 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -36,7 +36,6 @@ #include <relocate.h> #include <serial.h> #include <spl.h> -#include <status_led.h> #include <sysreset.h> #include <timer.h> #include <trace.h> @@ -53,27 +52,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 coloured_LED_init(void) {} -__weak void red_led_on(void) {} -__weak void red_led_off(void) {} -__weak void green_led_on(void) {} -__weak void green_led_off(void) {} -__weak void yellow_led_on(void) {} -__weak void yellow_led_off(void) {} -__weak void blue_led_on(void) {} -__weak void blue_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/README.LED b/doc/README.LED deleted file mode 100644 index c21c9d53ec3..00000000000 --- a/doc/README.LED +++ /dev/null @@ -1,77 +0,0 @@ -Status LED -======================================== - -This README describes the status LED API. - -The API is defined by the include file include/status_led.h - -The first step is to enable CONFIG_LED_STATUS in menuconfig: -> Device Drivers > LED Support. - -If the LED support is only for specific board, enable -CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig. - -Status LEDS 0 to 5 are enabled by the following configurations at menuconfig: -CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5 - -The following should be configured for each of the enabled LEDs: -CONFIG_STATUS_LED_BIT<n> -CONFIG_STATUS_LED_STATE<n> -CONFIG_STATUS_LED_FREQ<n> -Where <n> is an integer 1 through 5 (empty for 0). - -CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED -is being acted on. As such, the value choose must be unique with with respect to -the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the -reponsiblity of the __led_* function. - -CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one -of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON. - -CONFIG_STATUS_LED_FREQ determines the LED blink frequency. -Values range from 2 to 10. - -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, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. - -General LED functions ---------------------- -The following functions should be defined: - -__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE. -One time start up code should be placed here. - -__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. - -coloured_LED_init -red_LED_on -red_LED_off -green_LED_on -green_LED_off -yellow_LED_on -yellow_LED_off -blue_LED_on -blue_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

This predates the LED framework, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/st/stm32f429-discovery/Makefile | 1 - board/st/stm32f429-discovery/led.c | 39 --------------------------- 2 files changed, 40 deletions(-) delete mode 100644 board/st/stm32f429-discovery/led.c
diff --git a/board/st/stm32f429-discovery/Makefile b/board/st/stm32f429-discovery/Makefile index 6b02c0fddec..233eafdad3d 100644 --- a/board/st/stm32f429-discovery/Makefile +++ b/board/st/stm32f429-discovery/Makefile @@ -7,4 +7,3 @@ # Kamil Lulko, kamil.lulko@gmail.com
obj-y := stm32f429-discovery.o -obj-y += led.o diff --git a/board/st/stm32f429-discovery/led.c b/board/st/stm32f429-discovery/led.c deleted file mode 100644 index 4b8038341b9..00000000000 --- a/board/st/stm32f429-discovery/led.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2015 - * Kamil Lulko, kamil.lulko@gmail.com - */ - -#include <status_led.h> -#include <asm-generic/gpio.h> - -#define RED_LED 110 -#define GREEN_LED 109 - -void coloured_LED_init(void) -{ - gpio_request(RED_LED, "red led"); - gpio_direction_output(RED_LED, 0); - gpio_request(GREEN_LED, "green led"); - gpio_direction_output(GREEN_LED, 0); -} - -void red_led_off(void) -{ - gpio_set_value(RED_LED, 0); -} - -void green_led_off(void) -{ - gpio_set_value(GREEN_LED, 0); -} - -void red_led_on(void) -{ - gpio_set_value(RED_LED, 1); -} - -void green_led_on(void) -{ - gpio_set_value(GREEN_LED, 1); -}

Use an if...endif construct to avoid needing to make everything depend on LED. Make SPL_LED depend on LED since that seems reasonable.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/led/Kconfig | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 268118a6c3a..789113a92b5 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -9,6 +9,8 @@ config LED can provide access to board-specific LEDs. Use of the device tree for configuration is encouraged.
+if LED + config LED_BOOT bool "Enable LED boot support" help @@ -35,7 +37,7 @@ config LED_ACTIVITY
config LED_BCM6328 bool "LED Support for BCM6328" - depends on LED && ARCH_BMIPS + depends on ARCH_BMIPS help This option enables support for LEDs connected to the BCM6328 LED HW controller accessed via MMIO registers. @@ -46,7 +48,7 @@ config LED_BCM6328
config LED_BCM6358 bool "LED Support for BCM6358" - depends on LED && ARCH_BMIPS + depends on ARCH_BMIPS help This option enables support for LEDs connected to the BCM6358 LED HW controller accessed via MMIO registers. @@ -54,28 +56,28 @@ config LED_BCM6358
config LED_BCM6753 bool "LED Support for BCM6753" - depends on LED && BCM6855 + depends on BCM6855 help This option enables support for LEDs connected to the BCM6753 HW has blinking and fading capabilities and up to 32 LEDs can be controlled.
config LED_BCM6858 bool "LED Support for BCM6858" - depends on LED && (BCM6856 || BCM6858 || BCM63158) + depends on BCM6856 || BCM6858 || BCM63158 help This option enables support for LEDs connected to the BCM6858 HW has blinking capabilities and up to 32 LEDs can be controlled.
config LED_CORTINA bool "LED Support for Cortina Access CAxxxx SoCs" - depends on LED && (CORTINA_PLATFORM) + depends on CORTINA_PLATFORM help This option enables support for LEDs connected to the Cortina Access CAxxxx SOCs.
config LED_LP5562 bool "LED Support for LP5562" - depends on LED && DM_I2C + depends on DM_I2C help This option enables support for LEDs connected to the TI LP5562 4 channel I2C LED controller. Driver fully supports blink on the @@ -83,14 +85,13 @@ config LED_LP5562
config LED_PWM bool "LED PWM" - depends on LED && DM_PWM + depends on DM_PWM help Enable support for LEDs connected to PWM. Linux compatible ofdata.
config LED_BLINK bool "Support hardware LED blinking" - depends on LED help Some drivers can support automatic blinking of LEDs with a given period, without needing timers or extra code to handle the timing. @@ -99,7 +100,6 @@ config LED_BLINK
config LED_SW_BLINK bool "Support software LED blinking" - depends on LED select CYCLIC help Turns on led blinking implemented in the software, useful when @@ -122,7 +122,7 @@ config SPL_LED
config LED_GPIO bool "LED support for GPIO-connected LEDs" - depends on LED && DM_GPIO + depends on DM_GPIO help Enable support for LEDs which are connected to GPIO lines. These GPIOs may be on the SoC or some other device which provides GPIOs. @@ -136,6 +136,8 @@ config SPL_LED_GPIO This option is an SPL-variant of the LED_GPIO option. See the help of LED_GPIO for details.
+endif # LED + config LED_STATUS bool "Enable status LED API" help

Drop all of these configs, which are now unused.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/led/Kconfig | 316 -------------------------------------------- 1 file changed, 316 deletions(-)
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 789113a92b5..379b3ce49a5 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -138,320 +138,4 @@ config SPL_LED_GPIO
endif # LED
-config LED_STATUS - bool "Enable status LED API" - help - Allows common u-boot commands to use a board's leds to - provide status for activities like booting and downloading files. - -if LED_STATUS - -# Hidden constants - -config LED_STATUS_OFF - int - default 0 - -config LED_STATUS_BLINKING - int - default 1 - -config LED_STATUS_ON - int - default 2 - -# Hidden constants end - -config LED_STATUS_GPIO - bool "GPIO status LED implementation" - help - The status LED can be connected to a GPIO pin. In such cases, the - gpio_led driver can be used as a status LED backend implementation. - -comment "LEDs parameters" - -config LED_STATUS0 - bool "Enable status LED 0" - -if LED_STATUS0 - -config LED_STATUS_BIT - int "identification" - help - CONFIG_LED_STATUS_BIT is passed into the __led_* functions to identify - which LED is being acted on. As such, the chosen value must be unique - with respect to the other CONFIG_LED_STATUS_BIT's. Mapping the value - to a physical LED is the responsibility of the __led_* function. - -config LED_STATUS_STATE - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ: - LED_STATUS_PERIOD = CONFIG_SYS_HZ/LED_STATUS_FREQ - Values range: 2 - 10 - -endif # LED_STATUS0 - -config LED_STATUS1 - bool "Enable status LED 1" - -if LED_STATUS1 - -config LED_STATUS_BIT1 - int "identification" - help - CONFIG_LED_STATUS_BIT1 is passed into the __led_* functions to - identify which LED is being acted on. As such, the chosen value must - be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping - the value to a physical LED is the responsibility of the __led_* - function. - -config LED_STATUS_STATE1 - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ1 - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ1: - LED_STATUS_PERIOD1 = CONFIG_SYS_HZ/LED_STATUS_FREQ1 - Values range: 2 - 10 - -endif # LED_STATUS1 - -config LED_STATUS2 - bool "Enable status LED 2" - -if LED_STATUS2 - -config LED_STATUS_BIT2 - int "identification" - help - CONFIG_LED_STATUS_BIT2 is passed into the __led_* functions to - identify which LED is being acted on. As such, the chosen value must - be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping - the value to a physical LED is the responsibility of the __led_* - function. - -config LED_STATUS_STATE2 - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ2 - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ2: - LED_STATUS_PERIOD2 = CONFIG_SYS_HZ/LED_STATUS_FREQ2 - Values range: 2 - 10 - -endif # LED_STATUS2 - -config LED_STATUS3 - bool "Enable status LED 3" - -if LED_STATUS3 - -config LED_STATUS_BIT3 - int "identification" - help - CONFIG_LED_STATUS_BIT3 is passed into the __led_* functions to - identify which LED is being acted on. As such, the chosen value must - be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping - the value to a physical LED is the responsibility of the __led_* - function. - -config LED_STATUS_STATE3 - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ3 - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ3: - LED_STATUS_PERIOD3 = CONFIG_SYS_HZ/LED_STATUS_FREQ3 - Values range: 2 - 10 - -endif # LED_STATUS3 - -config LED_STATUS4 - bool "Enable status LED 4" - -if LED_STATUS4 - -config LED_STATUS_BIT4 - int "identification" - help - CONFIG_LED_STATUS_BIT4 is passed into the __led_* functions to - identify which LED is being acted on. As such, the chosen value must - be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping - the value to a physical LED is the responsibility of the __led_* - function. - -config LED_STATUS_STATE4 - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ4 - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ4: - LED_STATUS_PERIOD4 = CONFIG_SYS_HZ/LED_STATUS_FREQ4 - Values range: 2 - 10 - -endif # LED_STATUS4 - -config LED_STATUS5 - bool "Enable status LED 5" - -if LED_STATUS5 - -config LED_STATUS_BIT5 - int "identification" - help - CONFIG_LED_STATUS_BIT5 is passed into the __led_* functions to - identify which LED is being acted on. As such, the chosen value must - be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping - the value to a physical LED is the responsibility of the __led_* - function. - -config LED_STATUS_STATE5 - int "initial state" - range LED_STATUS_OFF LED_STATUS_ON - default LED_STATUS_OFF - help - Should be set one of the following: - 0 - off - 1 - blinking - 2 - on - -config LED_STATUS_FREQ5 - int "blink frequency" - range 2 10 - default 2 - help - The LED blink period calculated from LED_STATUS_FREQ5: - LED_STATUS_PERIOD5 = CONFIG_SYS_HZ/LED_STATUS_FREQ5 - Values range: 2 - 10 - -endif # LED_STATUS5 - -config LED_STATUS_BOOT_ENABLE - bool "Enable BOOT LED" - help - Enable to turn an LED on when the board is booting. - -if LED_STATUS_BOOT_ENABLE - -config LED_STATUS_BOOT - int "LED to light when the board is booting" - help - Valid enabled LED device number. - -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_YELLOW_ENABLE - bool "Enable yellow LED" - help - Enable yellow status LED. - -if LED_STATUS_YELLOW_ENABLE - -config LED_STATUS_YELLOW - int "Yellow LED identification" - help - Valid enabled LED device number. - -endif # LED_STATUS_YELLOW_ENABLE - -config LED_STATUS_BLUE_ENABLE - bool "Enable blue LED" - help - Enable blue status LED. - -if LED_STATUS_BLUE_ENABLE - -config LED_STATUS_BLUE - int "Blue LED identification" - help - Valid enabled LED device number. - -endif # LED_STATUS_BLUE_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" - -endif # LED_STATUS - endmenu

This is not used by any board. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
cmd/Makefile | 1 - cmd/legacy_led.c | 145 ----------------------------------------------- 2 files changed, 146 deletions(-) delete mode 100644 cmd/legacy_led.c
diff --git a/cmd/Makefile b/cmd/Makefile index 3c5bd56e912..b7574356b6e 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -102,7 +102,6 @@ obj-$(CONFIG_CMD_IRQ) += irq.o obj-$(CONFIG_CMD_ITEST) += itest.o obj-$(CONFIG_CMD_JFFS2) += jffs2.o obj-$(CONFIG_CMD_CRAMFS) += cramfs.o -obj-$(CONFIG_LED_STATUS_CMD) += legacy_led.o obj-$(CONFIG_CMD_LED) += led.o obj-$(CONFIG_CMD_LICENSE) += license.o obj-y += load.o diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c deleted file mode 100644 index ef2135e0dba..00000000000 --- a/cmd/legacy_led.c +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2010 - * Jason Kridner jkridner@beagleboard.org - * - * Based on cmd_led.c patch from: - * http://www.mail-archive.com/u-boot@lists.denx.de/msg06873.html - * (C) Copyright 2008 - * Ulf Samuelsson ulf.samuelsson@atmel.com - */ - -#include <command.h> -#include <status_led.h> -#include <vsprintf.h> - -struct led_tbl_s { - char *string; /* String for use in the command */ - led_id_t mask; /* Mask used for calling __led_set() */ - void (*off)(void); /* Optional function for turning LED off */ - void (*on)(void); /* Optional function for turning LED on */ - void (*toggle)(void);/* Optional function for toggling LED */ -}; - -typedef struct led_tbl_s led_tbl_t; - -static const led_tbl_t led_commands[] = { -#ifdef CONFIG_LED_STATUS_GREEN - { "green", CONFIG_LED_STATUS_GREEN, green_led_off, green_led_on, NULL }, -#endif -#ifdef CONFIG_LED_STATUS_YELLOW - { "yellow", CONFIG_LED_STATUS_YELLOW, yellow_led_off, yellow_led_on, - NULL }, -#endif -#ifdef CONFIG_LED_STATUS_RED - { "red", CONFIG_LED_STATUS_RED, red_led_off, red_led_on, NULL }, -#endif -#ifdef CONFIG_LED_STATUS_BLUE - { "blue", CONFIG_LED_STATUS_BLUE, blue_led_off, blue_led_on, NULL }, -#endif - { NULL, 0, NULL, NULL, NULL } -}; - -enum led_cmd { LED_ON, LED_OFF, LED_TOGGLE, LED_BLINK }; - -enum led_cmd get_led_cmd(char *var) -{ - if (strcmp(var, "off") == 0) - return LED_OFF; - if (strcmp(var, "on") == 0) - return LED_ON; - if (strcmp(var, "toggle") == 0) - return LED_TOGGLE; - if (strcmp(var, "blink") == 0) - return LED_BLINK; - - return -1; -} - -/* - * LED drivers providing a blinking LED functionality, like the - * PCA9551, can override this empty weak function - */ -void __weak __led_blink(led_id_t mask, int freq) -{ -} - -int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - int i, match = 0; - enum led_cmd cmd; - int freq; - - /* Validate arguments */ - if ((argc < 3) || (argc > 4)) - return CMD_RET_USAGE; - - cmd = get_led_cmd(argv[2]); - if (cmd < 0) { - return CMD_RET_USAGE; - } - - for (i = 0; led_commands[i].string; i++) { - if ((strcmp("all", argv[1]) == 0) || - (strcmp(led_commands[i].string, argv[1]) == 0)) { - match = 1; - switch (cmd) { - case LED_ON: - if (led_commands[i].on) - led_commands[i].on(); - else - __led_set(led_commands[i].mask, - CONFIG_LED_STATUS_ON); - break; - case LED_OFF: - if (led_commands[i].off) - led_commands[i].off(); - else - __led_set(led_commands[i].mask, - CONFIG_LED_STATUS_OFF); - break; - case LED_TOGGLE: - if (led_commands[i].toggle) - led_commands[i].toggle(); - else - __led_toggle(led_commands[i].mask); - break; - case LED_BLINK: - if (argc != 4) - return CMD_RET_USAGE; - - freq = dectoul(argv[3], NULL); - __led_blink(led_commands[i].mask, freq); - } - /* Need to set only 1 led if led_name wasn't 'all' */ - if (strcmp("all", argv[1]) != 0) - break; - } - } - - /* If we ran out of matches, print Usage */ - if (!match) { - return CMD_RET_USAGE; - } - - return 0; -} - -U_BOOT_CMD( - led, 4, 1, do_legacy_led, - "[" -#ifdef CONFIG_LED_STATUS_GREEN - "green|" -#endif -#ifdef CONFIG_LED_STATUS_YELLOW - "yellow|" -#endif -#ifdef CONFIG_LED_STATUS_RED - "red|" -#endif -#ifdef CONFIG_LED_STATUS_BLUE - "blue|" -#endif - "all] [on|off|toggle|blink] [blink-freq in ms]", - "[led_name] [on|off|toggle|blink] sets or clears led(s)" -);

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/misc/Makefile | 1 - drivers/misc/gpio_led.c | 106 ---------------------------------------- 2 files changed, 107 deletions(-) delete mode 100644 drivers/misc/gpio_led.c
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index dac805e4cdd..b7332587faa 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -49,7 +49,6 @@ obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/ obj-$(CONFIG_IMX_ELE) += imx_ele/ obj-$(CONFIG_LED_STATUS) += status_led.o -obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o obj-$(CONFIG_$(PHASE_)LS2_SFP) += ls2_sfp.o obj-$(CONFIG_$(XPL_)MXC_OCOTP) += mxc_ocotp.o diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c deleted file mode 100644 index e63689967a7..00000000000 --- a/drivers/misc/gpio_led.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Status LED driver based on GPIO access conventions of Linux - * - * Copyright (C) 2010 Thomas Chou thomas@wytron.com.tw - * Licensed under the GPL-2 or later. - */ - -#include <status_led.h> -#include <asm/gpio.h> - -#ifndef CFG_GPIO_LED_INVERTED_TABLE -#define CFG_GPIO_LED_INVERTED_TABLE {} -#endif - -static led_id_t gpio_led_inv[] = CFG_GPIO_LED_INVERTED_TABLE; - -static int gpio_led_gpio_value(led_id_t mask, int state) -{ - int i, gpio_value = (state == CONFIG_LED_STATUS_ON); - - for (i = 0; i < ARRAY_SIZE(gpio_led_inv); i++) { - if (gpio_led_inv[i] == mask) - gpio_value = !gpio_value; - } - - return gpio_value; -} - -void __led_init(led_id_t mask, int state) -{ - int gpio_value; - - if (gpio_request(mask, "gpio_led") != 0) { - printf("%s: failed requesting GPIO%lu!\n", __func__, mask); - return; - } - - gpio_value = gpio_led_gpio_value(mask, state); - gpio_direction_output(mask, gpio_value); -} - -void __led_set(led_id_t mask, int state) -{ - int gpio_value = gpio_led_gpio_value(mask, state); - - gpio_set_value(mask, gpio_value); -} - -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 - -#ifdef CONFIG_LED_STATUS_YELLOW -void yellow_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_ON); -} - -void yellow_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_OFF); -} -#endif - -#ifdef CONFIG_LED_STATUS_BLUE -void blue_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_ON); -} - -void blue_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_OFF); -} -#endif - -#endif /* CONFIG_GPIO_LED_STUBS */

This driver is not used anymore. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/misc/Kconfig | 13 --- drivers/misc/Makefile | 1 - drivers/misc/pca9551_led.c | 170 ------------------------------------- 3 files changed, 184 deletions(-) delete mode 100644 drivers/misc/pca9551_led.c
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 6009d55f400..23eb509d974 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -446,19 +446,6 @@ config SPL_PWRSEQ device. When the device is started up, its power sequence can be initiated.
-config PCA9551_LED - bool "Enable PCA9551 LED driver" - help - Enable driver for PCA9551 LED controller. This controller - is connected via I2C. So I2C needs to be enabled. - -config PCA9551_I2C_ADDR - hex "I2C address of PCA9551 LED controller" - depends on PCA9551_LED - default 0x60 - help - The I2C address of the PCA9551 LED controller. - config STM32MP_FUSE bool "Enable STM32MP fuse wrapper providing the fuse API" depends on ARCH_STM32MP && MISC diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index b7332587faa..e8f48228084 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -57,7 +57,6 @@ obj-$(CONFIG_NPCM_OTP) += npcm_otp.o obj-$(CONFIG_NPCM_HOST) += npcm_host_intf.o obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o obj-$(CONFIG_P2SB) += p2sb-uclass.o -obj-$(CONFIG_PCA9551_LED) += pca9551_led.o obj-$(CONFIG_$(XPL_)PWRSEQ) += pwrseq-uclass.o ifdef CONFIG_QFW obj-y += qfw.o diff --git a/drivers/misc/pca9551_led.c b/drivers/misc/pca9551_led.c deleted file mode 100644 index 040d0d5cf48..00000000000 --- a/drivers/misc/pca9551_led.c +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2015 Stefan Roese sr@denx.de - */ - -#include <errno.h> -#include <i2c.h> -#include <status_led.h> - -#ifndef CONFIG_PCA9551_I2C_ADDR -#error "CONFIG_PCA9551_I2C_ADDR not defined!" -#endif - -#define PCA9551_REG_INPUT 0x00 /* Input register (read only) */ -#define PCA9551_REG_PSC0 0x01 /* Frequency prescaler 0 */ -#define PCA9551_REG_PWM0 0x02 /* PWM0 */ -#define PCA9551_REG_PSC1 0x03 /* Frequency prescaler 1 */ -#define PCA9551_REG_PWM1 0x04 /* PWM1 */ -#define PCA9551_REG_LS0 0x05 /* LED0 to LED3 selector */ -#define PCA9551_REG_LS1 0x06 /* LED4 to LED7 selector */ - -#define PCA9551_CTRL_AI (1 << 4) /* Auto-increment flag */ - -#define PCA9551_LED_STATE_ON 0x00 -#define PCA9551_LED_STATE_OFF 0x01 -#define PCA9551_LED_STATE_BLINK0 0x02 -#define PCA9551_LED_STATE_BLINK1 0x03 - -struct pca9551_blink_rate { - u8 psc; /* Frequency preescaler, see PCA9551_7.pdf p. 6 */ - u8 pwm; /* Pulse width modulation, see PCA9551_7.pdf p. 6 */ -}; - -static int freq_last = -1; -static int mask_last = -1; -static int idx_last = -1; -static int mode_last; - -static int pca9551_led_get_state(int led, int *state) -{ - unsigned int reg; - u8 shift, buf; - int ret; - - if (led < 0 || led > 7) { - return -EINVAL; - } else if (led < 4) { - reg = PCA9551_REG_LS0; - shift = led << 1; - } else { - reg = PCA9551_REG_LS1; - shift = (led - 4) << 1; - } - - ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1); - if (ret) - return ret; - - *state = (buf >> shift) & 0x03; - return 0; -} - -static int pca9551_led_set_state(int led, int state) -{ - unsigned int reg; - u8 shift, buf, mask; - int ret; - - if (led < 0 || led > 7) { - return -EINVAL; - } else if (led < 4) { - reg = PCA9551_REG_LS0; - shift = led << 1; - } else { - reg = PCA9551_REG_LS1; - shift = (led - 4) << 1; - } - mask = 0x03 << shift; - - ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1); - if (ret) - return ret; - - buf = (buf & ~mask) | ((state & 0x03) << shift); - - ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1); - if (ret) - return ret; - - return 0; -} - -static int pca9551_led_set_blink_rate(int idx, struct pca9551_blink_rate rate) -{ - unsigned int reg; - int ret; - - switch (idx) { - case 0: - reg = PCA9551_REG_PSC0; - break; - case 1: - reg = PCA9551_REG_PSC1; - break; - default: - return -EINVAL; - } - reg |= PCA9551_CTRL_AI; - - ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, (u8 *)&rate, 2); - if (ret) - return ret; - - return 0; -} - -/* - * Functions referenced by cmd_led.c or status_led.c - */ -void __led_init(led_id_t id, int state) -{ -} - -void __led_set(led_id_t mask, int state) -{ - if (state == CONFIG_LED_STATUS_OFF) - pca9551_led_set_state(mask, PCA9551_LED_STATE_OFF); - else - pca9551_led_set_state(mask, PCA9551_LED_STATE_ON); -} - -void __led_toggle(led_id_t mask) -{ - int state = 0; - - pca9551_led_get_state(mask, &state); - pca9551_led_set_state(mask, !state); -} - -void __led_blink(led_id_t mask, int freq) -{ - struct pca9551_blink_rate rate; - int mode; - int idx; - - if ((freq == freq_last) || (mask == mask_last)) { - idx = idx_last; - mode = mode_last; - } else { - /* Toggle blink index */ - if (idx_last == 0) { - idx = 1; - mode = PCA9551_LED_STATE_BLINK1; - } else { - idx = 0; - mode = PCA9551_LED_STATE_BLINK0; - } - - idx_last = idx; - mode_last = mode; - } - freq_last = freq; - mask_last = mask; - - rate.psc = ((freq * 38) / 1000) - 1; - rate.pwm = 128; /* 50% duty cycle */ - - pca9551_led_set_blink_rate(idx, rate); - pca9551_led_set_state(mask, mode); -}

This driver is not used anymore. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/misc/Makefile | 1 - drivers/misc/status_led.c | 124 -------------------------------------- 2 files changed, 125 deletions(-) delete mode 100644 drivers/misc/status_led.c
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index e8f48228084..e975559fd75 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -48,7 +48,6 @@ obj-$(CONFIG_$(XPL_)I2C_EEPROM) += i2c_eeprom.o obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/ obj-$(CONFIG_IMX_ELE) += imx_ele/ -obj-$(CONFIG_LED_STATUS) += status_led.o obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o obj-$(CONFIG_$(PHASE_)LS2_SFP) += ls2_sfp.o obj-$(CONFIG_$(XPL_)MXC_OCOTP) += mxc_ocotp.o diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c deleted file mode 100644 index 3b1baa4f840..00000000000 --- a/drivers/misc/status_led.c +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2000-2003 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - */ - -#include <status_led.h> -#include <linux/types.h> - -/* - * The purpose of this code is to signal the operational status of a - * target which usually boots over the network; while running in - * U-Boot, a status LED is blinking. As soon as a valid BOOTP reply - * message has been received, the LED is turned off. The Linux - * kernel, once it is running, will start blinking the LED again, - * with another frequency. - */ - -/* ------------------------------------------------------------------------- */ - -typedef struct { - led_id_t mask; - int state; - int period; - int cnt; -} led_dev_t; - -led_dev_t led_dev[] = { - { CONFIG_LED_STATUS_BIT, - CONFIG_LED_STATUS_STATE, - LED_STATUS_PERIOD, - 0, - }, -#if defined(CONFIG_LED_STATUS1) - { CONFIG_LED_STATUS_BIT1, - CONFIG_LED_STATUS_STATE1, - LED_STATUS_PERIOD1, - 0, - }, -#endif -#if defined(CONFIG_LED_STATUS2) - { CONFIG_LED_STATUS_BIT2, - CONFIG_LED_STATUS_STATE2, - LED_STATUS_PERIOD2, - 0, - }, -#endif -#if defined(CONFIG_LED_STATUS3) - { CONFIG_LED_STATUS_BIT3, - CONFIG_LED_STATUS_STATE3, - LED_STATUS_PERIOD3, - 0, - }, -#endif -#if defined(CONFIG_LED_STATUS4) - { CONFIG_LED_STATUS_BIT4, - CONFIG_LED_STATUS_STATE4, - LED_STATUS_PERIOD4, - 0, - }, -#endif -#if defined(CONFIG_LED_STATUS5) - { CONFIG_LED_STATUS_BIT5, - CONFIG_LED_STATUS_STATE5, - LED_STATUS_PERIOD5, - 0, - }, -#endif -}; - -#define MAX_LED_DEV (sizeof(led_dev)/sizeof(led_dev_t)) - -static int status_led_init_done = 0; - -void status_led_init(void) -{ - led_dev_t *ld; - int i; - - for (i = 0, ld = led_dev; i < MAX_LED_DEV; i++, ld++) - __led_init (ld->mask, ld->state); - status_led_init_done = 1; -} - -void status_led_tick(ulong timestamp) -{ - led_dev_t *ld; - int i; - - if (!status_led_init_done) - status_led_init(); - - for (i = 0, ld = led_dev; i < MAX_LED_DEV; i++, ld++) { - - if (ld->state != CONFIG_LED_STATUS_BLINKING) - continue; - - if (++ld->cnt >= ld->period) { - __led_toggle (ld->mask); - ld->cnt -= ld->period; - } - - } -} - -void status_led_set(int led, int state) -{ - led_dev_t *ld; - - if (led < 0 || led >= MAX_LED_DEV) - return; - - if (!status_led_init_done) - status_led_init(); - - ld = &led_dev[led]; - - ld->state = state; - if (state == CONFIG_LED_STATUS_BLINKING) { - ld->cnt = 0; /* always start with full period */ - state = CONFIG_LED_STATUS_ON; /* always start with LED _ON_ */ - } - __led_set (ld->mask, state); -}

This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/m68k/lib/bootm.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c index 3dcff8076e3..1fa112f8dbf 100644 --- a/arch/m68k/lib/bootm.c +++ b/arch/m68k/lib/bootm.c @@ -15,9 +15,6 @@ #include <bzlib.h> #include <watchdog.h> #include <asm/byteorder.h> -#ifdef CONFIG_SHOW_BOOT_PROGRESS -# include <status_led.h> -#endif
DECLARE_GLOBAL_DATA_PTR;

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/powerpc/lib/interrupts.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c index 46208ae4c71..a2e7101a9d1 100644 --- a/arch/powerpc/lib/interrupts.c +++ b/arch/powerpc/lib/interrupts.c @@ -11,9 +11,6 @@ #include <irq_func.h> #include <asm/processor.h> #include <watchdog.h> -#ifdef CONFIG_LED_STATUS -#include <status_led.h> -#endif #include <asm/ptrace.h>
#ifndef CONFIG_MPC83XX_TIMER @@ -83,9 +80,6 @@ void timer_interrupt(struct pt_regs *regs) schedule(); #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
-#ifdef CONFIG_LED_STATUS - status_led_tick(timestamp); -#endif /* CONFIG_LED_STATUS */ }
ulong get_timer (ulong base)

This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/isee/igep00x0/igep00x0.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index a35a7cd3b1f..35bb8c55806 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -8,7 +8,6 @@ #include <init.h> #include <malloc.h> #include <net.h> -#include <status_led.h> #include <dm.h> #include <ns16550.h> #include <twl4030.h>

Simon Glass sjg@chromium.org writes:
Hello Simon,
This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
I've already reviewed v1 but you didn't keep the tag.
Reviewed-by: Javier Martinez Canillas javierm@redhat.com

Hi Javier,
On Mon, 21 Oct 2024 at 14:53, Javier Martinez Canillas javierm@redhat.com wrote:
Simon Glass sjg@chromium.org writes:
Hello Simon,
This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
I've already reviewed v1 but you didn't keep the tag.
Reviewed-by: Javier Martinez Canillas javierm@redhat.com
Oh, sorry about that.
Regards, SImon
-- Best regards,
Javier Martinez Canillas Core Platforms Red Hat

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/sunxi/board.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 824c322a0dc..cff7b8eb247 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -49,7 +49,6 @@ #include <spl.h> #include <sy8106a.h> #include <asm/setup.h> -#include <status_led.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -550,11 +549,6 @@ void sunxi_board_init(void) { int power_failed = 0;
-#ifdef CONFIG_LED_STATUS - if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC)) - status_led_init(); -#endif - #ifdef CONFIG_SY8106A_POWER power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT); #endif

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
common/board_r.c | 27 --------------------------- 1 file changed, 27 deletions(-)
diff --git a/common/board_r.c b/common/board_r.c index e5f33f40643..70ffd3497ab 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -52,7 +52,6 @@ #include <pvblock.h> #include <scsi.h> #include <serial.h> -#include <status_led.h> #include <stdio_dev.h> #include <timer.h> #include <trace.h> @@ -461,29 +460,6 @@ static int initr_malloc_bootparams(void) } #endif
-static int initr_status_led(void) -{ - status_led_init(); - - return 0; -} - -static int initr_boot_led_blink(void) -{ - status_led_boot_blink(); - - led_boot_blink(); - - return 0; -} - -static int initr_boot_led_on(void) -{ - led_boot_on(); - - return 0; -} - #if defined(CONFIG_CMD_NET) static int initr_net(void) { @@ -737,8 +713,6 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) timer_init, /* initialize timer */ #endif - initr_status_led, - initr_boot_led_blink, /* PPC has a udelay(20) here dating from 2002. Why? */ #ifdef CONFIG_BOARD_LATE_INIT board_late_init, @@ -761,7 +735,6 @@ static init_fnc_t init_sequence_r[] = { #if defined(CFG_PRAM) initr_mem, #endif - initr_boot_led_on, run_main_loop, };

This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
boot/image.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/boot/image.c b/boot/image.c index abac254e026..7bed8ba4b1f 100644 --- a/boot/image.c +++ b/boot/image.c @@ -15,10 +15,6 @@ #include <malloc.h> #include <u-boot/crc.h>
-#ifdef CONFIG_SHOW_BOOT_PROGRESS -#include <status_led.h> -#endif - #if CONFIG_IS_ENABLED(FIT) || CONFIG_IS_ENABLED(OF_LIBFDT) #include <linux/libfdt.h> #include <fdt_support.h>

This header file is not used, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
cmd/ide.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/cmd/ide.c b/cmd/ide.c index 036489fda97..be3078ae88b 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -22,10 +22,6 @@ #include <ide.h> #include <ata.h>
-#ifdef CONFIG_LED_STATUS -# include <status_led.h> -#endif - /* Current I/O Device */ static int curr_device;

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/timer/mpc83xx_timer.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 9da74479aaa..aefc18898e9 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -9,7 +9,6 @@ #include <dm.h> #include <irq_func.h> #include <log.h> -#include <status_led.h> #include <sysinfo.h> #include <time.h> #include <timer.h> @@ -178,10 +177,6 @@ void timer_interrupt(struct pt_regs *regs) if (CFG_SYS_WATCHDOG_FREQ && (priv->timestamp % (CFG_SYS_WATCHDOG_FREQ)) == 0) schedule(); #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ - -#ifdef CONFIG_LED_STATUS - status_led_tick(priv->timestamp); -#endif /* CONFIG_LED_STATUS */ }
void wait_ticks(ulong ticks)

This is not used anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
net/bootp.c | 7 ------- net/net.c | 33 --------------------------------- 2 files changed, 40 deletions(-)
diff --git a/net/bootp.c b/net/bootp.c index afd5b48094a..42462afda3e 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -19,9 +19,6 @@ #include <linux/delay.h> #include <net/tftp.h> #include "bootp.h" -#ifdef CONFIG_LED_STATUS -#include <status_led.h> -#endif #ifdef CONFIG_BOOTP_RANDOM_DELAY #include "net_rand.h" #endif @@ -370,10 +367,6 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip, /* * Got a good BOOTP reply. Copy the data into our variables. */ -#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE) - status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_OFF); -#endif - store_net_params(bp); /* Store net parameters from reply */
/* Retrieve extended information (we must parse the vendor area) */ diff --git a/net/net.c b/net/net.c index f47e9fbe33a..fc869d8bd48 100644 --- a/net/net.c +++ b/net/net.c @@ -100,10 +100,6 @@ #include <net/pcap.h> #endif #include <net/udp.h> -#if defined(CONFIG_LED_STATUS) -#include <miiphy.h> -#include <status_led.h> -#endif #include <watchdog.h> #include <linux/compiler.h> #include <test/test.h> @@ -614,19 +610,6 @@ restart: break; }
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -#if defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN) && \ - defined(CONFIG_LED_STATUS) && \ - defined(CONFIG_LED_STATUS_RED) - /* - * Echo the inverted link state to the fault LED. - */ - if (miiphy_link(eth_get_dev()->name, CONFIG_SYS_FAULT_MII_ADDR)) - status_led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF); - else - status_led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON); -#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */ -#endif /* CONFIG_MII, ... */ #ifdef CONFIG_USB_KEYBOARD net_busy_flag = 1; #endif @@ -684,22 +667,6 @@ restart: ((get_timer(0) - time_start) > time_delta)) { thand_f *x;
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -#if defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN) && \ - defined(CONFIG_LED_STATUS) && \ - defined(CONFIG_LED_STATUS_RED) - /* - * Echo the inverted link state to the fault LED. - */ - if (miiphy_link(eth_get_dev()->name, - CONFIG_SYS_FAULT_MII_ADDR)) - status_led_set(CONFIG_LED_STATUS_RED, - CONFIG_LED_STATUS_OFF); - else - status_led_set(CONFIG_LED_STATUS_RED, - CONFIG_LED_STATUS_ON); -#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */ -#endif /* CONFIG_MII, ... */ debug_cond(DEBUG_INT_STATE, "--- net_loop timeout\n"); x = time_handler; time_handler = (thand_f *)0;

This is not needed anymore. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Enable LED on the 5 affected platforms - Reorder patches for bisectability
include/status_led.h | 104 ------------------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 include/status_led.h
diff --git a/include/status_led.h b/include/status_led.h deleted file mode 100644 index 59cf9f89956..00000000000 --- a/include/status_led.h +++ /dev/null @@ -1,104 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - */ - -/* - * The purpose of this code is to signal the operational status of a - * target which usually boots over the network; while running in - * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply - * message has been received, the LED is turned off. The Linux - * kernel, once it is running, will start blinking the LED again, - * with another frequency. - */ - -#ifndef _STATUS_LED_H_ -#define _STATUS_LED_H_ - -#ifdef CONFIG_LED_STATUS - -#define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ) -#ifdef CONFIG_LED_STATUS1 -#define LED_STATUS_PERIOD1 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ1) -#endif /* CONFIG_LED_STATUS1 */ -#ifdef CONFIG_LED_STATUS2 -#define LED_STATUS_PERIOD2 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ2) -#endif /* CONFIG_LED_STATUS2 */ -#ifdef CONFIG_LED_STATUS3 -#define LED_STATUS_PERIOD3 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ3) -#endif /* CONFIG_LED_STATUS3 */ -#ifdef CONFIG_LED_STATUS4 -#define LED_STATUS_PERIOD4 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ4) -#endif /* CONFIG_LED_STATUS4 */ -#ifdef CONFIG_LED_STATUS5 -#define LED_STATUS_PERIOD5 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ5) -#endif /* CONFIG_LED_STATUS5 */ - -void status_led_init(void); -void status_led_tick(unsigned long timestamp); -void status_led_set(int led, int state); - -static inline void status_led_boot_blink(void) -{ -#ifdef CONFIG_LED_STATUS_BOOT_ENABLE - status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING); -#endif -} - -/***** MVS v1 **********************************************************/ -#if (defined(CONFIG_MVS) && CONFIG_MVS < 2) -# define STATUS_LED_PAR im_ioport.iop_pdpar -# define STATUS_LED_DIR im_ioport.iop_pddir -# undef STATUS_LED_ODR -# define STATUS_LED_DAT im_ioport.iop_pddat - -# define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */ - -/***** Someone else defines these *************************************/ -#elif defined(STATUS_LED_PAR) - /* - * ADVICE: Define in your board configuration file rather than - * filling this file up with lots of custom board stuff. - */ -#else -# error Status LED configuration missing -#endif -/************************************************************************/ - -#include <asm/status_led.h> - -#else - -static inline void status_led_init(void) { } -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 coloured_LED_init(void); -void red_led_on(void); -void red_led_off(void); -void green_led_on(void); -void green_led_off(void); -void yellow_led_on(void); -void yellow_led_off(void); -void blue_led_on(void); -void blue_led_off(void); -#else - .extern LED_init - .extern red_led_on - .extern red_led_off - .extern yellow_led_on - .extern yellow_led_off - .extern green_led_on - .extern green_led_off - .extern blue_led_on - .extern blue_led_off -#endif - -#endif /* _STATUS_LED_H_ */

On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should: - Not introduce a failure to build - Just work on platforms with either OF_UPSTREAM or semi-recent device trees - Just start working on those platforms when they do move to OF_UPSTREAM.

On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Also when the migration was first bought up I had a quick look at how to do it for the pinephone and I came up empty handed. Now I've seen the patch for the pinephone and grep for LED_BOOT the only form of docs I find is in the Kconfig and include/led.h, they refer to things that aren't in-tree and the out of tree reference to dtschema/schemas/options/u-boot.yaml, the only in-tree u-boot.yaml is ./dts/upstream/Bindings/mtd/partitions/u-boot.yaml, that I find has no reference to boott leds at all.
I feel the reason there's been a recent move to add users of the obsolete method is because the docs for that actually existed and there's nothing for the new method. Maybe the first patch in the series should be to add some actually useful doc rahter than go from docs for the old method to nothing.

On Tue, 22 Oct 2024 at 09:48, Peter Robinson pbrobinson@gmail.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Also when the migration was first bought up I had a quick look at how to do it for the pinephone and I came up empty handed. Now I've seen the patch for the pinephone and grep for LED_BOOT the only form of docs I find is in the Kconfig and include/led.h, they refer to things that aren't in-tree and the out of tree reference to dtschema/schemas/options/u-boot.yaml, the only in-tree u-boot.yaml is ./dts/upstream/Bindings/mtd/partitions/u-boot.yaml, that I find has no reference to boott leds at all.
I feel the reason there's been a recent move to add users of the obsolete method is because the docs for that actually existed and there's nothing for the new method. Maybe the first patch in the series should be to add some actually useful doc rahter than go from docs for the old method to nothing.
So I've tried the patch on the pinephone and it doesn't work.
I suspect you need to at least enable a led driver like LED_GPIO but even when I do that, while I can make the led turn on/off manually, it doesn't come on in early boot like it does with the old code. There's definitely something else missing here.
Peter

Hi Peter,
On Thu, 24 Oct 2024 at 14:16, Peter Robinson pbrobinson@gmail.com wrote:
On Tue, 22 Oct 2024 at 09:48, Peter Robinson pbrobinson@gmail.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Also when the migration was first bought up I had a quick look at how to do it for the pinephone and I came up empty handed. Now I've seen the patch for the pinephone and grep for LED_BOOT the only form of docs I find is in the Kconfig and include/led.h, they refer to things that aren't in-tree and the out of tree reference to dtschema/schemas/options/u-boot.yaml, the only in-tree u-boot.yaml is ./dts/upstream/Bindings/mtd/partitions/u-boot.yaml, that I find has no reference to boott leds at all.
I feel the reason there's been a recent move to add users of the obsolete method is because the docs for that actually existed and there's nothing for the new method. Maybe the first patch in the series should be to add some actually useful doc rahter than go from docs for the old method to nothing.
So I've tried the patch on the pinephone and it doesn't work.
I suspect you need to at least enable a led driver like LED_GPIO but even when I do that, while I can make the led turn on/off manually, it doesn't come on in early boot like it does with the old code. There's definitely something else missing here.
It's good that you have one of these boards. Would you be able to debug it and send a patch?
Regards, Simon

On Thu, 24 Oct 2024 at 17:36, Simon Glass sjg@chromium.org wrote:
Hi Peter,
On Thu, 24 Oct 2024 at 14:16, Peter Robinson pbrobinson@gmail.com wrote:
On Tue, 22 Oct 2024 at 09:48, Peter Robinson pbrobinson@gmail.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Also when the migration was first bought up I had a quick look at how to do it for the pinephone and I came up empty handed. Now I've seen the patch for the pinephone and grep for LED_BOOT the only form of docs I find is in the Kconfig and include/led.h, they refer to things that aren't in-tree and the out of tree reference to dtschema/schemas/options/u-boot.yaml, the only in-tree u-boot.yaml is ./dts/upstream/Bindings/mtd/partitions/u-boot.yaml, that I find has no reference to boott leds at all.
I feel the reason there's been a recent move to add users of the obsolete method is because the docs for that actually existed and there's nothing for the new method. Maybe the first patch in the series should be to add some actually useful doc rahter than go from docs for the old method to nothing.
So I've tried the patch on the pinephone and it doesn't work.
I suspect you need to at least enable a led driver like LED_GPIO but even when I do that, while I can make the led turn on/off manually, it doesn't come on in early boot like it does with the old code. There's definitely something else missing here.
It's good that you have one of these boards. Would you be able to debug it and send a patch?
Well I spent some time this morning and never got any further other wise I probably would have. When I first tested this against the 2024.10 release I discovered the new boot led stuff has been only added in this cycle [1] yet you mention above the other code has been obsolete for 9 years, not sure how that's possible if there's been nothing to migrate to. Also looking at the patchset the docs are bbasically non existent! so without having to dig through the code to work out how to specify the led, like Is there DT requirements etc it's not something that I have many more cycles for ATM.
Peter
[1] https://lists.denx.de/pipermail/u-boot/2024-October/566459.html

Hi Tom,
On Mon, 21 Oct 2024 at 19:26, Tom Rini trini@konsulko.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Perhaps I didn't understand what you were saying. I thought you meant to enable LED and LED_BOOT on these 5 boards?
Regards, Simon

On Tue, Oct 22, 2024 at 02:15:34PM +0200, Simon Glass wrote:
Hi Tom,
On Mon, 21 Oct 2024 at 19:26, Tom Rini trini@konsulko.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Perhaps I didn't understand what you were saying. I thought you meant to enable LED and LED_BOOT on these 5 boards?
Ah, OK, I see the disconnects now, sorry. The first comment I saw was Marek's on patch #2. So yes, along with Peter's request instead of one commit to disable and another commit to enable, just do 5 commits to migrate from one to the other please, thanks.

Hi Tom,
On Tue, 22 Oct 2024 at 16:02, Tom Rini trini@konsulko.com wrote:
On Tue, Oct 22, 2024 at 02:15:34PM +0200, Simon Glass wrote:
Hi Tom,
On Mon, 21 Oct 2024 at 19:26, Tom Rini trini@konsulko.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Perhaps I didn't understand what you were saying. I thought you meant to enable LED and LED_BOOT on these 5 boards?
Ah, OK, I see the disconnects now, sorry. The first comment I saw was Marek's on patch #2. So yes, along with Peter's request instead of one commit to disable and another commit to enable, just do 5 commits to migrate from one to the other please, thanks.
In order to maintain bisectability I need to delete some code in each of those commits. But if that is OK, then yes, I believe this is possible.
Regards, Simon

On Tue, Oct 22, 2024 at 07:00:46PM +0200, Simon Glass wrote:
Hi Tom,
On Tue, 22 Oct 2024 at 16:02, Tom Rini trini@konsulko.com wrote:
On Tue, Oct 22, 2024 at 02:15:34PM +0200, Simon Glass wrote:
Hi Tom,
On Mon, 21 Oct 2024 at 19:26, Tom Rini trini@konsulko.com wrote:
On Mon, Oct 21, 2024 at 01:38:08PM +0200, Simon Glass wrote:
There has been an LED framework in U-Boot which uses driver model for about 9 years now. Recent work is underway to improve it and provide more features. It is probably a good time to drop the old code, which is only used by 5 boards:
./tools/qconfig.py -f LED_STATUS 5 matches eb_cpu5282 eb_cpu5282_internal mx23_olinuxino pinephone socfpga_vining_fpga
This series attempts that.
Changes in v2:
- Combine code-removal and defconfig changes
- Add a patch to enable LED and LED_BOOT for these boards
- Add a patch to enable LED and LED_BOOT for these boards
- Enable LED on the 5 affected platforms
- Reorder patches for bisectability
So I believe this means you missed the feedback of just doing the blind migration rather than disabling the feature, like we used to often do for cases where it's just a matter of changing CONFIG options. It should:
- Not introduce a failure to build
- Just work on platforms with either OF_UPSTREAM or semi-recent device trees
- Just start working on those platforms when they do move to OF_UPSTREAM.
Perhaps I didn't understand what you were saying. I thought you meant to enable LED and LED_BOOT on these 5 boards?
Ah, OK, I see the disconnects now, sorry. The first comment I saw was Marek's on patch #2. So yes, along with Peter's request instead of one commit to disable and another commit to enable, just do 5 commits to migrate from one to the other please, thanks.
In order to maintain bisectability I need to delete some code in each of those commits. But if that is OK, then yes, I believe this is possible.
Yes, thanks.
participants (5)
-
Javier Martinez Canillas
-
Marek Vasut
-
Peter Robinson
-
Simon Glass
-
Tom Rini