[PATCH v2] ARM: bcm: Support BCMBCA debug UART

William Zhang william.zhang at broadcom.com
Tue Sep 24 11:35:34 PDT 2024


> -----Original Message-----
> From: Linus Walleij <linus.walleij at linaro.org>
> Sent: Monday, September 23, 2024 12:49 PM
> To: Florian Fainelli <florian.fainelli at broadcom.com>; Ray Jui
> <rjui at broadcom.com>; Scott Branden <sbranden at broadcom.com>;
> Broadcom internal kernel review list <bcm-kernel-feedback-
> list at broadcom.com>; Russell King <linux at armlinux.org.uk>; William Zhang
> <william.zhang at broadcom.com>; Anand Gore
> <anand.gore at broadcom.com>; Kursad Oney
> <kursad.oney at broadcom.com>; Rafał Miłecki <rafal at milecki.pl>
> Cc: linux-arm-kernel at lists.infradead.org; Linus Walleij
> <linus.walleij at linaro.org>
> Subject: [PATCH v2] ARM: bcm: Support BCMBCA debug UART
>
> The debug UART on the BCMBCA SoCs are in a different place
> than on the other BCM platforms. Support this with a static
> map when debugging is explicitly configured.
>
> Right now I can only test this on BCM6846 so this is the
> only compatible I list for the debug boardfile, but other
> compatibles from the BCMBCA family can be added to get
> LL_DEBUG support.
>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> I could not get debug messaged from LL_DEBUG UARTS
> (such as decompress....) and it was really hard to
> do early debug without that.
> ---
> Changes in v2:
> - Drop patch 1, it's not needed and was just based on my own
>   incompetence.
> - Rework the UART0 support such that it is generic for all
>   BCMBCA platforms and the static map is only compiled in when
>   explicitly using LL_DEBUG.
> - Link to v1: https://lore.kernel.org/r/20240917-bcm-arm-bcm6846-v1-0-
> 236e29661f4c at linaro.org
> ---
>  arch/arm/Kconfig.debug           | 12 +++++++++---
>  arch/arm/mach-bcm/Makefile       |  1 +
>  arch/arm/mach-bcm/board_bcmbca.c | 31
> +++++++++++++++++++++++++++++++
>  3 files changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 7f47b4f335c3..366f162e147d 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -242,6 +242,10 @@ choice
>  		depends on ARCH_BCM_5301X || ARCH_BCM_NSP
>  		select DEBUG_UART_8250
>
> +	config DEBUG_BCMBCA
> +		bool "Kernel low-level debugging on BCMBCA UART0"
> +		depends on ARCH_BCMBCA
> +
>  	config DEBUG_BCM_HR2
>  		bool "Kernel low-level debugging on Hurricane 2 UART2"
>  		depends on ARCH_BCM_HR2
> @@ -1526,7 +1530,7 @@ config DEBUG_LL_INCLUDE
>  	default "debug/vf.S" if DEBUG_VF_UART
>  	default "debug/vt8500.S" if DEBUG_VT8500_UART0
>  	default "debug/zynq.S" if DEBUG_ZYNQ_UART0 ||
> DEBUG_ZYNQ_UART1
> -	default "debug/bcm63xx.S" if DEBUG_BCM63XX_UART
> +	default "debug/bcm63xx.S" if DEBUG_BCM63XX_UART ||
> DEBUG_BCMBCA
>  	default "debug/digicolor.S" if DEBUG_DIGICOLOR_UA0
>  	default "debug/brcmstb.S" if DEBUG_BRCMSTB_UART
>  	default "mach/debug-macro.S"
> @@ -1640,6 +1644,7 @@ config DEBUG_UART_PHYS
>  	default 0xfe531000 if DEBUG_STIH41X_SBC_ASC1
>  	default 0xfed32000 if DEBUG_STIH41X_ASC2
>  	default 0xff690000 if DEBUG_RK32_UART2
> +	default 0xff800640 if DEBUG_BCMBCA
>  	default 0xffc02000 if DEBUG_SOCFPGA_UART0
>  	default 0xffc02100 if DEBUG_SOCFPGA_ARRIA10_UART1
>  	default 0xffc03000 if DEBUG_SOCFPGA_CYCLONE5_UART1
> @@ -1664,7 +1669,7 @@ config DEBUG_UART_PHYS
>  		DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
>  		DEBUG_RMOBILE_SCIFA4 || \
>  		DEBUG_S3C64XX_UART || \
> -		DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
> +		DEBUG_BCM63XX_UART || DEBUG_BCMBCA ||
> DEBUG_ASM9260_UART || \
>  		DEBUG_DIGICOLOR_UA0 || \
>  		DEBUG_AT91_UART || DEBUG_STM32_UART || \
>  		DEBUG_STIH41X_ASC2 || DEBUG_STIH41X_SBC_ASC1 || \
> @@ -1734,6 +1739,7 @@ config DEBUG_UART_VIRT
>  	default 0xfe018000 if DEBUG_MMP_UART3
>  	default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
>  	default 0xfe300000 if DEBUG_BCM_KONA_UART
> +	default 0xfe300640 if DEBUG_BCMBCA
>  	default 0xfeb00000 if DEBUG_HI3620_UART ||
> DEBUG_HIX5HD2_UART
>  	default 0xfeb24000 if DEBUG_RK3X_UART0
>  	default 0xfeb26000 if DEBUG_RK3X_UART1
> @@ -1765,7 +1771,7 @@ config DEBUG_UART_VIRT
>  		DEBUG_UART_8250 || DEBUG_UART_PL01X ||
> DEBUG_MESON_UARTAO || \
>  		DEBUG_QCOM_UARTDM || \
>  		DEBUG_S3C64XX_UART || \
> -		DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
> +		DEBUG_BCM63XX_UART || DEBUG_BCMBCA ||
> DEBUG_ASM9260_UART || \
>  		DEBUG_DIGICOLOR_UA0 || \
>  		DEBUG_AT91_UART || DEBUG_STM32_UART || \
>  		DEBUG_STIH41X_ASC2 || DEBUG_STIH41X_SBC_ASC1 || \
> diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
> index 2e523f29ec3b..6baedf4c6304 100644
> --- a/arch/arm/mach-bcm/Makefile
> +++ b/arch/arm/mach-bcm/Makefile
> @@ -58,5 +58,6 @@ endif
>
>  # BCMBCA
>  ifeq ($(CONFIG_ARCH_BCMBCA),y)
> +obj-$(CONFIG_DEBUG_BCMBCA)	+= board_bcmbca.o
>  obj-$(CONFIG_SMP)		+= bcm63xx_smp.o bcm63xx_pmb.o
>  endif
> diff --git a/arch/arm/mach-bcm/board_bcmbca.c b/arch/arm/mach-
> bcm/board_bcmbca.c
> new file mode 100644
> index 000000000000..b510d959870a
> --- /dev/null
> +++ b/arch/arm/mach-bcm/board_bcmbca.c
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +// Copyright (C) 2024 Linus Walleij <linus.walleij at linaro.org>
> +
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +
> +/* This is needed for LL-debug/earlyprintk/debug-macro.S */
> +static struct map_desc bcmbca_io_desc[] __initdata = {
> +	{
> +		.virtual = CONFIG_DEBUG_UART_VIRT,
> +		.pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
> +		.length = SZ_4K,
> +		.type = MT_DEVICE,
> +	},
> +};
> +
> +static void __init bcmbca_map_io(void)
> +{
> +	iotable_init(bcmbca_io_desc, ARRAY_SIZE(bcmbca_io_desc));
> +}
> +
> +static const char * const bcmbca_dt_compat[] = {
> +	/* TODO: Add other BCMBCA SoCs here to get debug UART support
> */
> +	"brcm,bcm6846",
> +	NULL,
> +};
> +
> +DT_MACHINE_START(BCMBCA_DT, "BCMBCA Broadband Access
> Processors")
> +	.map_io = bcmbca_map_io,
> +	.dt_compat = bcmbca_dt_compat,
> +MACHINE_END
>
> ---
> base-commit: b97d8c6186d0c4495d2554b09d99cdae59113212
> change-id: 20240917-bcm-arm-bcm6846-62502a146ad0
>
> Best regards,
> --
> Linus Walleij <linus.walleij at linaro.org>


Acked-by: William Zhang <william.zhang at broadcom.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4212 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240924/bac7d1fd/attachment.p7s>


More information about the linux-arm-kernel mailing list