linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add support for low-level debug on STM32
@ 2017-07-27 16:50 Bich HEMON
  2017-07-27 16:50 ` [PATCH] ARM: stm32: debug: add low-level debug support Bich HEMON
  0 siblings, 1 reply; 8+ messages in thread
From: Bich HEMON @ 2017-07-27 16:50 UTC (permalink / raw)
  To: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel
  Cc: Bich HEMON

This patch adds low-level debug support on USART1 for STM32F4 and STM32F7.

Gerald Baeza (1):
  ARM: stm32: debug: add low-level debug support

 arch/arm/Kconfig.debug         | 27 +++++++++++++++++++++++++++
 arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 arch/arm/include/debug/stm32.S

-- 
1.9.1

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

* [PATCH] ARM: stm32: debug: add low-level debug support
  2017-07-27 16:50 [PATCH] Add support for low-level debug on STM32 Bich HEMON
@ 2017-07-27 16:50 ` Bich HEMON
  2018-11-12 18:22   ` Olof Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Bich HEMON @ 2017-07-27 16:50 UTC (permalink / raw)
  To: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel
  Cc: Bich HEMON

From: Gerald Baeza <gerald.baeza@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>
Signed-off-by: Bich Hemon <bich.hemon@st.com>
---
 arch/arm/Kconfig.debug         | 27 +++++++++++++++++++++++++++
 arch/arm/include/debug/stm32.S | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 arch/arm/include/debug/stm32.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 447629d..0b6e61e 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1126,6 +1126,28 @@ 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 STM32F4 based platforms, which default UART is wired on
+		  USART1.
+
+		  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 STM32F7 based platforms, which default UART is wired on
+		  USART1.
+
+		  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
@@ -1410,6 +1432,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
@@ -1457,6 +1483,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..1e060a5
--- /dev/null
+++ b/arch/arm/include/debug/stm32.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2017
+ * 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
-- 
1.9.1

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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2017-07-27 16:50 ` [PATCH] ARM: stm32: debug: add low-level debug support Bich HEMON
@ 2018-11-12 18:22   ` Olof Johansson
  2018-11-13  9:16     ` Bich HEMON
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2018-11-12 18:22 UTC (permalink / raw)
  To: Bich HEMON
  Cc: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel

On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
> From: Gerald Baeza <gerald.baeza@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>
> Signed-off-by: Bich Hemon <bich.hemon@st.com>

Hi,

This had fallen between the chairs it seems. I have applied it to arm-soc
next/soc now, for 4.21 merge window.

It ended up being patched up manually to consolidate the version in
Russell's patch tracker with this posted version, and I tweaked whitespace
a bit. Let me know if I missed something.


Thanks,

-Olof


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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2018-11-12 18:22   ` Olof Johansson
@ 2018-11-13  9:16     ` Bich HEMON
  2018-11-13  9:24       ` Russell King - ARM Linux
  0 siblings, 1 reply; 8+ messages in thread
From: Bich HEMON @ 2018-11-13  9:16 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel, Ludovic BARRE


On 11/12/18 7:22 PM, Olof Johansson wrote:
> On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
>> From: Gerald Baeza <gerald.baeza@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>
>> Signed-off-by: Bich Hemon <bich.hemon@st.com>
> 
> Hi,
> 
> This had fallen between the chairs it seems. I have applied it to arm-soc
> next/soc now, for 4.21 merge window.
> 
> It ended up being patched up manually to consolidate the version in
> Russell's patch tracker with this posted version, and I tweaked whitespace
> a bit. Let me know if I missed something.
> 
> 
> Thanks,
> 
> -Olof
> 

Hi Olof,

Please note that this patch has to be abandoned as Ludovic BARRE pushed 
a new version of this change:
https://patchwork.codeaurora.org/patch/400563/

You can find it in Russell's tracker here:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8803/1

Best regards,

Bich

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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2018-11-13  9:16     ` Bich HEMON
@ 2018-11-13  9:24       ` Russell King - ARM Linux
  2018-11-13 10:16         ` Bich HEMON
  0 siblings, 1 reply; 8+ messages in thread
From: Russell King - ARM Linux @ 2018-11-13  9:24 UTC (permalink / raw)
  To: Bich HEMON
  Cc: Olof Johansson, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel, Ludovic BARRE

On Tue, Nov 13, 2018 at 09:16:16AM +0000, Bich HEMON wrote:
> 
> On 11/12/18 7:22 PM, Olof Johansson wrote:
> > On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
> >> From: Gerald Baeza <gerald.baeza@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>
> >> Signed-off-by: Bich Hemon <bich.hemon@st.com>
> > 
> > Hi,
> > 
> > This had fallen between the chairs it seems. I have applied it to arm-soc
> > next/soc now, for 4.21 merge window.
> > 
> > It ended up being patched up manually to consolidate the version in
> > Russell's patch tracker with this posted version, and I tweaked whitespace
> > a bit. Let me know if I missed something.
> > 
> > 
> > Thanks,
> > 
> > -Olof
> > 
> 
> Hi Olof,
> 
> Please note that this patch has to be abandoned as Ludovic BARRE pushed 
> a new version of this change:
> https://patchwork.codeaurora.org/patch/400563/
> 
> You can find it in Russell's tracker here:
> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8803/1

And I'm not going to merge that because:

1) it's not for me to merge - it doesn't go through my tree, but through
   arm-soc, which Olof and Arnd manage.
2) it's not been on the mailing list as per normal submission process.

Sorry.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2018-11-13  9:24       ` Russell King - ARM Linux
@ 2018-11-13 10:16         ` Bich HEMON
  2018-11-13 19:02           ` Olof Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Bich HEMON @ 2018-11-13 10:16 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Olof Johansson, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	linux-arm-kernel, linux-kernel, Ludovic BARRE



On 11/13/18 10:24 AM, Russell King - ARM Linux wrote:
> On Tue, Nov 13, 2018 at 09:16:16AM +0000, Bich HEMON wrote:
>>
>> On 11/12/18 7:22 PM, Olof Johansson wrote:
>>> On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
>>>> From: Gerald Baeza <gerald.baeza@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>
>>>> Signed-off-by: Bich Hemon <bich.hemon@st.com>
>>>
>>> Hi,
>>>
>>> This had fallen between the chairs it seems. I have applied it to arm-soc
>>> next/soc now, for 4.21 merge window.
>>>
>>> It ended up being patched up manually to consolidate the version in
>>> Russell's patch tracker with this posted version, and I tweaked whitespace
>>> a bit. Let me know if I missed something.
>>>
>>>
>>> Thanks,
>>>
>>> -Olof
>>>
>>
>> Hi Olof,
>>
>> Please note that this patch has to be abandoned as Ludovic BARRE pushed
>> a new version of this change:
>> https://patchwork.codeaurora.org/patch/400563/
>>
>> You can find it in Russell's tracker here:
>> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8803/1
> 
> And I'm not going to merge that because:
> 
> 1) it's not for me to merge - it doesn't go through my tree, but through
>     arm-soc, which Olof and Arnd manage.
> 2) it's not been on the mailing list as per normal submission process.
> 
> Sorry.
> 

Ok, thank you for the feedback.

So Olof, can you please ignore my previous email and merge my patch as 
you proposed it for 4.21. Ludovic's patch will be abandoned instead.

Thanks,

Bich

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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2018-11-13 10:16         ` Bich HEMON
@ 2018-11-13 19:02           ` Olof Johansson
  2018-11-14 10:20             ` Bich HEMON
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2018-11-13 19:02 UTC (permalink / raw)
  To: Bich HEMON
  Cc: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	Linux ARM Mailing List, Linux Kernel Mailing List, Ludovic Barre

Take a look at the patch I merged, and please follow up with any patch
to fixup any issue you find with it.

As mentioned in my original email, I tried to consolidate the two
versions, so a look-through and follow up with fixes would be
appreciated. Thanks!


-Olof

On Tue, Nov 13, 2018 at 2:17 AM Bich HEMON <bich.hemon@st.com> wrote:
>
>
>
> On 11/13/18 10:24 AM, Russell King - ARM Linux wrote:
> > On Tue, Nov 13, 2018 at 09:16:16AM +0000, Bich HEMON wrote:
> >>
> >> On 11/12/18 7:22 PM, Olof Johansson wrote:
> >>> On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
> >>>> From: Gerald Baeza <gerald.baeza@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>
> >>>> Signed-off-by: Bich Hemon <bich.hemon@st.com>
> >>>
> >>> Hi,
> >>>
> >>> This had fallen between the chairs it seems. I have applied it to arm-soc
> >>> next/soc now, for 4.21 merge window.
> >>>
> >>> It ended up being patched up manually to consolidate the version in
> >>> Russell's patch tracker with this posted version, and I tweaked whitespace
> >>> a bit. Let me know if I missed something.
> >>>
> >>>
> >>> Thanks,
> >>>
> >>> -Olof
> >>>
> >>
> >> Hi Olof,
> >>
> >> Please note that this patch has to be abandoned as Ludovic BARRE pushed
> >> a new version of this change:
> >> https://patchwork.codeaurora.org/patch/400563/
> >>
> >> You can find it in Russell's tracker here:
> >> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8803/1
> >
> > And I'm not going to merge that because:
> >
> > 1) it's not for me to merge - it doesn't go through my tree, but through
> >     arm-soc, which Olof and Arnd manage.
> > 2) it's not been on the mailing list as per normal submission process.
> >
> > Sorry.
> >
>
> Ok, thank you for the feedback.
>
> So Olof, can you please ignore my previous email and merge my patch as
> you proposed it for 4.21. Ludovic's patch will be abandoned instead.
>
> Thanks,
>
> Bich

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

* Re: [PATCH] ARM: stm32: debug: add low-level debug support
  2018-11-13 19:02           ` Olof Johansson
@ 2018-11-14 10:20             ` Bich HEMON
  0 siblings, 0 replies; 8+ messages in thread
From: Bich HEMON @ 2018-11-14 10:20 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Russell King, Maxime Coquelin, Alexandre TORGUE, Gerald BAEZA,
	Linux ARM Mailing List, Linux Kernel Mailing List, Ludovic BARRE

Hi Olof,

I had a look at your next branch and no fix is required as you corrected 
it all by consolidating Ludovic's version with mine.

Thanks a lot!

Bich

On 11/13/18 8:02 PM, Olof Johansson wrote:
> Take a look at the patch I merged, and please follow up with any patch
> to fixup any issue you find with it.
> 
> As mentioned in my original email, I tried to consolidate the two
> versions, so a look-through and follow up with fixes would be
> appreciated. Thanks!
> 
> 
> -Olof
> 
> On Tue, Nov 13, 2018 at 2:17 AM Bich HEMON <bich.hemon@st.com> wrote:
>>
>>
>>
>> On 11/13/18 10:24 AM, Russell King - ARM Linux wrote:
>>> On Tue, Nov 13, 2018 at 09:16:16AM +0000, Bich HEMON wrote:
>>>>
>>>> On 11/12/18 7:22 PM, Olof Johansson wrote:
>>>>> On Thu, Jul 27, 2017 at 04:50:20PM +0000, Bich HEMON wrote:
>>>>>> From: Gerald Baeza <gerald.baeza@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>
>>>>>> Signed-off-by: Bich Hemon <bich.hemon@st.com>
>>>>>
>>>>> Hi,
>>>>>
>>>>> This had fallen between the chairs it seems. I have applied it to arm-soc
>>>>> next/soc now, for 4.21 merge window.
>>>>>
>>>>> It ended up being patched up manually to consolidate the version in
>>>>> Russell's patch tracker with this posted version, and I tweaked whitespace
>>>>> a bit. Let me know if I missed something.
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> -Olof
>>>>>
>>>>
>>>> Hi Olof,
>>>>
>>>> Please note that this patch has to be abandoned as Ludovic BARRE pushed
>>>> a new version of this change:
>>>> https://patchwork.codeaurora.org/patch/400563/
>>>>
>>>> You can find it in Russell's tracker here:
>>>> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8803/1
>>>
>>> And I'm not going to merge that because:
>>>
>>> 1) it's not for me to merge - it doesn't go through my tree, but through
>>>      arm-soc, which Olof and Arnd manage.
>>> 2) it's not been on the mailing list as per normal submission process.
>>>
>>> Sorry.
>>>
>>
>> Ok, thank you for the feedback.
>>
>> So Olof, can you please ignore my previous email and merge my patch as
>> you proposed it for 4.21. Ludovic's patch will be abandoned instead.
>>
>> Thanks,
>>
>> Bich

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

end of thread, other threads:[~2018-11-14 10:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 16:50 [PATCH] Add support for low-level debug on STM32 Bich HEMON
2017-07-27 16:50 ` [PATCH] ARM: stm32: debug: add low-level debug support Bich HEMON
2018-11-12 18:22   ` Olof Johansson
2018-11-13  9:16     ` Bich HEMON
2018-11-13  9:24       ` Russell King - ARM Linux
2018-11-13 10:16         ` Bich HEMON
2018-11-13 19:02           ` Olof Johansson
2018-11-14 10:20             ` Bich HEMON

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).