* [PATCH] ARM: lpc32xx: debug: add low-level debug support on hsuart
@ 2019-10-10 20:49 Alexandre Belloni
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-10-10 20:49 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: Sylvain Lemieux, Russell King, Arnd Bergmann, linux-arm-kernel,
linux-kernel, Alexandre Belloni
The lpc32xx has UARTs that are not 8250 compatible. Add support for low
level debugging on those high speed UARTs.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
arch/arm/Kconfig.debug | 18 +++++++++++++++---
arch/arm/include/debug/lpc32xx_hsuart.S | 24 ++++++++++++++++++++++++
2 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 arch/arm/include/debug/lpc32xx_hsuart.S
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8bcbd0cd739b..b95ce5d97946 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -523,7 +523,16 @@ choice
select DEBUG_UART_8250
help
Say Y here if you want kernel low-level debugging support
- on NXP LPC32xx based platforms.
+ on NXP LPC32xx based platforms using an INS16Cx50 compatible
+ UART.
+
+ config DEBUG_LPC32XX_HSUART
+ bool "Kernel low-level debugging messages via NXP LPC32xx High Speed UART"
+ depends on ARCH_LPC32XX
+ help
+ Say Y here if you want kernel low-level debugging support
+ on NXP LPC32xx based platforms using an high speed (14-clock)
+ UART.
config DEBUG_MESON_UARTAO
bool "Kernel low-level debugging via Meson6 UARTAO"
@@ -1540,6 +1549,7 @@ config DEBUG_LL_INCLUDE
DEBUG_IMX6SX_UART || \
DEBUG_IMX6UL_UART || \
DEBUG_IMX7D_UART
+ default "debug/lpc32xx_hsuart.S" if DEBUG_LPC32XX_HSUART
default "debug/msm.S" if DEBUG_QCOM_UARTDM
default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2
@@ -1619,6 +1629,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 0x40014000 if DEBUG_LPC32XX_HSUART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
default 0x40081000 if DEBUG_LPC18XX_UART0
default 0x40090000 if DEBUG_LPC32XX
@@ -1713,7 +1724,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_LPC32XX_HSUART
config DEBUG_UART_VIRT
hex "Virtual base address of debug UART"
@@ -1738,6 +1749,7 @@ config DEBUG_UART_VIRT
default 0xf1c28400 if DEBUG_SUNXI_UART1
default 0xf1f02800 if DEBUG_SUNXI_R_UART
default 0xf31004c0 if DEBUG_MESON_UARTAO
+ default 0xf4014000 if DEBUG_LPC32XX_HSUART
default 0xf4090000 if DEBUG_LPC32XX
default 0xf4200000 if DEBUG_GEMINI
default 0xf6200000 if DEBUG_PXA_UART1
@@ -1823,7 +1835,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_LPC32XX_HSUART
config DEBUG_UART_8250_SHIFT
int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/include/debug/lpc32xx_hsuart.S b/arch/arm/include/debug/lpc32xx_hsuart.S
new file mode 100644
index 000000000000..7f54bc2cc250
--- /dev/null
+++ b/arch/arm/include/debug/lpc32xx_hsuart.S
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#define LPC_HSU_TX (0x0)
+#define LPC_HSU_LEVEL (0x4)
+#define LPC_HSU_LEVEL_TX 0xFF00
+
+ .macro addruart, rp, rv, tmp
+ ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys address)
+ ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt address)
+ .endm
+
+ .macro senduart,rd,rx
+ str \rd, [\rx, #(LPC_HSU_TX)]
+ .endm
+
+ .macro waituart,rd,rx
+ .endm
+
+ .macro busyuart,rd,rx
+1001: ldr \rd, [\rx, #(LPC_HSU_LEVEL)]
+ ands \rd, \rd, LPC_HSU_LEVEL_TX
+ bne 1001b
+ .endm
+
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: lpc32xx: debug: add low-level debug support on hsuart
@ 2019-01-14 21:16 Alexandre Belloni
2019-01-14 21:27 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2019-01-14 21:16 UTC (permalink / raw)
To: Vladimir Zapolskiy, Sylvain Lemieux
Cc: Thomas Petazzoni, linux-arm-kernel, linux-kernel, Alexandre Belloni
The lpc32xx has UARTs that are not 8250 compatible. Add support for low
level debugging on those high speed UARTs.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
arch/arm/Kconfig.debug | 18 +++++++++++++++---
arch/arm/include/debug/lpc32xx_hsuart.S | 22 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 3 deletions(-)
create mode 100644 arch/arm/include/debug/lpc32xx_hsuart.S
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 6d6e0330930b..0d4d64f5d3b7 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -530,7 +530,16 @@ choice
select DEBUG_UART_8250
help
Say Y here if you want kernel low-level debugging support
- on NXP LPC32xx based platforms.
+ on NXP LPC32xx based platforms using an INS16Cx50 compatible
+ UART.
+
+ config DEBUG_LPC32XX_HSUART
+ bool "Kernel low-level debugging messages via NXP LPC32xx High Speed UART"
+ depends on ARCH_LPC32XX
+ help
+ Say Y here if you want kernel low-level debugging support
+ on NXP LPC32xx based platforms using an high speed (14-clock)
+ UART.
config DEBUG_MESON_UARTAO
bool "Kernel low-level debugging via Meson6 UARTAO"
@@ -1541,6 +1550,7 @@ config DEBUG_LL_INCLUDE
DEBUG_IMX6UL_UART || \
DEBUG_IMX7D_UART
default "debug/ks8695.S" if DEBUG_KS8695_UART
+ default "debug/lpc32xx_hsuart.S" if DEBUG_LPC32XX_HSUART
default "debug/msm.S" if DEBUG_QCOM_UARTDM
default "debug/netx.S" if DEBUG_NETX_UART
default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
@@ -1622,6 +1632,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 0x40014000 if DEBUG_LPC32XX_HSUART
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
default 0x40081000 if DEBUG_LPC18XX_UART0
default 0x40090000 if DEBUG_LPC32XX
@@ -1716,7 +1727,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_LPC32XX_HSUART
config DEBUG_UART_VIRT
hex "Virtual base address of debug UART"
@@ -1741,6 +1752,7 @@ config DEBUG_UART_VIRT
default 0xf1c28400 if DEBUG_SUNXI_UART1
default 0xf1f02800 if DEBUG_SUNXI_R_UART
default 0xf31004c0 if DEBUG_MESON_UARTAO
+ default 0xf4014000 if DEBUG_LPC32XX_HSUART
default 0xf4090000 if DEBUG_LPC32XX
default 0xf4200000 if DEBUG_GEMINI
default 0xf6200000 if DEBUG_PXA_UART1
@@ -1832,7 +1844,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_LPC32XX_HSUART
config DEBUG_UART_8250_SHIFT
int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/include/debug/lpc32xx_hsuart.S b/arch/arm/include/debug/lpc32xx_hsuart.S
new file mode 100644
index 000000000000..e0205368c6ff
--- /dev/null
+++ b/arch/arm/include/debug/lpc32xx_hsuart.S
@@ -0,0 +1,22 @@
+#define LPC_HSU_TX (0x0)
+#define LPC_HSU_LEVEL (0x4)
+#define LPC_HSU_LEVEL_TX 0xFF00
+
+ .macro addruart, rp, rv, tmp
+ ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys address)
+ ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt address)
+ .endm
+
+ .macro senduart,rd,rx
+ str \rd, [\rx, #(LPC_HSU_TX)]
+ .endm
+
+ .macro waituart,rd,rx
+ .endm
+
+ .macro busyuart,rd,rx
+1001: ldr \rd, [\rx, #(LPC_HSU_LEVEL)]
+ ands \rd, \rd, LPC_HSU_LEVEL_TX
+ bne 1001b
+ .endm
+
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: lpc32xx: debug: add low-level debug support on hsuart
2019-01-14 21:16 Alexandre Belloni
@ 2019-01-14 21:27 ` Alexandre Belloni
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-01-14 21:27 UTC (permalink / raw)
To: Vladimir Zapolskiy, Sylvain Lemieux
Cc: Thomas Petazzoni, linux-arm-kernel, linux-kernel
On 14/01/2019 22:16:23+0100, Alexandre Belloni wrote:
> The lpc32xx has UARTs that are not 8250 compatible. Add support for low
> level debugging on those high speed UARTs.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> arch/arm/Kconfig.debug | 18 +++++++++++++++---
> arch/arm/include/debug/lpc32xx_hsuart.S | 22 ++++++++++++++++++++++
> 2 files changed, 37 insertions(+), 3 deletions(-)
> create mode 100644 arch/arm/include/debug/lpc32xx_hsuart.S
>
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 6d6e0330930b..0d4d64f5d3b7 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -530,7 +530,16 @@ choice
> select DEBUG_UART_8250
> help
> Say Y here if you want kernel low-level debugging support
> - on NXP LPC32xx based platforms.
> + on NXP LPC32xx based platforms using an INS16Cx50 compatible
> + UART.
> +
> + config DEBUG_LPC32XX_HSUART
> + bool "Kernel low-level debugging messages via NXP LPC32xx High Speed UART"
> + depends on ARCH_LPC32XX
> + help
> + Say Y here if you want kernel low-level debugging support
> + on NXP LPC32xx based platforms using an high speed (14-clock)
> + UART.
>
> config DEBUG_MESON_UARTAO
> bool "Kernel low-level debugging via Meson6 UARTAO"
> @@ -1541,6 +1550,7 @@ config DEBUG_LL_INCLUDE
> DEBUG_IMX6UL_UART || \
> DEBUG_IMX7D_UART
> default "debug/ks8695.S" if DEBUG_KS8695_UART
> + default "debug/lpc32xx_hsuart.S" if DEBUG_LPC32XX_HSUART
> default "debug/msm.S" if DEBUG_QCOM_UARTDM
> default "debug/netx.S" if DEBUG_NETX_UART
> default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
> @@ -1622,6 +1632,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 0x40014000 if DEBUG_LPC32XX_HSUART
> default 0x40028000 if DEBUG_AT91_SAMV7_USART1
> default 0x40081000 if DEBUG_LPC18XX_UART0
> default 0x40090000 if DEBUG_LPC32XX
> @@ -1716,7 +1727,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_LPC32XX_HSUART
>
> config DEBUG_UART_VIRT
> hex "Virtual base address of debug UART"
> @@ -1741,6 +1752,7 @@ config DEBUG_UART_VIRT
> default 0xf1c28400 if DEBUG_SUNXI_UART1
> default 0xf1f02800 if DEBUG_SUNXI_R_UART
> default 0xf31004c0 if DEBUG_MESON_UARTAO
> + default 0xf4014000 if DEBUG_LPC32XX_HSUART
> default 0xf4090000 if DEBUG_LPC32XX
> default 0xf4200000 if DEBUG_GEMINI
> default 0xf6200000 if DEBUG_PXA_UART1
> @@ -1832,7 +1844,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_LPC32XX_HSUART
>
> config DEBUG_UART_8250_SHIFT
> int "Register offset shift for the 8250 debug UART"
> diff --git a/arch/arm/include/debug/lpc32xx_hsuart.S b/arch/arm/include/debug/lpc32xx_hsuart.S
> new file mode 100644
> index 000000000000..e0205368c6ff
> --- /dev/null
> +++ b/arch/arm/include/debug/lpc32xx_hsuart.S
> @@ -0,0 +1,22 @@
I just realized I forgot to add the SPDX identifier, I'll send a v2 in a
few days.
> +#define LPC_HSU_TX (0x0)
> +#define LPC_HSU_LEVEL (0x4)
> +#define LPC_HSU_LEVEL_TX 0xFF00
> +
> + .macro addruart, rp, rv, tmp
> + ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys address)
> + ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt address)
> + .endm
> +
> + .macro senduart,rd,rx
> + str \rd, [\rx, #(LPC_HSU_TX)]
> + .endm
> +
> + .macro waituart,rd,rx
> + .endm
> +
> + .macro busyuart,rd,rx
> +1001: ldr \rd, [\rx, #(LPC_HSU_LEVEL)]
> + ands \rd, \rd, LPC_HSU_LEVEL_TX
> + bne 1001b
> + .endm
> +
> --
> 2.20.1
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-10 20:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 20:49 [PATCH] ARM: lpc32xx: debug: add low-level debug support on hsuart Alexandre Belloni
-- strict thread matches above, loose matches on Subject: below --
2019-01-14 21:16 Alexandre Belloni
2019-01-14 21:27 ` Alexandre Belloni
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).