[PATCH/RFC] board: amlogic: Fix Odroid-C4 SD card reboot issue

Marek Szyprowski m.szyprowski at samsung.com
Thu Dec 17 10:06:24 CET 2020


For the proper reboot Odroid C4 board requires to switch TFLASH_VDD_EN
pin to the input (high impedance?) mode, otherwise the board is stuck
in the middle of loading early stages of the bootloader from SD card.

This has been achieved by hijacking reset_misc() callback from the PSCI
firmware in the Odroid board code. The common meson cpu_reset() function,
which is called later during the reboot procedure, will call PSCI reboot
anyway.

This issue doesn't happen if board is booted from eMMC.

Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
---
 board/amlogic/odroid-n2/odroid-n2.c | 15 +++++++++++++++
 configs/odroid-c4_defconfig         |  1 +
 2 files changed, 16 insertions(+)

diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c
index caf7fd6810..ad91de7ac5 100644
--- a/board/amlogic/odroid-n2/odroid-n2.c
+++ b/board/amlogic/odroid-n2/odroid-n2.c
@@ -10,6 +10,7 @@
 #include <init.h>
 #include <net.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/sm.h>
 #include <asm/arch/eth.h>
 
@@ -47,3 +48,17 @@ int misc_init_r(void)
 
 	return 0;
 }
+
+#ifndef CONFIG_PSCI_RESET
+void reset_misc(void)
+{
+	if (of_machine_is_compatible("hardkernel,odroid-c4")) {
+		unsigned int gpio;
+		const char *str_gpio = "aobus-banks3";
+
+		gpio_lookup_name(str_gpio, NULL, NULL, &gpio);
+		gpio_request(gpio, "reboot");
+		gpio_direction_input(gpio);
+	}
+}
+#endif
diff --git a/configs/odroid-c4_defconfig b/configs/odroid-c4_defconfig
index 367d22db0b..ca0ab71a7a 100644
--- a/configs/odroid-c4_defconfig
+++ b/configs/odroid-c4_defconfig
@@ -14,6 +14,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+# CONFIG_PSCI_RESET is not set
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
-- 
2.17.1



More information about the U-Boot mailing list