From patchwork Fri May 23 13:57:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4232941 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 9CC7BBF90B for ; Fri, 23 May 2014 14:04:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4316C2037A for ; Fri, 23 May 2014 14:04:08 +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 66F3720303 for ; Fri, 23 May 2014 14:04:07 +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 1Wnq2U-0003b7-OX; Fri, 23 May 2014 14:01:38 +0000 Received: from mail-we0-f170.google.com ([74.125.82.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnpzu-0000qZ-Og for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 13:59:00 +0000 Received: by mail-we0-f170.google.com with SMTP id u57so5040291wes.15 for ; Fri, 23 May 2014 06:58: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=/anrjFkiEbrPWjHQiST6J5BiiE3Zr11S2d1LSm8C1Bg=; b=RyingOsi4MoSsRn3He86xgKytnx/F58qAp/TfAgohC2raOpo56T9F44Xse+zxscqLP 4XNOX5f2o9S30skce6H3VFodfm0Op7c58ny6/W4EdRjax0PhnIPQhlw03gBEb6NZ7E9Q 1CjWWTQOggUZqEdy6xkMpL4GLOvij1hHGoAg9FpoWXmuImqNX9qgvIBa97w0VYMv5Lca NYaonThNf00cZqwPc68njM0sn1mjv16jNZYFHrLYQRjlMMoYOFDrjrBnrc5EDTEikLQ5 Noj5qn8ruT0mJRjtLMEz5nByZU7Ge2xC9nmZVI2Oux1jjElPBSZvPxD6y+yZtiUn3rim VWmQ== X-Gm-Message-State: ALoCoQkPdN95TwSQBEt1eoiQa/o7p5nlqKjQXOwEf/NUYHfZcr63vmxSAlSRtH8fDRdvdrhkbTKg X-Received: by 10.180.36.138 with SMTP id q10mr3571013wij.4.1400853517148; Fri, 23 May 2014 06:58: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 l4sm4016261wjf.14.2014.05.23.06.58.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 06:58:36 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Subject: [RFC v2 10/10] serial: asc: Add support for KGDB's FIQ/NMI mode Date: Fri, 23 May 2014 14:57:58 +0100 Message-Id: <1400853478-5824-11-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400853478-5824-1-git-send-email-daniel.thompson@linaro.org> References: <1400083125-1464-1-git-send-email-daniel.thompson@linaro.org> <1400853478-5824-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_065858_991151_106DE0F8 X-CRM114-Status: GOOD ( 17.68 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , kernel@stlinux.com, kgdb-bugreport@lists.sourceforge.net, Linus Walleij , Patrice Chotard , 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, Maxime Coquelin , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Colin Cross , Frederic Weisbecker , Christoffer Dall , Srinivas Kandagatla 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 If the platform bus has provided the st-asc with a FIQ resource (i.e. a second IRQ) then speculatively register it with KGDB when the polling driver is initialized. By providing this information to KGDB the serial driver offers "permission" for KGDB to route the UART interrupt signal from the drivers own handler to KGDBs FIQ handler (which will eventually use the UART's polled I/O callbacks to interact with the user). This permission also implies the st-asc driver has already unmasked RX interrupts (otherwise the FIQ handler will never trigger). This unmask is copied from similar code in amba-pl011.c . Signed-off-by: Daniel Thompson Cc: Srinivas Kandagatla Cc: Maxime Coquelin Cc: Patrice Chotard Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: kernel@stlinux.com Cc: linux-serial@vger.kernel.org --- drivers/tty/serial/st-asc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index c7f61ac..328720f 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" @@ -39,6 +40,7 @@ struct asc_port { struct uart_port port; struct clk *clk; + int fiq; unsigned int hw_flow_control:1; unsigned int force_m1:1; }; @@ -613,6 +615,26 @@ asc_verify_port(struct uart_port *port, struct serial_struct *ser) } #ifdef CONFIG_CONSOLE_POLL + +#ifdef CONFIG_KGDB_FIQ +/* + * Prepare the UART to be used from kgdb's NMI support. + */ +static int asc_poll_init(struct uart_port *port) +{ + struct asc_port *ascport = container_of(port, struct asc_port, port); + + /* register the FIQ with kgdb */ + if (ascport->fiq >= 0) + kgdb_register_fiq(ascport->fiq); + + /* enable RX interrupts in case the interrupt is used for NMI entry. */ + asc_enable_rx_interrupts(port); + + return 0; +} +#endif /* CONFIG_KGDB_FIQ */ + /* * Console polling routines for writing and reading from the uart while * in an interrupt or debug context (i.e. kgdb). @@ -656,11 +678,15 @@ static struct uart_ops asc_uart_ops = { .verify_port = asc_verify_port, .pm = asc_pm, #ifdef CONFIG_CONSOLE_POLL +#ifdef CONFIG_KGDB_FIQ + .poll_init = asc_poll_init, +#endif /* CONFIG_KGDB_FIQ */ .poll_get_char = asc_get_poll_char, .poll_put_char = asc_put_poll_char, #endif /* CONFIG_CONSOLE_POLL */ }; + static int asc_init_port(struct asc_port *ascport, struct platform_device *pdev) { @@ -673,6 +699,7 @@ static int asc_init_port(struct asc_port *ascport, port->fifosize = ASC_FIFO_SIZE; port->dev = &pdev->dev; port->irq = platform_get_irq(pdev, 0); + ascport->fiq = platform_get_irq(pdev, 1); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); port->membase = devm_ioremap_resource(&pdev->dev, res);