[2/5] roc-rk3399-pc: Configure the leds only during POR

Message ID 20200318094405.25511-2-jagan@amarulasolutions.com
State New
Headers show
Series
  • [1/5] rockchip: Separate the reset cause from display cpuinfo
Related show

Commit Message

Jagan Teki March 18, 2020, 9:44 a.m.
ROC-RK3399-PC has specific set of configurations for
on-board led setup.

Due to easiness for user to know the state of the board
roc-rk339-pc board code will setup the led on/off, and
waiting for user to press power key.

All this needs to happen only during power-on-reset not
for soft reset or WDT. So add reset cause check to POR
and configure leds.

Reported-by: Markus Reichl <m.reichl at fivetechno.de>
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
 board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Suniel Mahesh March 19, 2020, 9:16 a.m. | #1
As far as linux reboot is concerned, once reboot is done, there is no led status 
indication when in u-boot. Since its a reboot and board has entered full 
power mode, enabling RED led would be fine I guess.
 
Suniel

Patch

diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
index de9185a7ce..0a7d72a2a0 100644
--- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
+++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
@@ -33,11 +33,12 @@  out:
 #endif
 
 #if defined(CONFIG_TPL_BUILD)
+#include <asm/arch-rockchip/cru.h>
 
 #define PMUGRF_BASE     0xff320000
 #define GPIO0_BASE      0xff720000
 
-int board_early_init_f(void)
+void board_early_led_setup(void)
 {
 	struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE;
 	struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
@@ -55,7 +56,15 @@  int board_early_init_f(void)
 
 	spl_gpio_output(gpio0, GPIO(BANK_A, 2), 0);
 	spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1);
+}
+
+int board_early_init_f(void)
+{
+	/* Set the leds only during POR */
+	if (!strcmp(get_reset_cause(), "POR"))
+		board_early_led_setup();
 
 	return 0;
 }
+
 #endif