[PATCH v2] Cubieboard2:SUN7I:Add LED BOOT support

Javad Rahimi javad321javad at gmail.com
Wed Dec 8 16:49:55 CET 2021


On Wed, Dec 8, 2021 at 6:05 PM Andre Przywara <andre.przywara at arm.com> wrote:
>
> On Wed, 8 Dec 2021 15:25:54 +0100
> Frank Wunderlich <frank-w at public-files.de> wrote:
>
> Hi,
>
> > you should add maintainer email for your patch
> >
> > $ scripts/get_maintainer.pl board/sunxi/board.c
> > Jagan Teki <jagan at amarulasolutions.com> (maintainer:ARM SUNXI)
> > Andre Przywara <andre.przywara at arm.com> (maintainer:ARM SUNXI)
> > u-boot at lists.denx.de (open list)
>
> Thanks Frank!
>
Hi Andre,
Thanks for your comments. I studied the pinephone_defconfig.
By default, when activating the same options on Cubieboard2_defconfig
it shows linker error for `__led_init` and `__led_set`.
In other words, they are not defined. So, in this patch, I added the
implementation for these functions for this board.

Regards,
Javad
> > > Gesendet: Mittwoch, 08. Dezember 2021 um 15:22 Uhr
> > > Von: "Javad Rahimi" <javad321javad at gmail.com>
> > > An: u-boot at lists.denx.de
> > > Cc: "Javad Rahimi" <javad321javad at gmail.com>
> > > Betreff: [PATCH v2] Cubieboard2:SUN7I:Add LED BOOT support
> > >
> > > This feature makes it possible to assign one of
> > > LED1(PH20) and LED2(PH21) to BOOT process LED.
> > > User should activates the "Enable status LED API" in
> > > "Device Drivers -> LED Support"
>
> Please have a look at the current pinephone_defconfig, because that uses
> the boot LED already in a much easier fashion:
> https://source.denx.de/u-boot/u-boot/-/commit/0534153fd1
>
> Cheers,
> Andre
>
> > >
> > > Signed-off-by: Javad Rahimi <javad321javad at gmail.com>
> > > ---
> > > This is my first contributation in open source world.
> > > I'm sorry if I have mistakes in my commits and versioning.
> > > I do my best to learn fast.
> > >
> > > Changes in v2:
> > > - Missed braces added
> > > - Unnecessary debug removed
> > > - Some typo fixed
> > >
> > >  board/sunxi/board.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 49 insertions(+)
> > >
> > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> > > index 4f5747c34a..5e2f6ae902 100644
> > > --- a/board/sunxi/board.c
> > > +++ b/board/sunxi/board.c
> > > @@ -1002,3 +1002,52 @@ int board_fit_config_name_match(const char *name)
> > >     return ret;
> > >  }
> > >  #endif
> > > +
> > > +#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT) && defined(CONFIG_LED_STATUS_BOARD_SPECIFIC)
> > > +
> > > +#define CUBIE2_LED_BOOT_GPIO  "PH20"
> > > +static int gpio_boot_led;
> > > +
> > > +void __led_init(led_id_t mask, int state)
> > > +{
> > > +   int ret;
> > > +
> > > +   if (mask != CONFIG_LED_STATUS_BOOT)
> > > +           return;
> > > +
> > > +   ret = gpio_lookup_name(CUBIE2_LED_BOOT_GPIO, NULL, NULL, &gpio_boot_led);
> > > +
> > > +   if (ret)
> > > +           return;
> > > +
> > > +   ret = gpio_request(gpio_boot_led, "boot_led");
> > > +   if (ret == -1) {
> > > +           debug("[gpio_request] Error:%d\n", ret);
> > > +           return;
> > > +   }
> > > +
> > > +   ret = gpio_direction_output(gpio_boot_led, 1);
> > > +   if (ret == -1) {
> > > +           debug("[gpio_direction_output] Error:%d\n", ret);
> > > +           return;
> > > +   }
> > > +   __led_set(mask, state);
> > > +}
> > > +
> > > +void __led_set(led_id_t mask, int state)
> > > +{
> > > +   if (mask != CONFIG_LED_STATUS_BOOT)
> > > +           return;
> > > +
> > > +   gpio_set_value(gpio_boot_led, state);
> > > +}
> > > +
> > > +void __led_toggle(led_id_t mask)
> > > +{
> > > +   if (mask != CONFIG_LED_STATUS_BOOT)
> > > +           return;
> > > +
> > > +   gpio_set_value(gpio_boot_led, !gpio_get_value(gpio_boot_led));
> > > +}
> > > +
> > > +#endif
> > > --
> > > 2.25.1
> > >
> > >
>


More information about the U-Boot mailing list