Skip to contentSkip to conversation

sunxi: support boot console on uart1 for sun8i

PATCH New Tobias Schramm 3 participants 4 messages Feb 12, 2021 – Feb 14, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: support boot console on uart1 for sun8i

From: Tobias Schramm <[email protected]>

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

---
 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(+)
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
index de77bf638e..2969a530ae 100644
@@ -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
 
arch/arm/mach-sunxi/board.c +4 -0
index ae6bc656d9..febec0ae03 100644
@@ -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
include/configs/sunxi-common.h +2 -0
index 000f386470..19f0026888 100644
@@ -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
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/1 sunxi: support boot console on uart1 for sun8i

On Fri, 12 Feb 2021 15:08:23 +0100
Tobias Schramm <[email protected]> wrote:

Hi Tobias,

Quoted 3 lines

From: Tobias Schramm <[email protected]>

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

Which particular SoC or board is this triggered by?

From the SoCs listed as belonging to the MACH_SUN8I "family", I don't see the R40 and V3s having UART1 muxed on PortG, only A23, A33, H3, H5, and A83T have.
So can you restrict the conditions?

...

Quoted 25 lines
---
 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(+)
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
index de77bf638e..2969a530ae 100644
@@ -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
 
arch/arm/mach-sunxi/board.c +0 -0
index ae6bc656d9..febec0ae03 100644

arch/arm/mach-sunxi/board.c static int gpio_init(void) · line 150

Quoted 7 lines
arch/arm/mach-sunxi/board.c +4 -0
@@ -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);

This should be SUNXI_GPG(7).

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 255

Quoted 13 lines
arch/arm/mach-sunxi/board.c +0 -0
 #else
 #error Unsupported console port number. Please fix pin mux settings in board.c
 #endif
include/configs/sunxi-common.h +2 -0
index 000f386470..19f0026888 100644
@@ -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"

The leading zeroes in there make me suspicious that this has been broken for a while.
And also it looks like all(?) board DTs have a stdout-path property already anyway.
So I'd recommend to leave this out, I will probably send a patch to remove this altogether.

Cheers,
Andre

Quoted 3 lines
include/configs/sunxi-common.h +0 -0
 #else
 #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
 #endif
#2 lore raw

PATCH 1/1 sunxi: support boot console on uart1 for sun8i

Hi Andre,

Quoted 2 lines

Which particular SoC or board is this triggered by?

I'm currently using a board with a Sochip S3 SoC, where the boot console is on uart1.

Quoted 4 lines

From the SoCs listed as belonging to the MACH_SUN8I "family", I don't
see the R40 and V3s having UART1 muxed on PortG, only A23, A33, H3, H5, and A83T have.
So can you restrict the conditions?

I can - at least in the commit description. Unfortunately there is no real distinction between V3s and S3 in u-boot. I could of course define a new "S3" SoC variant and add it to the ifdef for the uart iomux. Would you prefer me to do that?

[...]

Quoted 2 lines

So I'd recommend to leave this out, I will probably send a patch to remove this altogether.

Ok. I'll leave that out in v2 then.

Thanks,

Tobias

#3 lore raw

PATCH 1/1 sunxi: support boot console on uart1 for sun8i

On Sat, 13 Feb 2021 19:45:45 +0100
Tobias Schramm <[email protected]> wrote:

Hi,

Quoted 11 lines
Quoted 2 lines

Which particular SoC or board is this triggered by?

I'm currently using a board with a Sochip S3 SoC, where the boot console is on uart1.

Quoted 4 lines

From the SoCs listed as belonging to the MACH_SUN8I "family", I don't
see the R40 and V3s having UART1 muxed on PortG, only A23, A33, H3, H5, and A83T have.
So can you restrict the conditions?

Quoted 4 lines

I can - at least in the commit description. Unfortunately there is no real distinction between V3s and S3 in u-boot. I could of course define a new "S3" SoC variant and add it to the ifdef for the uart iomux. Would you prefer me to do that?

Ah, looking closer it seems that a V3s don't route out those pins, but is still using the same die as the S3.

So for the sake of this patch we can assume that the V3s has those pins as well.

I would say, use: (defined(CONFIG_MACH_SUN8I) && !defined(CONFIG_MACH_SUN8I_R40))

Cheers,
Andre.

Quoted 11 lines

[...]

Quoted 2 lines

So I'd recommend to leave this out, I will probably send a patch to remove this altogether.

Ok. I'll leave that out in v2 then.

Thanks,

Tobias