2020-02-03 16:04:53

by Erwan LE RAY

[permalink] [raw]
Subject: [PATCH v3 0/4] STM32 early console

Add UART instance configuration to STM32 F4 and F7 early console.
Add STM32 H7 and MP1 early console support.

Changes in v3:
- fix a missing condition for STM32MP1

Changes in v2:
- split "[PATCH] ARM: debug: stm32: add UART early console configuration"
into separate patches as suggested by Clement into [1]

[1] https://lkml.org/lkml/2019/4/10/199

Erwan Le Ray (4):
ARM: debug: stm32: add UART early console configuration for STM32F4
ARM: debug: stm32: add UART early console configuration for STM32F7
ARM: debug: stm32: add UART early console support for STM32H7
ARM: debug: stm32: add UART early console support for STM32MP1

arch/arm/Kconfig.debug | 42 +++++++++++++++++++++++++++++-----
arch/arm/include/debug/stm32.S | 9 ++++----
2 files changed, 40 insertions(+), 11 deletions(-)

--
2.17.1


2020-02-03 16:04:55

by Erwan LE RAY

[permalink] [raw]
Subject: [PATCH v3 1/4] ARM: debug: stm32: add UART early console configuration for STM32F4

Early console is hardcoded on USART1 in current implementation.
With this patch, default UART instance is USART1, but other UART instances
can be configured by setting physical and virtual base addresses in
menuconfig.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8bcbd0cd739b..4f982ef1d0ec 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1201,12 +1201,13 @@ choice

config STM32F4_DEBUG_UART
bool "Use STM32F4 UART for low-level debug"
- depends on ARCH_STM32
+ depends on MACH_STM32F429 || MACH_STM32F469
select DEBUG_STM32_UART
help
Say Y here if you want kernel low-level debugging support
on STM32F4 based platforms, which default UART is wired on
- USART1.
+ USART1, but another UART instance can be selected by modifying
+ CONFIG_DEBUG_UART_PHYS.

If unsure, say N.

@@ -1619,6 +1620,7 @@ config DEBUG_UART_PHYS
default 0x3e000000 if DEBUG_BCM_KONA_UART
default 0x3f201000 if DEBUG_BCM2836
default 0x4000e400 if DEBUG_LL_UART_EFM32
+ default 0x40011000 if STM32F4_DEBUG_UART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
default 0x40081000 if DEBUG_LPC18XX_UART0
default 0x40090000 if DEBUG_LPC32XX
@@ -1713,7 +1715,7 @@ config DEBUG_UART_PHYS
DEBUG_S3C64XX_UART || \
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \
- DEBUG_AT91_UART
+ DEBUG_AT91_UART || DEBUG_STM32_UART

config DEBUG_UART_VIRT
hex "Virtual base address of debug UART"
@@ -1823,7 +1825,7 @@ config DEBUG_UART_VIRT
DEBUG_S3C64XX_UART || \
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \
- DEBUG_AT91_UART
+ DEBUG_AT91_UART || DEBUG_STM32_UART

config DEBUG_UART_8250_SHIFT
int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
index 1abb32f685fd..b0c7034b33d9 100644
--- a/arch/arm/include/debug/stm32.S
+++ b/arch/arm/include/debug/stm32.S
@@ -4,8 +4,6 @@
* Author: Gerald Baeza <[email protected]> for STMicroelectronics.
*/

-#define STM32_UART_BASE 0x40011000 /* USART1 */
-
#ifdef CONFIG_STM32F4_DEBUG_UART
#define STM32_USART_SR_OFF 0x00
#define STM32_USART_TDR_OFF 0x04
@@ -20,8 +18,8 @@
#define STM32_USART_TXE (1 << 7) /* Tx data reg empty */

.macro addruart, rp, rv, tmp
- ldr \rp, =STM32_UART_BASE @ physical base
- ldr \rv, =STM32_UART_BASE @ virt base /* NoMMU */
+ ldr \rp, =CONFIG_DEBUG_UART_PHYS @ physical base
+ ldr \rv, =CONFIG_DEBUG_UART_VIRT @ virt base
.endm

.macro senduart,rd,rx
--
2.17.1

2020-02-03 16:05:06

by Erwan LE RAY

[permalink] [raw]
Subject: [PATCH v3 3/4] ARM: debug: stm32: add UART early console support for STM32H7

Add support of early console for STM32H7. Default UART instance is USART1,
but other UART instances can be configured by setting physical and virtual
base addresses in menuconfig.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 5ff66c294a5a..e5e1703a89c0 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1223,6 +1223,18 @@ choice

If unsure, say N.

+ config STM32H7_DEBUG_UART
+ bool "Use STM32H7 UART for low-level debug"
+ depends on MACH_STM32H743
+ select DEBUG_STM32_UART
+ help
+ Say Y here if you want kernel low-level debugging support
+ on STM32H7 based platforms, which default UART is wired on
+ USART1, but another UART instance can be selected by modifying
+ CONFIG_DEBUG_UART_PHYS.
+
+ If unsure, say N.
+
config TEGRA_DEBUG_UART_AUTO_ODMDATA
bool "Kernel low-level debugging messages via Tegra UART via ODMDATA"
depends on ARCH_TEGRA
@@ -1621,7 +1633,8 @@ config DEBUG_UART_PHYS
default 0x3e000000 if DEBUG_BCM_KONA_UART
default 0x3f201000 if DEBUG_BCM2836
default 0x4000e400 if DEBUG_LL_UART_EFM32
- default 0x40011000 if STM32F4_DEBUG_UART || STM32F7_DEBUG_UART
+ default 0x40011000 if STM32F4_DEBUG_UART || STM32F7_DEBUG_UART || \
+ STM32H7_DEBUG_UART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
default 0x40081000 if DEBUG_LPC18XX_UART0
default 0x40090000 if DEBUG_LPC32XX
diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
index b0c7034b33d9..5a2e2b065340 100644
--- a/arch/arm/include/debug/stm32.S
+++ b/arch/arm/include/debug/stm32.S
@@ -9,7 +9,7 @@
#define STM32_USART_TDR_OFF 0x04
#endif

-#ifdef CONFIG_STM32F7_DEBUG_UART
+#if defined(CONFIG_STM32F7_DEBUG_UART) || defined(CONFIG_STM32H7_DEBUG_UART)
#define STM32_USART_SR_OFF 0x1C
#define STM32_USART_TDR_OFF 0x28
#endif
--
2.17.1

2020-02-03 16:05:23

by Erwan LE RAY

[permalink] [raw]
Subject: [PATCH v3 2/4] ARM: debug: stm32: add UART early console configuration for STM32F7

Early console is hardcoded on USART1 in current implementation.
With this patch, default UART instance is USART1, but other UART instances
can be configured by setting physical and virtual base addresses in
menuconfig.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 4f982ef1d0ec..5ff66c294a5a 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1213,12 +1213,13 @@ choice

config STM32F7_DEBUG_UART
bool "Use STM32F7 UART for low-level debug"
- depends on ARCH_STM32
+ depends on MACH_STM32F746 || MACH_STM32F769
select DEBUG_STM32_UART
help
Say Y here if you want kernel low-level debugging support
on STM32F7 based platforms, which default UART is wired on
- USART1.
+ USART1, but another UART instance can be selected by modifying
+ CONFIG_DEBUG_UART_PHYS.

If unsure, say N.

@@ -1620,7 +1621,7 @@ config DEBUG_UART_PHYS
default 0x3e000000 if DEBUG_BCM_KONA_UART
default 0x3f201000 if DEBUG_BCM2836
default 0x4000e400 if DEBUG_LL_UART_EFM32
- default 0x40011000 if STM32F4_DEBUG_UART
+ default 0x40011000 if STM32F4_DEBUG_UART || STM32F7_DEBUG_UART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
default 0x40081000 if DEBUG_LPC18XX_UART0
default 0x40090000 if DEBUG_LPC32XX
--
2.17.1

2020-02-03 16:05:23

by Erwan LE RAY

[permalink] [raw]
Subject: [PATCH v3 4/4] ARM: debug: stm32: add UART early console support for STM32MP1

Add support of early console for STM32MP1. Default UART instance is UART4,
but other UART instances can be configured by setting physical and virtual
base addresses in menuconfig.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index e5e1703a89c0..3357e294a7cc 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1235,6 +1235,18 @@ choice

If unsure, say N.

+ config STM32MP1_DEBUG_UART
+ bool "Use STM32MP1 UART for low-level debug"
+ depends on MACH_STM32MP157
+ select DEBUG_STM32_UART
+ help
+ Say Y here if you want kernel low-level debugging support
+ on STM32MP1 based platforms, wich default UART is wired on
+ UART4, but another UART instance can be selected by modifying
+ CONFIG_DEBUG_UART_PHYS and CONFIG_DEBUG_UART_VIRT.
+
+ If unsure, say N.
+
config TEGRA_DEBUG_UART_AUTO_ODMDATA
bool "Kernel low-level debugging messages via Tegra UART via ODMDATA"
depends on ARCH_TEGRA
@@ -1633,6 +1645,7 @@ config DEBUG_UART_PHYS
default 0x3e000000 if DEBUG_BCM_KONA_UART
default 0x3f201000 if DEBUG_BCM2836
default 0x4000e400 if DEBUG_LL_UART_EFM32
+ default 0x40010000 if STM32MP1_DEBUG_UART
default 0x40011000 if STM32F4_DEBUG_UART || STM32F7_DEBUG_UART || \
STM32H7_DEBUG_UART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
@@ -1795,6 +1808,7 @@ config DEBUG_UART_VIRT
default 0xfcfe8600 if DEBUG_BCM63XX_UART
default 0xfd000000 if DEBUG_SPEAR3XX || DEBUG_SPEAR13XX
default 0xfd883000 if DEBUG_ALPINE_UART0
+ default 0xfe010000 if STM32MP1_DEBUG_UART
default 0xfe017000 if DEBUG_MMP_UART2
default 0xfe018000 if DEBUG_MMP_UART3
default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
index 5a2e2b065340..f3c4a37210ed 100644
--- a/arch/arm/include/debug/stm32.S
+++ b/arch/arm/include/debug/stm32.S
@@ -9,7 +9,8 @@
#define STM32_USART_TDR_OFF 0x04
#endif

-#if defined(CONFIG_STM32F7_DEBUG_UART) || defined(CONFIG_STM32H7_DEBUG_UART)
+#if defined(CONFIG_STM32F7_DEBUG_UART) || defined(CONFIG_STM32H7_DEBUG_UART) || \
+ defined(CONFIG_STM32MP1_DEBUG_UART)
#define STM32_USART_SR_OFF 0x1C
#define STM32_USART_TDR_OFF 0x28
#endif
--
2.17.1

2020-02-03 17:01:23

by Clément Péron

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] STM32 early console

Hi Erwan,

On Mon, 3 Feb 2020 at 15:04, Erwan Le Ray <[email protected]> wrote:
>
> Add UART instance configuration to STM32 F4 and F7 early console.
> Add STM32 H7 and MP1 early console support.
>
> Changes in v3:
> - fix a missing condition for STM32MP1
>
> Changes in v2:
> - split "[PATCH] ARM: debug: stm32: add UART early console configuration"
> into separate patches as suggested by Clement into [1]

Thanks for splitting the patch, the whole series looks fine to me.

Acked-by: Clément Péron <[email protected]>

Clément



>
> [1] https://lkml.org/lkml/2019/4/10/199
>
> Erwan Le Ray (4):
> ARM: debug: stm32: add UART early console configuration for STM32F4
> ARM: debug: stm32: add UART early console configuration for STM32F7
> ARM: debug: stm32: add UART early console support for STM32H7
> ARM: debug: stm32: add UART early console support for STM32MP1
>
> arch/arm/Kconfig.debug | 42 +++++++++++++++++++++++++++++-----
> arch/arm/include/debug/stm32.S | 9 ++++----
> 2 files changed, 40 insertions(+), 11 deletions(-)
>
> --
> 2.17.1
>

2020-02-21 15:56:27

by Erwan LE RAY

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] STM32 early console

Hi Russel, Max, Alex, Arnd, Linus and Olof,

Gentle reminder.

Can you please provide your feedback on this series ?

Best Regards, Erwan.


On 2/3/20 3:35 PM, Clément Péron wrote:
> Hi Erwan,
>
> On Mon, 3 Feb 2020 at 15:04, Erwan Le Ray <[email protected]> wrote:
>> Add UART instance configuration to STM32 F4 and F7 early console.
>> Add STM32 H7 and MP1 early console support.
>>
>> Changes in v3:
>> - fix a missing condition for STM32MP1
>>
>> Changes in v2:
>> - split "[PATCH] ARM: debug: stm32: add UART early console configuration"
>> into separate patches as suggested by Clement into [1]
> Thanks for splitting the patch, the whole series looks fine to me.
>
> Acked-by: Clément Péron <[email protected]>
>
> Clément
>
>
>
>> [1] https://lkml.org/lkml/2019/4/10/199
>>
>> Erwan Le Ray (4):
>> ARM: debug: stm32: add UART early console configuration for STM32F4
>> ARM: debug: stm32: add UART early console configuration for STM32F7
>> ARM: debug: stm32: add UART early console support for STM32H7
>> ARM: debug: stm32: add UART early console support for STM32MP1
>>
>> arch/arm/Kconfig.debug | 42 +++++++++++++++++++++++++++++-----
>> arch/arm/include/debug/stm32.S | 9 ++++----
>> 2 files changed, 40 insertions(+), 11 deletions(-)
>>
>> --
>> 2.17.1
>>

2020-02-21 16:00:22

by Alexandre Torgue

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] STM32 early console

Hi

On 2/3/20 3:04 PM, Erwan Le Ray wrote:
> Add UART instance configuration to STM32 F4 and F7 early console.
> Add STM32 H7 and MP1 early console support.
>
> Changes in v3:
> - fix a missing condition for STM32MP1
>
> Changes in v2:
> - split "[PATCH] ARM: debug: stm32: add UART early console configuration"
> into separate patches as suggested by Clement into [1]
>
> [1] https://lkml.org/lkml/2019/4/10/199
>
> Erwan Le Ray (4):
> ARM: debug: stm32: add UART early console configuration for STM32F4
> ARM: debug: stm32: add UART early console configuration for STM32F7
> ARM: debug: stm32: add UART early console support for STM32H7
> ARM: debug: stm32: add UART early console support for STM32MP1
>
> arch/arm/Kconfig.debug | 42 +++++++++++++++++++++++++++++-----
> arch/arm/include/debug/stm32.S | 9 ++++----
> 2 files changed, 40 insertions(+), 11 deletions(-)
>

Acked-by: Alexandre TORGUE <[email protected]>

Russel, Arnd, Olof, Linus
Do I have to take this series in my next PR ? or you'll ?

Thanks
alex

2020-02-22 11:23:31

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] STM32 early console

On Fri, Feb 21, 2020 at 4:58 PM Alexandre Torgue
<[email protected]> wrote:

> > Erwan Le Ray (4):
> > ARM: debug: stm32: add UART early console configuration for STM32F4
> > ARM: debug: stm32: add UART early console configuration for STM32F7
> > ARM: debug: stm32: add UART early console support for STM32H7
> > ARM: debug: stm32: add UART early console support for STM32MP1
(...)
> Do I have to take this series in my next PR ? or you'll ?

Sign it off and send a PR to ARM SoC.

Yours,
Linus Walleij

2020-03-13 12:58:21

by Alexandre Torgue

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] STM32 early console

Hi Erwan

On 2/3/20 3:04 PM, Erwan Le Ray wrote:
> Add UART instance configuration to STM32 F4 and F7 early console.
> Add STM32 H7 and MP1 early console support.
>
> Changes in v3:
> - fix a missing condition for STM32MP1
>
> Changes in v2:
> - split "[PATCH] ARM: debug: stm32: add UART early console configuration"
> into separate patches as suggested by Clement into [1]
>
> [1] https://lkml.org/lkml/2019/4/10/199
>
> Erwan Le Ray (4):
> ARM: debug: stm32: add UART early console configuration for STM32F4
> ARM: debug: stm32: add UART early console configuration for STM32F7
> ARM: debug: stm32: add UART early console support for STM32H7
> ARM: debug: stm32: add UART early console support for STM32MP1
>
> arch/arm/Kconfig.debug | 42 +++++++++++++++++++++++++++++-----
> arch/arm/include/debug/stm32.S | 9 ++++----
> 2 files changed, 40 insertions(+), 11 deletions(-)
>

Series applied on stm32-next.

Regards
Alex