[U-Boot] [PATCH] added uart1-3 support for the allwinner h3

Manuel Dipolt mdipolt at robart.cc
Tue Mar 12 18:57:29 UTC 2019


--- 
arch/arm/include/asm/arch-sunxi/gpio.h | 3 +++ 
arch/arm/mach-sunxi/board.c | 12 ++++++++++++ 
include/configs/sunxi-common.h | 8 +++++--- 
3 files changed, 20 insertions(+), 3 deletions(-) 

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 b74eaf2a0e..5ee14bd7aa 100644 
--- a/arch/arm/mach-sunxi/board.c 
+++ b/arch/arm/mach-sunxi/board.c 
@@ -127,10 +127,22 @@ 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) 
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); 
+#elif CONFIG_CONS_INDEX == 3 && 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); 
+#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 b01d1c3c84..561c799aa9 100644 
--- a/include/configs/sunxi-common.h 
+++ b/include/configs/sunxi-common.h 
@@ -255,11 +255,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) 
+#elif CONFIG_CONS_INDEX == 3 && ( defined(CONFIG_MACH_SUN8I) || defined(CONFIG_MACH_SUN8I_H3) ) 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01c28800:115200" 
-#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) 
+#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) || defined(CONFIG_MACH_SUN8I_H3) ) 
#define OF_STDOUT_PATH "/soc at 01c00000/serial at 01f02800:115200" 
#else 
#error Unsupported console port nr. Please fix stdout-path in sunxi-common.h. 
-- 
2.11.0 




More information about the U-Boot mailing list