[PATCH 20/20] Enable led on boot to notify user of boot status
André Przywara
andre.przywara at arm.com
Thu Feb 25 16:15:28 CET 2021
On 20/02/2021 12:14, Nicolas Boulenguez wrote:
> From: Marius Gripsgard <marius at ubports.com>
Hi,
This is not really Pinephone specific, actually not even sunxi specific.
I see two better ways of solving this:
- We introduce some generic code to find "gpio-leds" subnodes in the DT,
which have a default-state = "on" property. This could be either added
to drivers/led/led_gpio.c, or in some higher level.
- We introduce a generic boot LED GPIO config symbol. Maybe there is
already something, that sounds like a generally useful feature? That
would have the advantage of being already enabled in the SPL (admittedly
a sunxi specific problem).
Any opinions?
Cheers,
Andre
> ---
> arch/arm/mach-sunxi/Kconfig | 5 +++++
> board/sunxi/board.c | 4 ++--
> configs/pinephone_defconfig | 1 +
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> index 8421f3b685..2bfdf7738b 100644
> --- a/arch/arm/mach-sunxi/Kconfig
> +++ b/arch/arm/mach-sunxi/Kconfig
> @@ -1,5 +1,10 @@
> if ARCH_SUNXI
>
> +config PINEPHONE_LEDS
> + bool "Notify boot status via LEDs on PinePhone"
> + ---help---
> + LED boot notification.
> +
> config SPL_LDSCRIPT
> default "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" if !ARM64
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index abd7e390b2..a117b89ba2 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -637,6 +638,12 @@ void sunxi_board_init(void)
> {
> int power_failed = 0;
>
> +#ifdef CONFIG_PINEPHONE_LEDS
> + /* PD18:G PD19:R PD20:B */
> + gpio_request(SUNXI_GPD(18), "led:green");
> + gpio_direction_output(SUNXI_GPD(18), 1);
> +#endif
> +
> #ifdef CONFIG_SY8106A_POWER
> power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT);
> #endif
> diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig
> index ff5da42ce0..9de6ab2316 100644
> --- a/configs/pinephone_defconfig
> +++ b/configs/pinephone_defconfig
> @@ -1,6 +21,7 @@
> CONFIG_ARM=y
> CONFIG_ARCH_SUNXI=y
> CONFIG_SPL=y
> +CONFIG_PINEPHONE_LEDS=y
> CONFIG_MACH_SUN50I=y
> CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
> CONFIG_DRAM_CLK=552
>
More information about the U-Boot
mailing list