From patchwork Wed Jul 11 16:21:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 1184201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 016E33FC5A for ; Wed, 11 Jul 2012 16:26:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SozgB-0004tf-Rh; Wed, 11 Jul 2012 16:22:20 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sozfr-0004tA-5d for linux-arm-kernel@lists.infradead.org; Wed, 11 Jul 2012 16:22:09 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 11 Jul 2012 17:21:52 +0100 Received: from hornet.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 11 Jul 2012 17:22:55 +0100 From: Pawel Moll To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] ARM: vexpress: Config option for early printk console Date: Wed, 11 Jul 2012 17:21:47 +0100 Message-Id: <1342023707-9645-1-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342013791-19516-10-git-send-email-pawel.moll@arm.com> References: <1342013791-19516-10-git-send-email-pawel.moll@arm.com> X-OriginalArrivalTime: 11 Jul 2012 16:22:55.0055 (UTC) FILETIME=[6D2ABDF0:01CD5F81] X-MC-Unique: 112071117215204801 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.220.42.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Pawel Moll X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Versatile Express platform can be used in different configurations, the console UART used by early printk may be located at different addresses in the address space. This patch makes it possible to select the base address of a PL011 UART to be used as a console output in the kernel configuration. The default behaviour is still the heuristic detecting memory map on Cortex-A core tiles. The zImage decompressor will use the same configuration values or print out nothing if DEBUG_LL is not enabled. Signed-off-by: Pawel Moll --- arch/arm/Kconfig.debug | 26 +++++++++++++ arch/arm/mach-vexpress/include/mach/debug-macro.S | 41 +++++++++++++++++++++ arch/arm/mach-vexpress/include/mach/uncompress.h | 14 +++++++ 3 files changed, 81 insertions(+) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 01a1341..a03b5a7 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -310,6 +310,32 @@ choice The uncompressor code port configuration is now handled by CONFIG_S3C_LOWLEVEL_UART_PORT. + config DEBUG_VEXPRESS_UART0_DETECT + bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" + depends on ARCH_VEXPRESS && CPU_CP15_MMU + help + This option enables a simple heuristic which tries to determine + the motherboard's memory map variant (original or RS1) and then + choose the relevant UART0 base address. + + Note that this will only work with standard A-class core tiles, + and may fail with non-standard SMM or custom software models. + + config DEBUG_VEXPRESS_UART0_CA9 + bool "Use PL011 UART0 at 0x10009000 (V2P-CA9 core tile)" + depends on ARCH_VEXPRESS + help + This option selects UART0 at 0x10009000. Except for custom models, + this applies only to the V2P-CA9 tile. + + config DEBUG_VEXPRESS_UART0_RS1 + bool "Use PL011 UART0 at 0x1c090000 (RS1 complaint tiles)" + depends on ARCH_VEXPRESS + help + This option selects UART0 at 0x1c090000. This applies to most + of the tiles using the RS1 memory map, including all new A-class + core tiles, FPGA-based SMMs and software models. + config DEBUG_LL_UART_NONE bool "No low-level debugging UART" help diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S index fa82247..9f509f5 100644 --- a/arch/arm/mach-vexpress/include/mach/debug-macro.S +++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S @@ -18,6 +18,8 @@ #define DEBUG_LL_VIRT_BASE 0xf8000000 +#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT) + .macro addruart,rp,rv,tmp @ Make an educated guess regarding the memory map: @@ -41,3 +43,42 @@ .endm #include + +#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CA9) + + .macro addruart,rp,rv,tmp + mov \rp, #DEBUG_LL_UART_OFFSET + orr \rv, \rp, #DEBUG_LL_VIRT_BASE + orr \rp, \rp, #DEBUG_LL_PHYS_BASE + .endm + +#include + +#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_RS1) + + .macro addruart,rp,rv,tmp + mov \rp, #DEBUG_LL_UART_OFFSET_RS1 + orr \rv, \rp, #DEBUG_LL_VIRT_BASE + orr \rp, \rp, #DEBUG_LL_PHYS_BASE_RS1 + .endm + +#include + +#else /* CONFIG_DEBUG_LL_UART_NONE */ + + .macro addruart, rp, rv, tmp + /* Safe dummy values */ + mov \rp, #0 + mov \rv, #DEBUG_LL_VIRT_BASE + .endm + + .macro senduart,rd,rx + .endm + + .macro waituart,rd,rx + .endm + + .macro busyuart,rd,rx + .endm + +#endif diff --git a/arch/arm/mach-vexpress/include/mach/uncompress.h b/arch/arm/mach-vexpress/include/mach/uncompress.h index 7dab559..1e472eb 100644 --- a/arch/arm/mach-vexpress/include/mach/uncompress.h +++ b/arch/arm/mach-vexpress/include/mach/uncompress.h @@ -27,6 +27,7 @@ static unsigned long get_uart_base(void) { +#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT) unsigned long mpcore_periph; /* @@ -42,6 +43,13 @@ static unsigned long get_uart_base(void) return UART_BASE; else return UART_BASE_RS1; +#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CA9) + return UART_BASE; +#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_RS1) + return UART_BASE_RS1; +#else + return 0; +#endif } /* @@ -51,6 +59,9 @@ static inline void putc(int c) { unsigned long base = get_uart_base(); + if (!base) + return; + while (AMBA_UART_FR(base) & (1 << 5)) barrier(); @@ -61,6 +72,9 @@ static inline void flush(void) { unsigned long base = get_uart_base(); + if (!base) + return; + while (AMBA_UART_FR(base) & (1 << 3)) barrier(); }