From patchwork Mon Sep 23 19:49:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13809954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D270CF9C71 for ; Mon, 23 Sep 2024 19:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=qqP1Fn7RF0/o3olhBREwCbj1hjYCzRJbL5g6RXKQIPA=; b=H/rNJcsJU1QATi5qAAN8aUKElu PGReC6jOrQhuj6phwtfKT3RpY8oNoaRqoyPirAo6Si//nWtJ0BeG7DoWVdMabYi4YakFcdhIVEuZV XfE7dj4rQuDQLJ96Q3B//KLYNGDwQF3/fLeCD5UetCO65VLqSFwGtLc9TiMbwbbLEU3XL2HB4A6A0 M1h9xpl+VFtF0mXnektjO5fEXa27sY+YGsLD3LpbYFQEs2wpYuocGS/ofMIgkqaMGKvVJqcKVogfe 6kulpEQbZ1m/oEJK2/dEHhkXKQDWBFtLxvFpMPaNuyYRunKyBcGuQg8wab1vQ1FJ0o+Mqci8C5i90 lsLo7PMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssp55-00000000OkO-33nm; Mon, 23 Sep 2024 19:50:47 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssp3w-00000000Ogi-31Uv for linux-arm-kernel@lists.infradead.org; Mon, 23 Sep 2024 19:49:38 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a8d3cde1103so366933466b.2 for ; Mon, 23 Sep 2024 12:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727120975; x=1727725775; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=qqP1Fn7RF0/o3olhBREwCbj1hjYCzRJbL5g6RXKQIPA=; b=DcQNKft2g6cWccnAXjtHv4AQJqiSIw1JqvTL3DTlqbvnIj8YST82SzUzu02GLAWaYm AkFsJK9x+bzFzHb9tFOkDAiCgzyKla5tUSzWNNSTOenDtFdLfZesllxr4mTsPzCy9SlU DO6szip4LfNiVi3BS3ZDp4F468AFP8ADSSNyZoH44WaBqPGrI4Pk2UPy27RUcIlM9r6v 1u9Kwt1ITroeTiZhH9OxGn9oYVCAF/h93Y4tb/WDmQRzz81QmNXMCuQ+j/4bqA/GXMM1 +iuTDwtawAZxvq8PaYPvVseJvsjoprn7JT7ezM8Oo761+kSpo7dIC+o+FEq8rXLHEMcy obrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727120975; x=1727725775; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qqP1Fn7RF0/o3olhBREwCbj1hjYCzRJbL5g6RXKQIPA=; b=OZSL0qnsGuMf2F2tyqoOz8FKFPwQ4GtajKyt/sTRmMJsc0v+ZjzvkYH6cFoImeYlJs WBT5eF710Of7Cvb+OXHujkG+F+V7a5rVJbZCXkdWnwKuZpUDOva5Yc3hrDUS/IhYts8N kSBZcodhpBVzCw5iaSd/y7IbxpaifF5aq32BvBHDIxYdgknRb2upqnyK9xL5XHTZDMi8 kGDS2qqYeGRxVD5LkwCkDqKI4cpAVagxkRQxuhdXeYSGjX9DQvwYz43OgZQYFBfLROeC BzbP1kf+GTYN6t1W9EO0T/qi/6Ne/JzgraqawrcH5fs/c8SWfz+4xfNiix7SENWkFsHE n0dw== X-Gm-Message-State: AOJu0YzJK3OAKpiTDoJ03GjHsLQKXvtMA7pQeIN18kTTFQXgZBWer58l 8r9mqTTXlHdthMjxu/jbJ/zz+j01xPpl30QkJ+VYjkhtGbawE3MVA4FR9x9YTyI= X-Google-Smtp-Source: AGHT+IE0iPLGQNQLl22ewdt21fmrTUgnFq9arGcAQOCl7PXmYKH6gbii8LwVAcZf0kth4G+qs7ythA== X-Received: by 2002:a17:907:e60e:b0:a77:b01b:f949 with SMTP id a640c23a62f3a-a90d56c568amr1251791566b.35.1727120974604; Mon, 23 Sep 2024 12:49:34 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90610f453asm1266401066b.88.2024.09.23.12.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 12:49:34 -0700 (PDT) From: Linus Walleij Date: Mon, 23 Sep 2024 21:49:21 +0200 Subject: [PATCH v2] ARM: bcm: Support BCMBCA debug UART MIME-Version: 1.0 Message-Id: <20240923-bcm-arm-bcm6846-v2-1-f4a7191b501a@linaro.org> X-B4-Tracking: v=1; b=H4sIAEDG8WYC/3WNwQ6CMBBEf4Xs2Zp2rat48j8MhwoFNhFKtqbRk P67hbunyZtk3qwQvbCPcKtWEJ84cpgL4KGCdnTz4BV3hQE1Wl2bi3q2k3IybUlXS4rwrNEZS67 TUFaL+J4/u/HRFB45voN894Nktva/KxmlFZ7IY01ketveXzw7CccgAzQ55x8cXigdrwAAAA== To: Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Russell King , William Zhang , Anand Gore , Kursad Oney , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_124936_812377_A5A9BDCC X-CRM114-Status: GOOD ( 22.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: William Zhang --- 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@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(-) --- base-commit: b97d8c6186d0c4495d2554b09d99cdae59113212 change-id: 20240917-bcm-arm-bcm6846-62502a146ad0 Best regards, 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 + +#include +#include + +/* 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