From patchwork Wed May 14 15:58:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4176141 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 4D7C6BFF02 for ; Wed, 14 May 2014 16:03:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72C0520204 for ; Wed, 14 May 2014 16:03:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DD08201F5 for ; Wed, 14 May 2014 16:03:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkbcJ-0002Hm-Rg; Wed, 14 May 2014 16:01:15 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wkbb5-0008WG-OV for linux-arm-kernel@lists.infradead.org; Wed, 14 May 2014 16:00:00 +0000 Received: by mail-wg0-f50.google.com with SMTP id x12so2165000wgg.9 for ; Wed, 14 May 2014 08:59:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kO72XDDUQ/ucO4BLR+d4a8khxCwu7S0Xh8m/aiwygC8=; b=LdlqCAde7+a6OBRr/ZhYVlnncEBRE1dVQtNnQY2zt7eFoxhX+OmaksHG0+GWnPeRn+ 7h35ZiN51+uhW9P+kZJ5QHe4IG0BHOTgGJ4fLd8Oro4cAFB0CRju3+wGE5JoZFEVSkGz TuuuCIgS2qZU6chL5YN6hse9zA2mmavNl9XGzyxNrX8ih35ZNFOeusnNiB1KGMzCDPWx a1pd7s1sEoEjvzWVMZlBxrbmsOsgYdhZAZc6FVPD6lt60xbIZA9VO5LOdJ1V04s7nB0q aPq/iOjUkO1RHRdnMVOdClfjJc4O6CMjzDJL497jKuj6m4JyVl8zQV9Ue+HtiA2GbH/v Dpyw== X-Gm-Message-State: ALoCoQnHB0bCqM8ZIp9TPfnf3aAWz7WkmAGXDoYUtkseXCvTfEAY/833tG3SAvn2dCYtElJVKXc/ X-Received: by 10.180.206.36 with SMTP id ll4mr4082517wic.57.1400083177681; Wed, 14 May 2014 08:59:37 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id dn4sm4687808wib.18.2014.05.14.08.59.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 May 2014 08:59:36 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , kgdb-bugreport@lists.sourceforge.net Subject: [RFC 6/8] serial: asc: Add support for KGDB's FIQ/NMI mode Date: Wed, 14 May 2014 16:58:43 +0100 Message-Id: <1400083125-1464-7-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400083125-1464-1-git-send-email-daniel.thompson@linaro.org> References: <1400083125-1464-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140514_085959_986156_39F597CA X-CRM114-Status: GOOD ( 15.79 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , kernel@stlinux.com, Frederic Weisbecker , Linus Walleij , Jiri Slaby , Daniel Thompson , Dirk Behme , Russell King , Nicolas Pitre , Ian Campbell , Anton Vorontsov , "David A. Long" , linux-serial@vger.kernel.org, Catalin Marinas , kernel-team@android.com, devicetree@vger.kernel.org, linaro-kernel@lists.linaro.org, Pawel Moll , patches@linaro.org, Kumar Gala , Rob Herring , John Stultz , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Colin Cross , Christoffer Dall 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=-2.5 required=5.0 tests=BAYES_00,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 For a serial driver to support FIQ/NMI debugging it must enable the RX interrupt when a polling client attaches itself (otherwise the FIQ signal will never be asserted). This concept is copied from similar code in amba-pl011.c . It must also register the appropriate FIQ number with kgdb. kgdb will use this to make calls to enable_fiq/disable_fiq/eoi_fiq. The FIQ number must be supplied via the devices bus (in this case platform bus). Signed-off-by: Daniel Thompson --- drivers/tty/serial/st-asc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index c7f61ac..e93803f 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -30,6 +30,7 @@ #include #include #include +#include #define DRIVER_NAME "st-asc" #define ASC_SERIAL_NAME "ttyAS" @@ -613,6 +614,14 @@ asc_verify_port(struct uart_port *port, struct serial_struct *ser) } #ifdef CONFIG_CONSOLE_POLL +static int asc_poll_init(struct uart_port *port) +{ + /* enable RX interrupts in case the interrupt is used for NMI entry. */ + asc_enable_rx_interrupts(port); + + return 0; +} + /* * Console polling routines for writing and reading from the uart while * in an interrupt or debug context (i.e. kgdb). @@ -656,11 +665,25 @@ static struct uart_ops asc_uart_ops = { .verify_port = asc_verify_port, .pm = asc_pm, #ifdef CONFIG_CONSOLE_POLL + .poll_init = asc_poll_init, .poll_get_char = asc_get_poll_char, .poll_put_char = asc_put_poll_char, #endif /* CONFIG_CONSOLE_POLL */ }; +#ifdef CONFIG_KGDB_FIQ +/* Register with KGDB if there is a FIQ linked to this device */ +static void asc_register_fiq(struct platform_device *pdev) +{ + int fiq = platform_get_irq(pdev, 1); + if (fiq >= 0) + kgdb_register_fiq(fiq); +} +#else +static void asc_register_fiq(struct platform_device *pdev) {} +#endif + + static int asc_init_port(struct asc_port *ascport, struct platform_device *pdev) { @@ -692,6 +715,8 @@ static int asc_init_port(struct asc_port *ascport, WARN_ON(ascport->port.uartclk == 0); clk_disable_unprepare(ascport->clk); + asc_register_fiq(pdev); + return 0; }