[PATCH] sunxi: support boot console on uart1 for sun8i

Tobias Schramm tobleminer at gmail.com
Fri Feb 12 15:08:23 CET 2021


From: Tobias Schramm <t.schramm at manjaro.org>

This commit adds support for using uart1 as boot console on sun8i.

Signed-off-by: Tobias Schramm <t.schramm at manjaro.org>
---
 arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
 arch/arm/mach-sunxi/board.c            | 4 ++++
 include/configs/sunxi-common.h         | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index de77bf638e..2969a530ae 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -190,6 +190,7 @@ enum sunxi_gpio_number {
 #define SUN5I_GPG_SDC1		2
 #define SUN6I_GPG_SDC1		2
 #define SUN8I_GPG_SDC1		2
+#define SUN8I_GPG_UART1		2
 #define SUN6I_GPG_TWI3		2
 #define SUN5I_GPG_UART1		4
 
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index ae6bc656d9..febec0ae03 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -144,6 +144,10 @@ static int gpio_init(void)
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPG(6), SUN8I_GPG_UART1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPG(7), SUN8I_GPG_UART1);
+	sunxi_gpio_set_pull(SUNXI_GPL(7), SUNXI_GPIO_PULL_UP);
 #else
 #error Unsupported console port number. Please fix pin mux settings in board.c
 #endif
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 000f386470..19f0026888 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -251,6 +251,8 @@ extern int soft_i2c_gpio_scl;
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
 #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
+#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I)
+#define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28400:115200"
 #else
 #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
 #endif
-- 
2.30.0



More information about the U-Boot mailing list