* [PATCH v1 0/2] arm: npcm: add low-level debug support for NPCM7XX @ 2018-02-12 20:58 Brendan Higgins 2018-02-12 20:58 ` [PATCH v1 1/2] " Brendan Higgins 2018-02-12 20:58 ` [PATCH v1 2/2] MAINTAINERS: Add low-level debug files to Nuvoton NPCM section Brendan Higgins 0 siblings, 2 replies; 5+ messages in thread From: Brendan Higgins @ 2018-02-12 20:58 UTC (permalink / raw) To: linux, avifishman70, tmaimon77, venture, yuenn Cc: linux-kernel, linux-arm-kernel, openbmc Adds low-level debug support for Nuvoton's NPCM7XX architecture. Change has been tested on Nuvoton's NPCM750 EVB. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] arm: npcm: add low-level debug support for NPCM7XX 2018-02-12 20:58 [PATCH v1 0/2] arm: npcm: add low-level debug support for NPCM7XX Brendan Higgins @ 2018-02-12 20:58 ` Brendan Higgins 2018-02-13 1:59 ` Joel Stanley 2018-02-12 20:58 ` [PATCH v1 2/2] MAINTAINERS: Add low-level debug files to Nuvoton NPCM section Brendan Higgins 1 sibling, 1 reply; 5+ messages in thread From: Brendan Higgins @ 2018-02-12 20:58 UTC (permalink / raw) To: linux, avifishman70, tmaimon77, venture, yuenn Cc: linux-kernel, linux-arm-kernel, openbmc, Brendan Higgins Enable low-level debug support for Nuvoton NPCM7XX family by adding the debug port definitions for the SoC. Signed-off-by: Brendan Higgins <brendanhiggins@google.com> --- arch/arm/Kconfig.debug | 11 +++++++++++ arch/arm/include/debug/npcm7xx.S | 30 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 arch/arm/include/debug/npcm7xx.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 447629d89884..d8f925cb8872 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -595,6 +595,12 @@ choice Say Y here if you want kernel low-level debugging support on Hilscher NetX based platforms. + config DEBUG_NPCM7XX_UART + bool "Kernel low-level debugging messages via Nuvoton NPCMx50 UART" + help + Say Y here if you want kernel low-level debugging support + on Nuvoton based platforms. + config DEBUG_NOMADIK_UART bool "Kernel low-level debugging messages via NOMADIK UART" depends on ARCH_NOMADIK @@ -1444,6 +1450,7 @@ config DEBUG_LL_INCLUDE default "debug/ks8695.S" if DEBUG_KS8695_UART default "debug/msm.S" if DEBUG_QCOM_UARTDM default "debug/netx.S" if DEBUG_NETX_UART + default "debug/npcm7xx.S" if DEBUG_NPCM7XX_UART default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0 @@ -1481,6 +1488,7 @@ config DEBUG_UART_8250 config DEBUG_UART_PHYS hex "Physical base address of debug UART" default 0x00100a00 if DEBUG_NETX_UART + default 0xf0004000 if DEBUG_NPCM7XX_UART default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0 default 0x01c28000 if DEBUG_SUNXI_UART0 default 0x01c28400 if DEBUG_SUNXI_UART1 @@ -1589,6 +1597,7 @@ config DEBUG_UART_PHYS DEBUG_LL_UART_EFM32 || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_NETX_UART || \ + DEBUG_NPCM7XX_UART || \ DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ @@ -1605,6 +1614,7 @@ config DEBUG_UART_VIRT default 0xc8821000 if DEBUG_RV1108_UART1 default 0xc8912000 if DEBUG_RV1108_UART0 default 0xe0000a00 if DEBUG_NETX_UART + default 0xf0001000 if DEBUG_NPCM7XX_UART default 0xe0010fe0 if ARCH_RPC default 0xf0000be0 if ARCH_EBSA110 default 0xf0010000 if DEBUG_ASM9260_UART @@ -1695,6 +1705,7 @@ config DEBUG_UART_VIRT depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_NETX_UART || \ + DEBUG_NPCM7XX_UART || \ DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ DEBUG_S3C64XX_UART || \ DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ diff --git a/arch/arm/include/debug/npcm7xx.S b/arch/arm/include/debug/npcm7xx.S new file mode 100644 index 000000000000..d08e14e73d79 --- /dev/null +++ b/arch/arm/include/debug/npcm7xx.S @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright 2018 Google, Inc. +// This is heavily based on arch/arm/include/debug/at91.S + +#define NPCM7XX_SR (0x14) /* Status Register */ +#define NPCM7XX_THR (0x00) /* Transmitter Holding Register */ +#define NPCM7XX_TXRDY (1 << 6) /* Transmitter Ready */ +#define NPCM7XX_TXEMPTY (1 << 6) /* Transmitter Empty */ + + .macro addruart, rp, rv, tmp + ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys) + ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt) + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #(NPCM7XX_THR)] @ Write to Transmit Holding Reg + .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #(NPCM7XX_SR)] @ Read Status Register + tst \rd, #NPCM7XX_TXRDY @ TXRDY = 1 when ready to tx + beq 1001b + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #(NPCM7XX_SR)] @ Read Status Register + tst \rd, #NPCM7XX_TXEMPTY @ TXEMPTY = 1 when tx complete + beq 1001b + .endm + -- 2.16.0.rc1.238.g530d649a79-goog ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] arm: npcm: add low-level debug support for NPCM7XX 2018-02-12 20:58 ` [PATCH v1 1/2] " Brendan Higgins @ 2018-02-13 1:59 ` Joel Stanley 2018-02-13 2:08 ` Brendan Higgins 0 siblings, 1 reply; 5+ messages in thread From: Joel Stanley @ 2018-02-13 1:59 UTC (permalink / raw) To: Brendan Higgins, Jeremy Kerr Cc: Russell King, Avi Fishman, Tomer Maimon, Patrick Venture, Nancy Yuen, OpenBMC Maillist, Linux Kernel Mailing List, Linux ARM Hi Brendan, On Tue, Feb 13, 2018 at 7:28 AM, Brendan Higgins <brendanhiggins@google.com> wrote: > Enable low-level debug support for Nuvoton NPCM7XX family by adding the > debug port definitions for the SoC. When playing with the Poleg boards at the recent OpenBMC hackathon Jeremy discovered that the UART is a normal-ish 8250, with a custom divisor and a few extra bits to be set. I found that we can us the generic 8250 low level debugging support just fine. This is because u-boot sets up the divisor settings for us (as you've assumed with your version here), and from there it's just reading/writing characters. Assuming you can reproduce our results, I suggest we drop these patches in favour of adding the correct configuration the Poleg. Cheers, Joel > > Signed-off-by: Brendan Higgins <brendanhiggins@google.com> > --- > arch/arm/Kconfig.debug | 11 +++++++++++ > arch/arm/include/debug/npcm7xx.S | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 41 insertions(+) > create mode 100644 arch/arm/include/debug/npcm7xx.S > > diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug > index 447629d89884..d8f925cb8872 100644 > --- a/arch/arm/Kconfig.debug > +++ b/arch/arm/Kconfig.debug > @@ -595,6 +595,12 @@ choice > Say Y here if you want kernel low-level debugging support > on Hilscher NetX based platforms. > > + config DEBUG_NPCM7XX_UART > + bool "Kernel low-level debugging messages via Nuvoton NPCMx50 UART" > + help > + Say Y here if you want kernel low-level debugging support > + on Nuvoton based platforms. > + > config DEBUG_NOMADIK_UART > bool "Kernel low-level debugging messages via NOMADIK UART" > depends on ARCH_NOMADIK > @@ -1444,6 +1450,7 @@ config DEBUG_LL_INCLUDE > default "debug/ks8695.S" if DEBUG_KS8695_UART > default "debug/msm.S" if DEBUG_QCOM_UARTDM > default "debug/netx.S" if DEBUG_NETX_UART > + default "debug/npcm7xx.S" if DEBUG_NPCM7XX_UART > default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART > default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2 > default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0 > @@ -1481,6 +1488,7 @@ config DEBUG_UART_8250 > config DEBUG_UART_PHYS > hex "Physical base address of debug UART" > default 0x00100a00 if DEBUG_NETX_UART > + default 0xf0004000 if DEBUG_NPCM7XX_UART > default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0 > default 0x01c28000 if DEBUG_SUNXI_UART0 > default 0x01c28400 if DEBUG_SUNXI_UART1 > @@ -1589,6 +1597,7 @@ config DEBUG_UART_PHYS > DEBUG_LL_UART_EFM32 || \ > DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ > DEBUG_NETX_UART || \ > + DEBUG_NPCM7XX_UART || \ > DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ > DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ > DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ > @@ -1605,6 +1614,7 @@ config DEBUG_UART_VIRT > default 0xc8821000 if DEBUG_RV1108_UART1 > default 0xc8912000 if DEBUG_RV1108_UART0 > default 0xe0000a00 if DEBUG_NETX_UART > + default 0xf0001000 if DEBUG_NPCM7XX_UART > default 0xe0010fe0 if ARCH_RPC > default 0xf0000be0 if ARCH_EBSA110 > default 0xf0010000 if DEBUG_ASM9260_UART > @@ -1695,6 +1705,7 @@ config DEBUG_UART_VIRT > depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ > DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ > DEBUG_NETX_UART || \ > + DEBUG_NPCM7XX_UART || \ > DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ > DEBUG_S3C64XX_UART || \ > DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ > diff --git a/arch/arm/include/debug/npcm7xx.S b/arch/arm/include/debug/npcm7xx.S > new file mode 100644 > index 000000000000..d08e14e73d79 > --- /dev/null > +++ b/arch/arm/include/debug/npcm7xx.S > @@ -0,0 +1,30 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright 2018 Google, Inc. > +// This is heavily based on arch/arm/include/debug/at91.S > + > +#define NPCM7XX_SR (0x14) /* Status Register */ > +#define NPCM7XX_THR (0x00) /* Transmitter Holding Register */ > +#define NPCM7XX_TXRDY (1 << 6) /* Transmitter Ready */ > +#define NPCM7XX_TXEMPTY (1 << 6) /* Transmitter Empty */ > + > + .macro addruart, rp, rv, tmp > + ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys) > + ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt) > + .endm > + > + .macro senduart,rd,rx > + strb \rd, [\rx, #(NPCM7XX_THR)] @ Write to Transmit Holding Reg > + .endm > + > + .macro waituart,rd,rx > +1001: ldr \rd, [\rx, #(NPCM7XX_SR)] @ Read Status Register > + tst \rd, #NPCM7XX_TXRDY @ TXRDY = 1 when ready to tx > + beq 1001b > + .endm > + > + .macro busyuart,rd,rx > +1001: ldr \rd, [\rx, #(NPCM7XX_SR)] @ Read Status Register > + tst \rd, #NPCM7XX_TXEMPTY @ TXEMPTY = 1 when tx complete > + beq 1001b > + .endm > + > -- > 2.16.0.rc1.238.g530d649a79-goog > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] arm: npcm: add low-level debug support for NPCM7XX 2018-02-13 1:59 ` Joel Stanley @ 2018-02-13 2:08 ` Brendan Higgins 0 siblings, 0 replies; 5+ messages in thread From: Brendan Higgins @ 2018-02-13 2:08 UTC (permalink / raw) To: Joel Stanley Cc: Jeremy Kerr, Russell King, Avi Fishman, Tomer Maimon, Patrick Venture, Nancy Yuen, OpenBMC Maillist, Linux Kernel Mailing List, Linux ARM On Mon, Feb 12, 2018 at 5:59 PM, Joel Stanley <joel@jms.id.au> wrote: > Hi Brendan, > > On Tue, Feb 13, 2018 at 7:28 AM, Brendan Higgins > <brendanhiggins@google.com> wrote: >> Enable low-level debug support for Nuvoton NPCM7XX family by adding the >> debug port definitions for the SoC. > > When playing with the Poleg boards at the recent OpenBMC hackathon > Jeremy discovered that the UART is a normal-ish 8250, with a custom > divisor and a few extra bits to be set. > > I found that we can us the generic 8250 low level debugging support > just fine. This is because u-boot sets up the divisor settings for us > (as you've assumed with your version here), and from there it's just > reading/writing characters. > > Assuming you can reproduce our results, I suggest we drop these > patches in favour of adding the correct configuration the Poleg. > Sounds good to me. I trust that if you were able to get the 8250 driver working on the Poleg that it does indeed work. We can talk about configuring it off the Linux mailing lists. <snip> Thanks! ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] MAINTAINERS: Add low-level debug files to Nuvoton NPCM section 2018-02-12 20:58 [PATCH v1 0/2] arm: npcm: add low-level debug support for NPCM7XX Brendan Higgins 2018-02-12 20:58 ` [PATCH v1 1/2] " Brendan Higgins @ 2018-02-12 20:58 ` Brendan Higgins 1 sibling, 0 replies; 5+ messages in thread From: Brendan Higgins @ 2018-02-12 20:58 UTC (permalink / raw) To: linux, avifishman70, tmaimon77, venture, yuenn Cc: linux-kernel, linux-arm-kernel, openbmc, Brendan Higgins Adds low-level debug files for NPCM7XX architecture to the Nuvoton NPCM architecture section. Signed-off-by: Brendan Higgins <brendanhiggins@google.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 2fa95aba0f7f..4eaa66bc0562 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1608,6 +1608,7 @@ L: openbmc@lists.ozlabs.org (moderated for non-subscribers) S: Supported F: arch/arm/mach-npcm/ F: arch/arm/boot/dts/nuvoton-npcm* +F: arch/arm/include/debug/npcm7xx.S F: include/dt-bindings/clock/nuvoton,npcm7xx-clks.h F: drivers/*/*npcm* F: Documentation/*/*npcm* -- 2.16.0.rc1.238.g530d649a79-goog ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-13 2:08 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-12 20:58 [PATCH v1 0/2] arm: npcm: add low-level debug support for NPCM7XX Brendan Higgins 2018-02-12 20:58 ` [PATCH v1 1/2] " Brendan Higgins 2018-02-13 1:59 ` Joel Stanley 2018-02-13 2:08 ` Brendan Higgins 2018-02-12 20:58 ` [PATCH v1 2/2] MAINTAINERS: Add low-level debug files to Nuvoton NPCM section Brendan Higgins
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®