mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
status_led: Kconfig migration
Move all of the status LED feature to drivers/led/Kconfig. The LED status definitions were moved from the board configuration files to the defconfig files. TBD: Move all of the definitions in the include/status_led.h to the relevant board's defconfig files. Tested boards: CL-SOM-AM57x, CM-T335 Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
This commit is contained in:
@@ -174,7 +174,7 @@ void __led_init(led_id_t mask, int state)
|
||||
|
||||
void __led_set(led_id_t mask, int state)
|
||||
{
|
||||
if (state == STATUS_LED_ON)
|
||||
if (state == CONFIG_LED_STATUS_ON)
|
||||
MCFGPTA_GPTPORT |= (1 << 3);
|
||||
else
|
||||
MCFGPTA_GPTPORT &= ~(1 << 3);
|
||||
|
||||
@@ -50,8 +50,8 @@ int misc_init_r(void)
|
||||
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
|
||||
#define STATUS_LED_OFF 0
|
||||
#define STATUS_LED_ON 1
|
||||
#define CONFIG_LED_STATUS_OFF 0
|
||||
#define CONFIG_LED_STATUS_ON 1
|
||||
|
||||
static int gpio_setup;
|
||||
|
||||
@@ -76,24 +76,30 @@ void show_boot_progress(int status)
|
||||
{
|
||||
switch (status) {
|
||||
case BOOTSTAGE_ID_CHECK_MAGIC:
|
||||
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
|
||||
stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_OFF,
|
||||
CONFIG_LED_STATUS_ON);
|
||||
break;
|
||||
case BOOTSTAGE_ID_CHECK_HEADER:
|
||||
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
|
||||
stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_ON,
|
||||
CONFIG_LED_STATUS_OFF);
|
||||
break;
|
||||
case BOOTSTAGE_ID_CHECK_CHECKSUM:
|
||||
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
|
||||
stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_ON,
|
||||
CONFIG_LED_STATUS_ON);
|
||||
break;
|
||||
case BOOTSTAGE_ID_CHECK_ARCH:
|
||||
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
|
||||
stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_OFF,
|
||||
CONFIG_LED_STATUS_OFF);
|
||||
break;
|
||||
case BOOTSTAGE_ID_CHECK_IMAGETYPE:
|
||||
case BOOTSTAGE_ID_DECOMP_IMAGE:
|
||||
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
|
||||
stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_OFF,
|
||||
CONFIG_LED_STATUS_ON);
|
||||
break;
|
||||
case BOOTSTAGE_ID_KERNEL_LOADED:
|
||||
case BOOTSTAGE_ID_CHECK_BOOT_OS:
|
||||
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
|
||||
stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_ON,
|
||||
CONFIG_LED_STATUS_OFF);
|
||||
break;
|
||||
case BOOTSTAGE_ID_BOOT_OS_RETURNED:
|
||||
case BOOTSTAGE_ID_RD_MAGIC:
|
||||
@@ -102,10 +108,12 @@ void show_boot_progress(int status)
|
||||
case BOOTSTAGE_ID_RAMDISK:
|
||||
case BOOTSTAGE_ID_NO_RAMDISK:
|
||||
case BOOTSTAGE_ID_RUN_OS:
|
||||
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
|
||||
stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_OFF,
|
||||
CONFIG_LED_STATUS_OFF);
|
||||
break;
|
||||
default:
|
||||
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
|
||||
stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_ON,
|
||||
CONFIG_LED_STATUS_ON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ int board_init(void)
|
||||
|
||||
gpmc_init();
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
|
||||
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
||||
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_OFF);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ int board_init(void)
|
||||
/* boot param addr */
|
||||
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
|
||||
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
||||
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_ON);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -89,8 +89,8 @@ int board_init(void)
|
||||
/* boot param addr */
|
||||
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
|
||||
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
||||
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_ON);
|
||||
#endif
|
||||
|
||||
cm_t3517_musb_init();
|
||||
|
||||
@@ -23,16 +23,16 @@ void __led_init(led_id_t mask, int state)
|
||||
void __led_toggle(led_id_t mask)
|
||||
{
|
||||
int toggle_gpio = 0;
|
||||
#ifdef STATUS_LED_BIT
|
||||
if (!toggle_gpio && STATUS_LED_BIT & mask)
|
||||
#ifdef CONFIG_LED_STATUS0
|
||||
if (!toggle_gpio && CONFIG_LED_STATUS_BIT & mask)
|
||||
toggle_gpio = TRICORDER_STATUS_LED_GREEN;
|
||||
#endif
|
||||
#ifdef STATUS_LED_BIT1
|
||||
if (!toggle_gpio && STATUS_LED_BIT1 & mask)
|
||||
#ifdef CONFIG_LED_STATUS1
|
||||
if (!toggle_gpio && CONFIG_LED_STATUS_BIT1 & mask)
|
||||
toggle_gpio = TRICORDER_STATUS_LED_YELLOW;
|
||||
#endif
|
||||
#ifdef STATUS_LED_BIT2
|
||||
if (!toggle_gpio && STATUS_LED_BIT2 & mask) {
|
||||
#ifdef CONFIG_LED_STATUS2
|
||||
if (!toggle_gpio && CONFIG_LED_STATUS_BIT2 & mask) {
|
||||
uint8_t val;
|
||||
twl4030_i2c_read_u8(TWL4030_CHIP_LED, TWL4030_LED_LEDEN,
|
||||
&val);
|
||||
@@ -51,23 +51,23 @@ void __led_toggle(led_id_t mask)
|
||||
|
||||
void __led_set(led_id_t mask, int state)
|
||||
{
|
||||
#ifdef STATUS_LED_BIT
|
||||
if (STATUS_LED_BIT & mask) {
|
||||
#ifdef CONFIG_LED_STATUS0
|
||||
if (CONFIG_LED_STATUS_BIT & mask) {
|
||||
gpio_request(TRICORDER_STATUS_LED_GREEN, "");
|
||||
gpio_direction_output(TRICORDER_STATUS_LED_GREEN, 0);
|
||||
gpio_set_value(TRICORDER_STATUS_LED_GREEN, state);
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_BIT1
|
||||
if (STATUS_LED_BIT1 & mask) {
|
||||
#ifdef CONFIG_LED_STATUS1
|
||||
if (CONFIG_LED_STATUS_BIT1 & mask) {
|
||||
gpio_request(TRICORDER_STATUS_LED_YELLOW, "");
|
||||
gpio_direction_output(TRICORDER_STATUS_LED_YELLOW, 0);
|
||||
gpio_set_value(TRICORDER_STATUS_LED_YELLOW, state);
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_BIT2
|
||||
if (STATUS_LED_BIT2 & mask) {
|
||||
if (STATUS_LED_OFF == state)
|
||||
#ifdef CONFIG_LED_STATUS2
|
||||
if (CONFIG_LED_STATUS_BIT2 & mask) {
|
||||
if (CONFIG_LED_STATUS_OFF == state)
|
||||
twl4030_i2c_write_u8(TWL4030_CHIP_LED,
|
||||
TWL4030_LED_LEDEN, 0);
|
||||
else
|
||||
|
||||
@@ -120,9 +120,9 @@ int misc_init_r(void)
|
||||
print_hwversion(&eeprom);
|
||||
|
||||
twl4030_power_init();
|
||||
status_led_set(0, STATUS_LED_ON);
|
||||
status_led_set(1, STATUS_LED_ON);
|
||||
status_led_set(2, STATUS_LED_ON);
|
||||
status_led_set(0, CONFIG_LED_STATUS_ON);
|
||||
status_led_set(1, CONFIG_LED_STATUS_ON);
|
||||
status_led_set(2, CONFIG_LED_STATUS_ON);
|
||||
|
||||
omap_die_id_display();
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ int board_init(void)
|
||||
/* boot param addr */
|
||||
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
|
||||
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
||||
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_ON);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include <miiphy.h>
|
||||
#include <libfdt.h>
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
#if defined(CONFIG_LED_STATUS)
|
||||
#include <status_led.h>
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
#endif /* CONFIG_LED_STATUS */
|
||||
|
||||
/* Kollmorgen DPR initialization data */
|
||||
struct init_elem {
|
||||
@@ -194,27 +194,46 @@ int ft_board_setup(void *blob, bd_t *bd)
|
||||
#endif /* CONFIG_OF_BOARD_SETUP */
|
||||
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
void __led_init(led_id_t regaddr, int state)
|
||||
#if defined(CONFIG_LED_STATUS)
|
||||
vu_long *regcode_to_regaddr(led_id_t regcode)
|
||||
{
|
||||
*((vu_long *) regaddr) |= ENABLE_GPIO_OUT;
|
||||
/* GPT Enable and Mode Select Register address */
|
||||
vu_long *reg_translate[] = {
|
||||
(vu_long *)MPC5XXX_GPT6_ENABLE,
|
||||
(vu_long *)MPC5XXX_GPT7_ENABLE,
|
||||
};
|
||||
|
||||
if (state == STATUS_LED_ON)
|
||||
if (ARRAY_SIZE(reg_translate) <= regcode)
|
||||
return NULL;
|
||||
return reg_translate[regcode];
|
||||
}
|
||||
|
||||
void __led_init(led_id_t regcode, int state)
|
||||
{
|
||||
vu_long *regaddr = regcode_to_regaddr(regcode);
|
||||
|
||||
*regaddr |= ENABLE_GPIO_OUT;
|
||||
|
||||
if (state == CONFIG_LED_STATUS_ON)
|
||||
*((vu_long *) regaddr) |= LED_ON;
|
||||
else
|
||||
*((vu_long *) regaddr) &= ~LED_ON;
|
||||
}
|
||||
|
||||
void __led_set(led_id_t regaddr, int state)
|
||||
void __led_set(led_id_t regcode, int state)
|
||||
{
|
||||
if (state == STATUS_LED_ON)
|
||||
*((vu_long *) regaddr) |= LED_ON;
|
||||
vu_long *regaddr = regcode_to_regaddr(regcode);
|
||||
|
||||
if (state == CONFIG_LED_STATUS_ON)
|
||||
*regaddr |= LED_ON;
|
||||
else
|
||||
*((vu_long *) regaddr) &= ~LED_ON;
|
||||
*regaddr &= ~LED_ON;
|
||||
}
|
||||
|
||||
void __led_toggle(led_id_t regaddr)
|
||||
void __led_toggle(led_id_t regcode)
|
||||
{
|
||||
*((vu_long *) regaddr) ^= LED_ON;
|
||||
vu_long *regaddr = regcode_to_regaddr(regcode);
|
||||
|
||||
*regaddr ^= LED_ON;
|
||||
}
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
#endif /* CONFIG_LED_STATUS */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#ifdef CONFIG_LED_STATUS
|
||||
#include <status_led.h>
|
||||
#endif
|
||||
|
||||
@@ -72,8 +72,8 @@ int board_init(void)
|
||||
/* Adress of boot parameters */
|
||||
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE);
|
||||
#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;
|
||||
|
||||
@@ -21,8 +21,8 @@ int board_late_init(void)
|
||||
const unsigned int usb_nrst_gpio = 35;
|
||||
int ret;
|
||||
|
||||
status_led_set(1, STATUS_LED_ON);
|
||||
status_led_set(2, STATUS_LED_ON);
|
||||
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 = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
#
|
||||
|
||||
obj-y := beagle.o
|
||||
obj-$(CONFIG_STATUS_LED) += led.o
|
||||
obj-$(CONFIG_LED_STATUS) += led.o
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <ns16550.h>
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#ifdef CONFIG_LED_STATUS
|
||||
#include <status_led.h>
|
||||
#endif
|
||||
#include <twl4030.h>
|
||||
@@ -96,8 +96,8 @@ int board_init(void)
|
||||
/* boot param addr */
|
||||
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
|
||||
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
||||
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_ON);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -15,26 +15,26 @@
|
||||
#define BEAGLE_LED_USR0 150
|
||||
#define BEAGLE_LED_USR1 149
|
||||
|
||||
#ifdef STATUS_LED_GREEN
|
||||
#ifdef CONFIG_LED_STATUS_GREEN
|
||||
void green_led_off(void)
|
||||
{
|
||||
__led_set (STATUS_LED_GREEN, 0);
|
||||
__led_set(CONFIG_LED_STATUS_GREEN, 0);
|
||||
}
|
||||
|
||||
void green_led_on(void)
|
||||
{
|
||||
__led_set (STATUS_LED_GREEN, 1);
|
||||
__led_set(CONFIG_LED_STATUS_GREEN, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int get_led_gpio(led_id_t mask)
|
||||
{
|
||||
#ifdef STATUS_LED_BIT
|
||||
if (STATUS_LED_BIT & mask)
|
||||
#ifdef CONFIG_LED_STATUS0
|
||||
if (CONFIG_LED_STATUS_BIT & mask)
|
||||
return BEAGLE_LED_USR0;
|
||||
#endif
|
||||
#ifdef STATUS_LED_BIT1
|
||||
if (STATUS_LED_BIT1 & mask)
|
||||
#ifdef CONFIG_LED_STATUS1
|
||||
if (CONFIG_LED_STATUS_BIT1 & mask)
|
||||
return BEAGLE_LED_USR1;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user