All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-04 13:32 ` Ludovic Barre
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Barre @ 2017-12-04 13:32 UTC (permalink / raw)
  To: Russell King
  Cc: Maxime Coquelin, Alexandre Torgue, linux-arm-kernel,
	linux-kernel, Ludovic Barre, Gerald Baeza

From: Ludovic Barre <ludovic.barre@st.com>

This adds low-level debug support on USART1 for STM32F4
and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
Enabled via 'earlyprintk' in bootargs.

Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
---
 arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
 arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 arch/arm/include/debug/stm32.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 17685e1..9469c58 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1140,6 +1140,26 @@ choice
 
 		  If unsure, say N.
 
+	config STM32F4_DEBUG_UART
+		bool "Use STM32F4 UART for low-level debug"
+		depends on ARCH_STM32
+		select DEBUG_STM32_UART
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on STM32 based platforms.
+
+		  If unsure, say N.
+
+	config STM32F7_DEBUG_UART
+		bool "Use STM32F7 UART for low-level debug"
+		depends on ARCH_STM32
+		select DEBUG_STM32_UART
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on STM32 based platforms.
+
+		  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
@@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
 	bool
 	depends on ARCH_STI
 
+config DEBUG_STM32_UART
+	bool
+	depends on ARCH_STM32
+
 config DEBUG_SIRFSOC_UART
 	bool
 	depends on ARCH_SIRF
@@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
 	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
 	default "debug/sti.S" if DEBUG_STI_UART
+	default "debug/stm32.S" if DEBUG_STM32_UART
 	default "debug/tegra.S" if DEBUG_TEGRA_UART
 	default "debug/ux500.S" if DEBUG_UX500_UART
 	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
new file mode 100644
index 0000000..4015257
--- /dev/null
+++ b/arch/arm/include/debug/stm32.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: Gerald Baeza <gerald_baeza@st.com>
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#define STM32_UART_BASE			0x40011000	/* USART1 */
+
+#ifdef CONFIG_STM32F4_DEBUG_UART
+#define STM32_USART_SR_OFF		0x00
+#define STM32_USART_TDR_OFF		0x04
+#endif
+
+#ifdef CONFIG_STM32F7_DEBUG_UART
+#define STM32_USART_SR_OFF		0x1C
+#define STM32_USART_TDR_OFF		0x28
+#endif
+
+#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
+#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 */
+		.endm
+
+                .macro  senduart,rd,rx
+                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
+                .endm
+
+                .macro  waituart,rd,rx
+1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
+	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
+	beq	1001b
+                .endm
+
+                .macro  busyuart,rd,rx
+1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
+	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
+	beq	1001b
+                .endm
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-04 13:32 ` Ludovic Barre
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Barre @ 2017-12-04 13:32 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Barre <ludovic.barre@st.com>

This adds low-level debug support on USART1 for STM32F4
and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
Enabled via 'earlyprintk' in bootargs.

Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
---
 arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
 arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 arch/arm/include/debug/stm32.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 17685e1..9469c58 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1140,6 +1140,26 @@ choice
 
 		  If unsure, say N.
 
+	config STM32F4_DEBUG_UART
+		bool "Use STM32F4 UART for low-level debug"
+		depends on ARCH_STM32
+		select DEBUG_STM32_UART
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on STM32 based platforms.
+
+		  If unsure, say N.
+
+	config STM32F7_DEBUG_UART
+		bool "Use STM32F7 UART for low-level debug"
+		depends on ARCH_STM32
+		select DEBUG_STM32_UART
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on STM32 based platforms.
+
+		  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
@@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
 	bool
 	depends on ARCH_STI
 
+config DEBUG_STM32_UART
+	bool
+	depends on ARCH_STM32
+
 config DEBUG_SIRFSOC_UART
 	bool
 	depends on ARCH_SIRF
@@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
 	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
 	default "debug/sti.S" if DEBUG_STI_UART
+	default "debug/stm32.S" if DEBUG_STM32_UART
 	default "debug/tegra.S" if DEBUG_TEGRA_UART
 	default "debug/ux500.S" if DEBUG_UX500_UART
 	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
new file mode 100644
index 0000000..4015257
--- /dev/null
+++ b/arch/arm/include/debug/stm32.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: Gerald Baeza <gerald_baeza@st.com>
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#define STM32_UART_BASE			0x40011000	/* USART1 */
+
+#ifdef CONFIG_STM32F4_DEBUG_UART
+#define STM32_USART_SR_OFF		0x00
+#define STM32_USART_TDR_OFF		0x04
+#endif
+
+#ifdef CONFIG_STM32F7_DEBUG_UART
+#define STM32_USART_SR_OFF		0x1C
+#define STM32_USART_TDR_OFF		0x28
+#endif
+
+#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
+#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 */
+		.endm
+
+                .macro  senduart,rd,rx
+                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
+                .endm
+
+                .macro  waituart,rd,rx
+1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
+	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
+	beq	1001b
+                .endm
+
+                .macro  busyuart,rd,rx
+1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
+	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
+	beq	1001b
+                .endm
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] ARM: debug: add stm32 low-level debug support
  2017-12-04 13:32 ` Ludovic Barre
@ 2017-12-11  9:08   ` Alexandre Torgue
  -1 siblings, 0 replies; 10+ messages in thread
From: Alexandre Torgue @ 2017-12-11  9:08 UTC (permalink / raw)
  To: Ludovic Barre, Russell King
  Cc: Maxime Coquelin, linux-arm-kernel, linux-kernel, Gerald Baeza

Hi Ludovic

On 12/04/2017 02:32 PM, Ludovic Barre wrote:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> This adds low-level debug support on USART1 for STM32F4
> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
> Enabled via 'earlyprintk' in bootargs.
> 
> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>

Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

> ---
>   arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
>   arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 66 insertions(+)
>   create mode 100644 arch/arm/include/debug/stm32.S
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 17685e1..9469c58 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1140,6 +1140,26 @@ choice
>   
>   		  If unsure, say N.
>   
> +	config STM32F4_DEBUG_UART
> +		bool "Use STM32F4 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  If unsure, say N.
> +
> +	config STM32F7_DEBUG_UART
> +		bool "Use STM32F7 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  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
> @@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
>   	bool
>   	depends on ARCH_STI
>   
> +config DEBUG_STM32_UART
> +	bool
> +	depends on ARCH_STM32
> +
>   config DEBUG_SIRFSOC_UART
>   	bool
>   	depends on ARCH_SIRF
> @@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
>   	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
>   	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
>   	default "debug/sti.S" if DEBUG_STI_UART
> +	default "debug/stm32.S" if DEBUG_STM32_UART
>   	default "debug/tegra.S" if DEBUG_TEGRA_UART
>   	default "debug/ux500.S" if DEBUG_UX500_UART
>   	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
> diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
> new file mode 100644
> index 0000000..4015257
> --- /dev/null
> +++ b/arch/arm/include/debug/stm32.S
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author: Gerald Baeza <gerald_baeza@st.com>
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#define STM32_UART_BASE			0x40011000	/* USART1 */
> +
> +#ifdef CONFIG_STM32F4_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x00
> +#define STM32_USART_TDR_OFF		0x04
> +#endif
> +
> +#ifdef CONFIG_STM32F7_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x1C
> +#define STM32_USART_TDR_OFF		0x28
> +#endif
> +
> +#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
> +#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 */
> +		.endm
> +
> +                .macro  senduart,rd,rx
> +                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
> +                .endm
> +
> +                .macro  waituart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
> +	beq	1001b
> +                .endm
> +
> +                .macro  busyuart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
> +	beq	1001b
> +                .endm
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-11  9:08   ` Alexandre Torgue
  0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Torgue @ 2017-12-11  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ludovic

On 12/04/2017 02:32 PM, Ludovic Barre wrote:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> This adds low-level debug support on USART1 for STM32F4
> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
> Enabled via 'earlyprintk' in bootargs.
> 
> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>

Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

> ---
>   arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
>   arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 66 insertions(+)
>   create mode 100644 arch/arm/include/debug/stm32.S
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 17685e1..9469c58 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1140,6 +1140,26 @@ choice
>   
>   		  If unsure, say N.
>   
> +	config STM32F4_DEBUG_UART
> +		bool "Use STM32F4 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  If unsure, say N.
> +
> +	config STM32F7_DEBUG_UART
> +		bool "Use STM32F7 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  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
> @@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
>   	bool
>   	depends on ARCH_STI
>   
> +config DEBUG_STM32_UART
> +	bool
> +	depends on ARCH_STM32
> +
>   config DEBUG_SIRFSOC_UART
>   	bool
>   	depends on ARCH_SIRF
> @@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
>   	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
>   	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
>   	default "debug/sti.S" if DEBUG_STI_UART
> +	default "debug/stm32.S" if DEBUG_STM32_UART
>   	default "debug/tegra.S" if DEBUG_TEGRA_UART
>   	default "debug/ux500.S" if DEBUG_UX500_UART
>   	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
> diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
> new file mode 100644
> index 0000000..4015257
> --- /dev/null
> +++ b/arch/arm/include/debug/stm32.S
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author: Gerald Baeza <gerald_baeza@st.com>
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#define STM32_UART_BASE			0x40011000	/* USART1 */
> +
> +#ifdef CONFIG_STM32F4_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x00
> +#define STM32_USART_TDR_OFF		0x04
> +#endif
> +
> +#ifdef CONFIG_STM32F7_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x1C
> +#define STM32_USART_TDR_OFF		0x28
> +#endif
> +
> +#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
> +#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 */
> +		.endm
> +
> +                .macro  senduart,rd,rx
> +                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
> +                .endm
> +
> +                .macro  waituart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
> +	beq	1001b
> +                .endm
> +
> +                .macro  busyuart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
> +	beq	1001b
> +                .endm
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ARM: debug: add stm32 low-level debug support
  2017-12-04 13:32 ` Ludovic Barre
@ 2017-12-11  9:28   ` Neil Armstrong
  -1 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2017-12-11  9:28 UTC (permalink / raw)
  To: Ludovic Barre, Russell King
  Cc: Alexandre Torgue, linux-kernel, Maxime Coquelin, Gerald Baeza,
	linux-arm-kernel

On 04/12/2017 14:32, Ludovic Barre wrote:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> This adds low-level debug support on USART1 for STM32F4
> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
> Enabled via 'earlyprintk' in bootargs.
> 
> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>

Hi Ludovic,

Please also add your sign-off here.

Neil

> ---
>  arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
>  arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+)
>  create mode 100644 arch/arm/include/debug/stm32.S
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 17685e1..9469c58 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1140,6 +1140,26 @@ choice
>  
>  		  If unsure, say N.
>  
> +	config STM32F4_DEBUG_UART
> +		bool "Use STM32F4 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  If unsure, say N.
> +
> +	config STM32F7_DEBUG_UART
> +		bool "Use STM32F7 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  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
> @@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
>  	bool
>  	depends on ARCH_STI
>  
> +config DEBUG_STM32_UART
> +	bool
> +	depends on ARCH_STM32
> +
>  config DEBUG_SIRFSOC_UART
>  	bool
>  	depends on ARCH_SIRF
> @@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
>  	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
>  	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
>  	default "debug/sti.S" if DEBUG_STI_UART
> +	default "debug/stm32.S" if DEBUG_STM32_UART
>  	default "debug/tegra.S" if DEBUG_TEGRA_UART
>  	default "debug/ux500.S" if DEBUG_UX500_UART
>  	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
> diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
> new file mode 100644
> index 0000000..4015257
> --- /dev/null
> +++ b/arch/arm/include/debug/stm32.S
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author: Gerald Baeza <gerald_baeza@st.com>
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#define STM32_UART_BASE			0x40011000	/* USART1 */
> +
> +#ifdef CONFIG_STM32F4_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x00
> +#define STM32_USART_TDR_OFF		0x04
> +#endif
> +
> +#ifdef CONFIG_STM32F7_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x1C
> +#define STM32_USART_TDR_OFF		0x28
> +#endif
> +
> +#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
> +#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 */
> +		.endm
> +
> +                .macro  senduart,rd,rx
> +                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
> +                .endm
> +
> +                .macro  waituart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
> +	beq	1001b
> +                .endm
> +
> +                .macro  busyuart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
> +	beq	1001b
> +                .endm
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-11  9:28   ` Neil Armstrong
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2017-12-11  9:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/12/2017 14:32, Ludovic Barre wrote:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> This adds low-level debug support on USART1 for STM32F4
> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
> Enabled via 'earlyprintk' in bootargs.
> 
> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>

Hi Ludovic,

Please also add your sign-off here.

Neil

> ---
>  arch/arm/Kconfig.debug         | 25 +++++++++++++++++++++++++
>  arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+)
>  create mode 100644 arch/arm/include/debug/stm32.S
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 17685e1..9469c58 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1140,6 +1140,26 @@ choice
>  
>  		  If unsure, say N.
>  
> +	config STM32F4_DEBUG_UART
> +		bool "Use STM32F4 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  If unsure, say N.
> +
> +	config STM32F7_DEBUG_UART
> +		bool "Use STM32F7 UART for low-level debug"
> +		depends on ARCH_STM32
> +		select DEBUG_STM32_UART
> +		help
> +		  Say Y here if you want kernel low-level debugging support
> +		  on STM32 based platforms.
> +
> +		  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
> @@ -1424,6 +1444,10 @@ config DEBUG_STI_UART
>  	bool
>  	depends on ARCH_STI
>  
> +config DEBUG_STM32_UART
> +	bool
> +	depends on ARCH_STM32
> +
>  config DEBUG_SIRFSOC_UART
>  	bool
>  	depends on ARCH_SIRF
> @@ -1472,6 +1496,7 @@ config DEBUG_LL_INCLUDE
>  	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
>  	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
>  	default "debug/sti.S" if DEBUG_STI_UART
> +	default "debug/stm32.S" if DEBUG_STM32_UART
>  	default "debug/tegra.S" if DEBUG_TEGRA_UART
>  	default "debug/ux500.S" if DEBUG_UX500_UART
>  	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
> diff --git a/arch/arm/include/debug/stm32.S b/arch/arm/include/debug/stm32.S
> new file mode 100644
> index 0000000..4015257
> --- /dev/null
> +++ b/arch/arm/include/debug/stm32.S
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author: Gerald Baeza <gerald_baeza@st.com>
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#define STM32_UART_BASE			0x40011000	/* USART1 */
> +
> +#ifdef CONFIG_STM32F4_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x00
> +#define STM32_USART_TDR_OFF		0x04
> +#endif
> +
> +#ifdef CONFIG_STM32F7_DEBUG_UART
> +#define STM32_USART_SR_OFF		0x1C
> +#define STM32_USART_TDR_OFF		0x28
> +#endif
> +
> +#define STM32_USART_TC			(1 << 6)	/* Tx complete       */
> +#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 */
> +		.endm
> +
> +                .macro  senduart,rd,rx
> +                strb    \rd, [\rx, #STM32_USART_TDR_OFF]
> +                .endm
> +
> +                .macro  waituart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TXE			@ TXE = 1 = tx empty
> +	beq	1001b
> +                .endm
> +
> +                .macro  busyuart,rd,rx
> +1001:	ldr	\rd, [\rx, #(STM32_USART_SR_OFF)]	@ Read Status Register
> +	tst	\rd, #STM32_USART_TC			@ TC = 1 = tx complete
> +	beq	1001b
> +                .endm
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ARM: debug: add stm32 low-level debug support
  2017-12-11  9:08   ` Alexandre Torgue
@ 2017-12-11  9:33     ` Philippe Ombredanne
  -1 siblings, 0 replies; 10+ messages in thread
From: Philippe Ombredanne @ 2017-12-11  9:33 UTC (permalink / raw)
  To: Ludovic Barre
  Cc: Alexandre Torgue, Russell King, Maxime Coquelin,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, LKML,
	Gerald Baeza

Ludovic,

On Mon, Dec 11, 2017 at 10:08 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Ludovic
>
> On 12/04/2017 02:32 PM, Ludovic Barre wrote:
>>
>> From: Ludovic Barre <ludovic.barre@st.com>
>>
>> This adds low-level debug support on USART1 for STM32F4
>> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
>> Enabled via 'earlyprintk' in bootargs.
>>
>> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
>
>
> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

[...]

>> --- /dev/null
>> +++ b/arch/arm/include/debug/stm32.S
>> @@ -0,0 +1,41 @@
>> +/*
>> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
>> + * Author: Gerald Baeza <gerald_baeza@st.com>
>> + * License terms:  GNU General Public License (GPL), version 2

Have you considered using the new SPDX ids? See THomas doc patches for details.
-- 
Cordially
Philippe Ombredanne

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-11  9:33     ` Philippe Ombredanne
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Ombredanne @ 2017-12-11  9:33 UTC (permalink / raw)
  To: linux-arm-kernel

Ludovic,

On Mon, Dec 11, 2017 at 10:08 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Ludovic
>
> On 12/04/2017 02:32 PM, Ludovic Barre wrote:
>>
>> From: Ludovic Barre <ludovic.barre@st.com>
>>
>> This adds low-level debug support on USART1 for STM32F4
>> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
>> Enabled via 'earlyprintk' in bootargs.
>>
>> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
>
>
> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>

[...]

>> --- /dev/null
>> +++ b/arch/arm/include/debug/stm32.S
>> @@ -0,0 +1,41 @@
>> +/*
>> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
>> + * Author: Gerald Baeza <gerald_baeza@st.com>
>> + * License terms:  GNU General Public License (GPL), version 2

Have you considered using the new SPDX ids? See THomas doc patches for details.
-- 
Cordially
Philippe Ombredanne

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ARM: debug: add stm32 low-level debug support
  2017-12-11  9:33     ` Philippe Ombredanne
@ 2017-12-11 10:22       ` Ludovic BARRE
  -1 siblings, 0 replies; 10+ messages in thread
From: Ludovic BARRE @ 2017-12-11 10:22 UTC (permalink / raw)
  To: Philippe Ombredanne
  Cc: Alexandre Torgue, Russell King, Maxime Coquelin,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, LKML,
	Gerald Baeza

Hi Neil, Philippe

thanks for review

I will send V2 with:
-my "signed-off"
-Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
-SPDX license
/* SPDX-License-Identifier: GPL-2.0 */

BR
Ludo

On 12/11/2017 10:33 AM, Philippe Ombredanne wrote:
> Ludovic,
> 
> On Mon, Dec 11, 2017 at 10:08 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi Ludovic
>>
>> On 12/04/2017 02:32 PM, Ludovic Barre wrote:
>>>
>>> From: Ludovic Barre <ludovic.barre@st.com>
>>>
>>> This adds low-level debug support on USART1 for STM32F4
>>> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
>>> Enabled via 'earlyprintk' in bootargs.
>>>
>>> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
>>
>>
>> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
> 
> [...]
> 
>>> --- /dev/null
>>> +++ b/arch/arm/include/debug/stm32.S
>>> @@ -0,0 +1,41 @@
>>> +/*
>>> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
>>> + * Author: Gerald Baeza <gerald_baeza@st.com>
>>> + * License terms:  GNU General Public License (GPL), version 2
> 
> Have you considered using the new SPDX ids? See THomas doc patches for details.
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] ARM: debug: add stm32 low-level debug support
@ 2017-12-11 10:22       ` Ludovic BARRE
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic BARRE @ 2017-12-11 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Neil, Philippe

thanks for review

I will send V2 with:
-my "signed-off"
-Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
-SPDX license
/* SPDX-License-Identifier: GPL-2.0 */

BR
Ludo

On 12/11/2017 10:33 AM, Philippe Ombredanne wrote:
> Ludovic,
> 
> On Mon, Dec 11, 2017 at 10:08 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi Ludovic
>>
>> On 12/04/2017 02:32 PM, Ludovic Barre wrote:
>>>
>>> From: Ludovic Barre <ludovic.barre@st.com>
>>>
>>> This adds low-level debug support on USART1 for STM32F4
>>> and STM32F7. Compiled via 'CONFIG_DEBUG_LL' and 'CONFIG_EARLY_PRINTK'.
>>> Enabled via 'earlyprintk' in bootargs.
>>>
>>> Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
>>
>>
>> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
> 
> [...]
> 
>>> --- /dev/null
>>> +++ b/arch/arm/include/debug/stm32.S
>>> @@ -0,0 +1,41 @@
>>> +/*
>>> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
>>> + * Author: Gerald Baeza <gerald_baeza@st.com>
>>> + * License terms:  GNU General Public License (GPL), version 2
> 
> Have you considered using the new SPDX ids? See THomas doc patches for details.
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-12-11 10:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-04 13:32 [PATCH] ARM: debug: add stm32 low-level debug support Ludovic Barre
2017-12-04 13:32 ` Ludovic Barre
2017-12-11  9:08 ` Alexandre Torgue
2017-12-11  9:08   ` Alexandre Torgue
2017-12-11  9:33   ` Philippe Ombredanne
2017-12-11  9:33     ` Philippe Ombredanne
2017-12-11 10:22     ` Ludovic BARRE
2017-12-11 10:22       ` Ludovic BARRE
2017-12-11  9:28 ` Neil Armstrong
2017-12-11  9:28   ` Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.