[PATCH] sunxi: h3: add console support for uart1-3

Manuel Dipolt manuel.dipolt at robart.cc
Thu Jun 24 14:39:51 CEST 2021


Add uart1-3 console support for the Allwinner H3 SOC 

Signed-off-by: Manuel Dipolt <manuel.dipolt at robart.cc> 
--- 

arch/arm/include/asm/arch-sunxi/gpio.h | 3 +++ 
arch/arm/mach-sunxi/board.c | 14 ++++++++++++++ 
include/configs/sunxi-common.h | 5 ++++- 
3 files changed, 21 insertions(+), 1 deletion(-) 

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h 
index 40a3f845d0..50010071ae 100644 
--- a/arch/arm/include/asm/arch-sunxi/gpio.h 
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h 
@@ -148,6 +148,9 @@ enum sunxi_gpio_number { 
#define SUN6I_GPA_SDC2 5 
#define SUN6I_GPA_SDC3 4 
#define SUN8I_H3_GPA_UART0 2 
+#define SUN8I_H3_GPG_UART1 2 
+#define SUN8I_H3_GPA_UART2 2 
+#define SUN8I_H3_GPA_UART3 3 

#define SUN4I_GPB_PWM 2 
#define SUN4I_GPB_TWI0 2 
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c 
index 8e9bb63d9d..31f780d1b5 100644 
--- a/arch/arm/mach-sunxi/board.c 
+++ b/arch/arm/mach-sunxi/board.c 
@@ -127,10 +127,24 @@ static int gpio_init(void) 
sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1); 
sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1); 
sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP); 
+#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I_H3) 
+ sunxi_gpio_set_cfgpin(SUNXI_GPG(7), SUN8I_H3_GPG_UART1); 
+ sunxi_gpio_set_cfgpin(SUNXI_GPG(6), SUN8I_H3_GPG_UART1); 
+ sunxi_gpio_set_pull(SUNXI_GPG(6), SUNXI_GPIO_PULL_UP); 
#elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) 
+#if defined(CONFIG_MACH_SUN8I_H3) 
+ sunxi_gpio_set_cfgpin(SUNXI_GPA(1), SUN8I_H3_GPA_UART2); 
+ sunxi_gpio_set_cfgpin(SUNXI_GPA(0), SUN8I_H3_GPA_UART2); 
+ sunxi_gpio_set_pull(SUNXI_GPA(0), SUNXI_GPIO_PULL_UP); 
+#else 
sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN8I_GPB_UART2); 
sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN8I_GPB_UART2); 
sunxi_gpio_set_pull(SUNXI_GPB(1), SUNXI_GPIO_PULL_UP); 
+#endif 
+#elif CONFIG_CONS_INDEX == 4 && defined(CONFIG_MACH_SUN8I_H3) 
+ sunxi_gpio_set_cfgpin(SUNXI_GPA(14), SUN8I_H3_GPA_UART3); 
+ sunxi_gpio_set_cfgpin(SUNXI_GPA(13), SUN8I_H3_GPA_UART3); 
+ sunxi_gpio_set_pull(SUNXI_GPA(13), SUNXI_GPIO_PULL_UP); 
#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) 
sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART); 
sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART); 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h 
index fceb812448..5b7c310fde 100644 
--- a/include/configs/sunxi-common.h 
+++ b/include/configs/sunxi-common.h 
@@ -246,10 +246,13 @@ extern int soft_i2c_gpio_scl; 
#else 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01c28000:115200" 
#endif 
-#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) 
+#elif CONFIG_CONS_INDEX == 2 && \ 
+ (defined(CONFIG_MACH_SUN5I) || \defined(CONFIG_MACH_SUN8I_H3)) 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01c28400:115200" 
#elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01c28800:115200" 
+#elif CONFIG_CONS_INDEX == 4 && defined(CONFIG_MACH_SUN8I_H3) 
+#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01c28C00:115200" 
#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01f02800:115200" 
#else 
-- 
2.20.1


More information about the U-Boot mailing list