How to set LED state in the BBB U-Boot?

On a custom cape board I have a power button and two LEDs, one red and one blue, connected on P9_12 and P8_11, respectively. Following the instructions on how to build U-Boot here: https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Bootloader:U-Boot, was able to mux both LEDs in the BeagleBone Black configuration am335x_evm_defconfig by including additional initialisation in the U-Boot v2019.04 u-boot/board/ti/am335x/mux.c :

Enter code here...static struct module_pin_mux gpio1_28_pin_mux[] = {

{OFFSET(gpmc_be1n), (MODE(7) | PULLDOWN_EN)}, /* RED LED GPIO60 <= P9_12 /
{-1},
};
static struct module_pin_mux gpio1_13_pin_mux[] = {
{OFFSET(gpmc_ad13), (MODE(7) | PULLDOWN_EN)}, /
BLUE LED GPIO45 <= P8_11 */
{-1},
};

void enable_board_pin_mux(void)
{
configure_module_pin_mux(gpio1_28_pin_mux); /* LED RED ON ? */

configure_module_pin_mux(gpio1_13_pin_mux); /* LED BLUE ON ? */

/* Do board-specific muxes. /
if (board_is_beaglelogic()) {
/
BeagleLogic pinmux */
. . .

so on power on I can see a dimmed light on both LEDs. The question is how and where I can turn them on during the boot process or even let them blink? I am aware of the U-Boot LED driver and I tried to customise beagle led.c configuration with no luck. Is there an easy way to set the LEDs state high after the muxing, early during the U-Boot initialisation?

Any help is greatly appreciated!

Nikolay

Hi Nikolay,

Once you "jump" from u-boot to the kernel, anything u-boot set for i/o
will be reinitialized.. To keep the led in the same state as u-boot
early in the kernel initilaion.. take a look at 'gpio-hog'..

Here is a quick example of a pin pulled high as early as possible..

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-BBGW-WL1835-00A0.dts#L191-L201

If you look at a scope, it'll still "blip", but it's as fast of a
transition as possible..

Regards,

Upgrade your version of u-boot, i nuked the 2 second wait about a month ago.

Using the fdtoverlay utility, you can have u-boot load one *.dtb, thus
bypassing the overlay loading loop..

For example: am335x-boneblack-uboot-univ.dtb +
BB-BONE-eMMC1-01-00A0.dtbo + AM335X-PRU-UIO-00A0.dtbo +
BB-UART2-00A0.dtbo = am335x-boneblack.dtb

fdtoverlay -i am335x-boneblack-uboot-univ.dtb -o am335x-boneblack.dtb
BB-BONE-eMMC1-01-00A0.dtbo AM335X-PRU-UIO-00A0.dtbo BB-UART2-00A0.dtbo

so that would cut down on a few seconds..

Regards,