diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index e979ee4a2cc..a60ebe1d964 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -1232,6 +1232,24 @@ config CHIP_DIP_SCAN select W1_EEPROM_DS24XXX select CMD_EXTENSION +config SPL_SUNXI_LED_STATUS + bool "Control GPIO status LED within SPL" + depends on SPL_GPIO && SUNXI_GPIO + +if SPL_SUNXI_LED_STATUS + +config SPL_SUNXI_LED_STATUS_BIT + int "GPIO number for GPIO status LED" + help + GPIO number for the GPIO controlling the GPIO status LED in SPL. + +config SPL_SUNXI_LED_STATUS_STATE + bool "GPIO status LED initial state is on" + help + Whether the initial state of the status LED in SPL must be on or off. + +endif # SPL_SUNXI_LED_STATUS + source "board/sunxi/Kconfig" endif diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 954a8715075..d7722d1858a 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -50,7 +50,6 @@ #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -561,14 +560,23 @@ static void sunxi_spl_store_dram_size(phys_addr_t dram_size) spl->dram_size = dram_size >> 20; } +static void status_led_init(void) +{ +#if CONFIG_IS_ENABLED(SUNXI_LED_STATUS) + unsigned int state = CONFIG_SPL_SUNXI_LED_STATUS_STATE; + unsigned int gpio = CONFIG_SPL_SUNXI_LED_STATUS_BIT; + + gpio_request(gpio, "gpio_led"); + gpio_direction_output(gpio, state); +#endif +} + void sunxi_board_init(void) { int power_failed = 0; -#ifdef CONFIG_LED_STATUS - if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC)) + if (CONFIG_IS_ENABLED(SUNXI_LED_STATUS)) status_led_init(); -#endif #ifdef CONFIG_SY8106A_POWER power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT); diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig index 8a9916c7978..ed7dbc1852b 100644 --- a/configs/pinephone_defconfig +++ b/configs/pinephone_defconfig @@ -2,20 +2,17 @@ CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone-1.2" CONFIG_DRAM_CLK=552 -CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_MACH_SUN50I=y CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y CONFIG_DRAM_ZQ=3881949 CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_PINEPHONE_DT_SELECTION=y +CONFIG_SPL_SUNXI_LED_STATUS=y +CONFIG_SPL_SUNXI_LED_STATUS_BIT=114 +CONFIG_SPL_SUNXI_LED_STATUS_STATE=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_CMD_PSTORE=y CONFIG_CMD_PSTORE_MEM_ADDR=0x61000000 CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2" CONFIG_SYS_I2C_MVTWSI=y -CONFIG_LED_STATUS=y -CONFIG_LED_STATUS_GPIO=y -CONFIG_LED_STATUS0=y -CONFIG_LED_STATUS_BIT=114 -CONFIG_LED_STATUS_STATE=2