mach-snapdragon: formalize APQ8016 debug UART init
Subsystems (2)
PATCH v2 1/1 mach-snapdragon: formalize APQ8016 debug UART init
The dragonboard410c (and likely other SB-off devices) can run U-Boot early enough in the boot chain such that UART clock isn't started, and pins aren't configured.
APQ8016 has two UART peripherals, each with its own clock and TLMM pins.
Two new debug-apq8016-uartN.config fragments are provided. Each configures the appropriate UARTDM aperture. The newly introduced DEBUG_UART_APQ8016 Kconfig symbol pulls in MSM debug UART, and enables a board-level debug_uart_init function to start the right clock and mux the right TX pin.
---
Changes in v2:
- Rename APQ8016_TLMM_GPIO_ENABLE to APQ8016_TLMM_GPIO_OE
- Link to v1: https://lore.kernel.org/r/[email protected]
--- arch/arm/mach-snapdragon/Kconfig | 9 +++++++ arch/arm/mach-snapdragon/Makefile | 1 + arch/arm/mach-snapdragon/debug-uart-apq8016.c | 37 +++++++++++++++++++++++++++ board/qualcomm/debug-apq8016-uart1.config | 4 +++ board/qualcomm/debug-apq8016-uart2.config | 4 +++ drivers/serial/Kconfig | 1 + drivers/serial/serial_msm.c | 10 -------- 7 files changed, 56 insertions(+), 10 deletions(-)
arch/arm/mach-snapdragon/Kconfig +9 -0
@@ -1,5 +1,14 @@ if ARCH_SNAPDRAGON +config DEBUG_UART_APQ8016 + bool "APQ8016 early debug initialization" + select CLK_QCOM_APQ8016 + select CONFIG_DEBUG_UART_MSM + select DEBUG_UART_BOARD_INIT + help + Ensures BLSP UART clocks+pins are setup. Useful when U-Boot is running from + aboot (such as on the dragonboard410c). + config SYS_SOC default "snapdragon"
arch/arm/mach-snapdragon/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-y += board.o obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += capsule_update.o obj-$(CONFIG_OF_LIVE) += of_fixup.o +obj-$(CONFIG_DEBUG_UART_APQ8016) += debug-uart-apq8016.o
arch/arm/mach-snapdragon/debug-uart-apq8016.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* SoC-specific debug UART initialization (clocks/pins) lives here +*/ + +#include <asm/io.h> +#include <dt-bindings/clock/qcom,gcc-msm8916.h> + +extern int apq8016_clk_init_uart (phys_addr_t gcc_base,unsigned long id); + +#define APQ8016_GCC_BASE ((phys_addr_t)0x01800000) + +#define APQ8016_TLMM_BASE ((phys_addr_t)0x01000000) +#define APQ8016_TLMM_FUNC_BLSP_UART (2 << 2) +#define APQ8016_TLMM_DRV_8MA (3 << 6) +#define APQ8016_TLMM_GPIO_OE BIT(9) +#define APQ8016_GPIO_CFG (gpio) (APQ8016_TLMM_BASE + (phys_addr_t)(gpio) * 0x1000) +#define APQ8016_DEBUG_UART_PINCFG (APQ8016_TLMM_FUNC_BLSP_UART | \ + APQ8016_TLMM_DRV_8MA | \ + APQ8016_TLMM_GPIO_OE) + +void board_debug_uart_init (void ) +{ +/* infer BLSP clock and TX pin by the configured UART base */ +switch (CONFIG_VAL (DEBUG_UART_BASE )) { +case 0x078af000 : +apq8016_clk_init_uart (APQ8016_GCC_BASE , +GCC_BLSP1_UART1_APPS_CLK ); +writel (APQ8016_DEBUG_UART_PINCFG ,APQ8016_GPIO_CFG (0 )); +break ; +case 0x078b0000 : +apq8016_clk_init_uart (APQ8016_GCC_BASE , +GCC_BLSP1_UART2_APPS_CLK ); +writel (APQ8016_DEBUG_UART_PINCFG ,APQ8016_GPIO_CFG (4 )); +break ; + } +}
board/qualcomm/debug-apq8016-uart1.config new file +4 -0
@@ -0,0 +1,4 @@ +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_DEBUG_UART_BASE=0x078af000 +CONFIG_DEBUG_UART_APQ8016=y
board/qualcomm/debug-apq8016-uart2.config new file +4 -0
@@ -0,0 +1,4 @@ +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_DEBUG_UART_BASE=0x078b0000 +CONFIG_DEBUG_UART_APQ8016=y
drivers/serial/Kconfig +1 -0
@@ -565,6 +565,7 @@ config DEBUG_UART_CLOCK default 100000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQMP default 50000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQ default 100000000 if DEBUG_UART_PL011 && (ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2) + default 7372800 if DEBUG_UART_APQ8016 help The UART input clock determines the speed of the internal UART circuitry. The baud rate is derived from this by dividing the input
drivers/serial/serial_msm.c +0 -10
@@ -235,18 +235,8 @@ static struct msm_serial_data init_serial_data = {#include <debug_uart.h> -/* Uncomment to turn on UART clocks when debugging U-Boot as aboot on MSM8916 */ -//int apq8016_clk_init_uart(phys_addr_t gcc_base, unsigned long id); -static inline void _debug_uart_init (void ) { -/* -* Uncomment to turn on UART clocks when debugging U-Boot as aboot -* on MSM8916. Supported debug UART clock IDs: -* - db410c: GCC_BLSP1_UART2_APPS_CLK -* - HMIBSC: GCC_BLSP1_UART1_APPS_CLK -*/ -//apq8016_clk_init_uart(0x1800000, <uart_clk_id>); uart_dm_init (&init_serial_data); }
---
base-commit: f76fb6495b2df5163f4c88dc222acc934caffbfb
change-id: 20260602-apq8016-debug-uart-07c0cf4e1060
Best regards,
Signature · 1 line
Sam Day <[email protected]>
Quoted 34 lines · On Wed, Jun 10, 2026 at 11:57:20AM +1000, Sam Day via B4 Relay wrote:
From: Sam Day <[email protected]>
The dragonboard410c (and likely other SB-off devices) can run U-Boot early enough in the boot chain such that UART clock isn't started, and pins aren't configured.
APQ8016 has two UART peripherals, each with its own clock and TLMM pins.
Two new debug-apq8016-uartN.config fragments are provided. Each configures the appropriate UARTDM aperture. The newly introduced
DEBUG_UART_APQ8016Kconfigsymbol pulls in MSM debug UART, and enables a board-leveldebug_uart_initfunction to start the right clock and mux the right TX pin.Signed-off-by Sam Day <[email protected]>---
Changes in v2:
- RenameAPQ8016_TLMM_GPIO_ENABLEtoAPQ8016_TLMM_GPIO_OE
- Link to v1: https://lore.kernel.org/r/[email protected]--- arch/arm/mach-snapdragon/Kconfig | 9 +++++++ arch/arm/mach-snapdragon/Makefile | 1 + arch/arm/mach-snapdragon/debug-uart-apq8016.c | 37 +++++++++++++++++++++++++++ board/qualcomm/debug-apq8016-uart1.config | 4 +++ board/qualcomm/debug-apq8016-uart2.config | 4 +++ drivers/serial/Kconfig | 1 + drivers/serial/serial_msm.c | 10 -------- 7 files changed, 56 insertions(+), 10 deletions(-)arch/arm/mach-snapdragon/Kconfig +0
-0
arch/arm/mach-snapdragon/Kconfig line 6
Quoted 6 lines
arch/arm/mach-snapdragon/Kconfig +4
-0@@ -1,5 +1,14 @@ if ARCH_SNAPDRAGON +config DEBUG_UART_APQ8016 + bool "APQ8016 early debug initialization" + select CLK_QCOM_APQ8016 + select CONFIG_DEBUG_UART_MSM
Should we have the CONFIG_ prefix here in Kconfig? Not sure if both works, but I'd expect this isn't required/typical here.
Thanks,
Stephan