From b4db05f2cb2addf8b6f5933cab7903b18e966227 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 6 Mar 2019 10:09:21 +0100 Subject: ARM: rpi: move debug UART Kconfig settings In contrast to other architectures, R.Pi debug UART config was placed under the "System Type" menu, not under the "Debugging -> low-level debugging port". This made this setting easy to miss when enabling low level debug mesages. While at it use the existing base address defines rather than defining them again in Kconfig. Signed-off-by: Sascha Hauer --- common/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index 21b33f06f7..563cf15fb1 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1159,6 +1159,19 @@ config DEBUG_SOCFPGA_UART1 Say Y here if you want kernel low-level debugging support on SOCFPGA(Arria 10) based platforms. +config DEBUG_RPI1_UART + bool "RaspberryPi 1 debug UART" + depends on ARCH_BCM283X + help + Say Y here if you want low-level debugging support on + RaspberryPi 1 boards. + +config DEBUG_RPI2_UART + bool "RaspberryPi 2/3 debug UART" + depends on ARCH_BCM283X + help + Say Y here if you want low-level debugging support on + RaspberryPi 2 and 3 boards. endchoice -- cgit v1.2.3 From 70187de497f36213e2bb243022a3474d631d19a4 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 6 Mar 2019 10:12:31 +0100 Subject: ARM: rpi: Add mini UART debug_ll support The raspberry pi 3 comes up with the mini UART as default, so allow to use it for debug_ll output. Signed-off-by: Sascha Hauer --- arch/arm/mach-bcm283x/include/mach/debug_ll.h | 37 +++++++++++++++++++++++++++ common/Kconfig | 6 +++++ 2 files changed, 43 insertions(+) (limited to 'common') diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h index 2d2103e338..99c59d011b 100644 --- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h +++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h @@ -22,14 +22,51 @@ #ifdef CONFIG_DEBUG_RPI1_UART +static inline void debug_ll_init(void) +{ + /* Configured by ROM */ +} + #define DEBUG_LL_UART_ADDR BCM2835_PL011_BASE #include #elif defined CONFIG_DEBUG_RPI2_3_UART +static inline void debug_ll_init(void) +{ + /* Configured by ROM */ +} + #define DEBUG_LL_UART_ADDR BCM2836_PL011_BASE #include +#elif defined CONFIG_DEBUG_RPI3_MINI_UART + +static inline uint8_t debug_ll_read_reg(int reg) +{ + return readb(BCM2836_MINIUART_BASE + (reg << 2)); +} + +static inline void debug_ll_write_reg(int reg, uint8_t val) +{ + writeb(val, BCM2836_MINIUART_BASE + (reg << 2)); +} + +#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */ +#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */ + +#include + +static inline void debug_ll_init(void) +{ + uint16_t divisor; + + writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB); + + divisor = debug_ll_ns16550_calc_divisor(250000000 * 2); + debug_ll_ns16550_init(divisor); +} + #endif #endif /* __MACH_BCM2835_DEBUG_LL_H__ */ diff --git a/common/Kconfig b/common/Kconfig index 563cf15fb1..0c6acfcddb 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1173,6 +1173,12 @@ config DEBUG_RPI2_UART Say Y here if you want low-level debugging support on RaspberryPi 2 and 3 boards. +config DEBUG_RPI3_MINI_UART + bool "RaspberryPi 3 mini UART + depends on ARCH_BCM283X + help + Say Y here if you want low-level debugging support on + RaspberryPi 3 board mini UART. endchoice config DEBUG_IMX_UART_PORT -- cgit v1.2.3 From 49a1f329e437c4199bc7cba3fae66807a2069312 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 7 Mar 2019 13:58:35 +0100 Subject: fixup! ARM: rpi: move debug UART Kconfig settings --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index 0c6acfcddb..238dd93c07 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1166,7 +1166,7 @@ config DEBUG_RPI1_UART Say Y here if you want low-level debugging support on RaspberryPi 1 boards. -config DEBUG_RPI2_UART +config DEBUG_RPI2_3_UART bool "RaspberryPi 2/3 debug UART" depends on ARCH_BCM283X help -- cgit v1.2.3 From b4e5d93e9c385b8c55cdbfef7b2471a3ddf8a23b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 7 Mar 2019 13:59:34 +0100 Subject: fixup! ARM: rpi: Add mini UART debug_ll support --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index 238dd93c07..64d563c444 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1174,7 +1174,7 @@ config DEBUG_RPI2_3_UART RaspberryPi 2 and 3 boards. config DEBUG_RPI3_MINI_UART - bool "RaspberryPi 3 mini UART + bool "RaspberryPi 3 mini UART" depends on ARCH_BCM283X help Say Y here if you want low-level debugging support on -- cgit v1.2.3 From 9fd32f5a4e8d25fb8985fec86bc03f3743820f0e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 7 Mar 2019 14:22:55 +0100 Subject: ARM: rpi: Clarify debug uart names Now that we support the miniuart as lowlevel debug UART clarify that the other UARTs are PL011. Signed-off-by: Sascha Hauer --- common/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index 64d563c444..03346068a8 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1160,14 +1160,14 @@ config DEBUG_SOCFPGA_UART1 on SOCFPGA(Arria 10) based platforms. config DEBUG_RPI1_UART - bool "RaspberryPi 1 debug UART" + bool "RaspberryPi 1 PL011 UART" depends on ARCH_BCM283X help Say Y here if you want low-level debugging support on RaspberryPi 1 boards. config DEBUG_RPI2_3_UART - bool "RaspberryPi 2/3 debug UART" + bool "RaspberryPi 2/3 PL011 UART" depends on ARCH_BCM283X help Say Y here if you want low-level debugging support on -- cgit v1.2.3