From patchwork Thu Jun 20 14:06:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas KANDAGATLA X-Patchwork-Id: 2757281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 957FBC0AB1 for ; Thu, 20 Jun 2013 16:52:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5148A2029B for ; Thu, 20 Jun 2013 16:52:04 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D46602026E for ; Thu, 20 Jun 2013 16:52:02 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Upfbd-0002mm-5A; Thu, 20 Jun 2013 14:13:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpfaN-0008JF-K0; Thu, 20 Jun 2013 14:11:40 +0000 Received: from eu1sys200aog106.obsmtp.com ([207.126.144.121]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpfZR-00089e-Hf for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2013 14:10:44 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKUcMNOFMc3iwrxLf7V/1sAOwGZiVaqBDN@postini.com; Thu, 20 Jun 2013 14:10:41 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 937C3201; Thu, 20 Jun 2013 14:09:57 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 082D05174; Thu, 20 Jun 2013 14:09:35 +0000 (GMT) Received: from localhost (king.bri.st.com [10.65.51.59]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BGE52230 (AUTH srinivak); Thu, 20 Jun 2013 16:09:55 +0200 From: Srinivas KANDAGATLA To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 06/10] ARM:stixxxx: Add DEBUG_LL console support Date: Thu, 20 Jun 2013 15:06:16 +0100 Message-Id: <1371737176-9473-1-git-send-email-srinivas.kandagatla@st.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1371736996-8770-1-git-send-email-srinivas.kandagatla@st.com> References: <1371736996-8770-1-git-send-email-srinivas.kandagatla@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130620_101041_962793_5609826A X-CRM114-Status: GOOD ( 20.29 ) X-Spam-Score: -4.2 (----) Cc: Russell King , kernel@stlinux.com, Arnd Bergmann , Srinivas Kandagatla , Greg Kroah-Hartman , Linus Walleij , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Stephen Gallimore , Stuart Menefy , Mark Brown , John Stultz , Rob Landley , linux-serial@vger.kernel.org, Grant Likely , Thomas Gleixner , Jiri Slaby , devicetree-discuss@lists.ozlabs.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds low level debug uart support to stixxxx based SOCs. Signed-off-by: Srinivas Kandagatla CC: Arnd Bergmann --- arch/arm/Kconfig.debug | 38 +++++++++++++++++++++++ arch/arm/include/debug/stixxxx.S | 61 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-stixxxx/board-dt.c | 2 + 3 files changed, 101 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/debug/stixxxx.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 1d41908..cc98ef3 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -483,6 +483,16 @@ choice This option selects UART0 on VIA/Wondermedia System-on-a-chip devices, including VT8500, WM8505, WM8650 and WM8850. + config DEBUG_STIXXXX_UART + depends on ARCH_STIXXXX + bool "Use StiH415/416 ASC for low-level debug" + help + Say Y here if you want kernel low-level debugging support + on StiH415/416 based platforms like B2000, B2020. + It support UART2 and SBC_UART1. + + If unsure, say N. + config DEBUG_LL_UART_NONE bool "No low-level debugging UART" depends on !ARCH_MULTIPLATFORM @@ -617,6 +627,33 @@ choice endchoice +choice + prompt "Low-level debug console UART" + depends on DEBUG_LL && DEBUG_STIXXXX_UART + + config STIH41X_DEBUG_ASC2 + bool "ASC2 UART" + help + Say Y here if you want kernel low-level debugging support + on STiH415/416 based platforms like b2000, which has + default UART wired up to ASC2. + + If unsure, say N. + + config STIH41X_DEBUG_SBC_ASC1 + bool "SBC ASC1 UART" + help + Say Y here if you want kernel low-level debugging support + on STiH415/416 based platforms like b2020. which has + default UART wired up to SBC ASC1. + + If unsure, say N. + +endchoice + + + + config DEBUG_LL_INCLUDE string default "debug/bcm2835.S" if DEBUG_BCM2835 @@ -641,6 +678,7 @@ config DEBUG_LL_INCLUDE DEBUG_MMP_UART3 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART + default "debug/stixxxx.S" if DEBUG_STIXXXX_UART default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1 default "debug/tegra.S" if DEBUG_TEGRA_UART default "debug/ux500.S" if DEBUG_UX500_UART diff --git a/arch/arm/include/debug/stixxxx.S b/arch/arm/include/debug/stixxxx.S new file mode 100644 index 0000000..7bc02a7 --- /dev/null +++ b/arch/arm/include/debug/stixxxx.S @@ -0,0 +1,61 @@ +/* + * arch/arm/include/debug/stixxxx.S + * + * Debugging macro include header + * Copyright (C) 2013 STMicroelectronics (R&D) Limited. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define STIH41X_COMMS_BASE 0xfed00000 +#define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000) + +#define STIH41X_SBC_LPM_BASE 0xfe400000 +#define STIH41X_SBC_COMMS_BASE (STIH41X_SBC_LPM_BASE + 0x100000) +#define STIH41X_SBC_ASC1_BASE (STIH41X_SBC_COMMS_BASE + 0x31000) + + +#define VIRT_ADDRESS(x) (x - 0x1000000) + +#if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2) +#define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE +#endif + +#if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1) +#define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE +#endif + +#ifndef DEBUG_LL_UART_BASE +#error "DEBUG UART is not Configured" +#endif + +#define ASC_TX_BUF_OFF 0x04 +#define ASC_CTRL_OFF 0x0c +#define ASC_STA_OFF 0x14 + +#define ASC_STA_TX_FULL (1<<9) +#define ASC_STA_TX_EMPTY (1<<1) + + + .macro addruart, rp, rv, tmp + ldr \rp, =DEBUG_LL_UART_BASE @ physical base + ldr \rv, =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #ASC_TX_BUF_OFF] + .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #ASC_STA_OFF] + tst \rd, #ASC_STA_TX_FULL + bne 1001b + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #ASC_STA_OFF] + tst \rd, #ASC_STA_TX_EMPTY + beq 1001b + .endm diff --git a/arch/arm/mach-stixxxx/board-dt.c b/arch/arm/mach-stixxxx/board-dt.c index 6487a12..2c4e427 100644 --- a/arch/arm/mach-stixxxx/board-dt.c +++ b/arch/arm/mach-stixxxx/board-dt.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "smp.h" @@ -42,6 +43,7 @@ static const char *stih41x_dt_match[] __initdata = { }; DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree") + .map_io = debug_ll_io_init, .init_time = stih41x_timer_init, .smp = smp_ops(stixxxx_smp_ops), .dt_compat = stih41x_dt_match,