From patchwork Tue Aug 19 16:46:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4744861 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 788E2C033C for ; Tue, 19 Aug 2014 17:00:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 697922010F for ; Tue, 19 Aug 2014 17:00:54 +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 3FAC0200F2 for ; Tue, 19 Aug 2014 17:00:53 +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 1XJmk4-0007xQ-Pk; Tue, 19 Aug 2014 16:58:40 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJmjT-0007PF-JJ for linux-arm-kernel@lists.infradead.org; Tue, 19 Aug 2014 16:58:04 +0000 Received: by mail-wi0-f181.google.com with SMTP id bs8so5624601wib.8 for ; Tue, 19 Aug 2014 09:57:41 -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=H/OVumPYHu57WxdFIo4QtoQh8hH1r+NiM0qdefaYdVU=; b=afjcZqKxJqt6Toeub1jUu7u1NaBRkXSsOaDq/HJHvYJpc9Z+58cm1rY67zvALp/IX8 VDLoIKwtNO6sFwvj7xSNgTQwGExECVlTEcBxHptufNoDT5qfiMyKBTA9MCD5FFb8MsC3 xeY60CCHuKqlvEnxMGMRPmCFw3Dg0uAnWcwA5W+WE4VjZbD3J3Tuzmun7iUSdXr+izbt G+DBd/TmzM1WCzkkzICwJV0p3cf4fPHXqOVRFEQ3MGQerA/BItEVdPrC5kw11s9tw1dY Hiq3ynaSIzctdT0vGaZBMV4+Tnndf/te7ZFV1LahRg1DfWVK/aY6P3fXsgpEfSn6begB zCvg== X-Gm-Message-State: ALoCoQlDYVfLMyodhY0dh9Jgs6606kDYECMdAlgkBgSn6qJKSDERPHqOaKNBzI2ktQkH9iZmDHSj X-Received: by 10.194.89.168 with SMTP id bp8mr28527275wjb.53.1408467461453; Tue, 19 Aug 2014 09:57:41 -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 gc8sm36225wic.3.2014.08.19.09.57.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2014 09:57:40 -0700 (PDT) From: Daniel Thompson To: Russell King Subject: [PATCH v10 16/19] serial: asc: Add support for KGDB's FIQ/NMI mode Date: Tue, 19 Aug 2014 17:46:06 +0100 Message-Id: <1408466769-20004-17-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1408466769-20004-1-git-send-email-daniel.thompson@linaro.org> References: <1408369264-14242-1-git-send-email-daniel.thompson@linaro.org> <1408466769-20004-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140819_095803_788989_4A76E3AF X-CRM114-Status: GOOD ( 16.42 ) X-Spam-Score: -0.7 (/) Cc: kernel@stlinux.com, Catalin Marinas , Linus Walleij , Patrice Chotard , Fabio Estevam , Daniel Thompson , Nicolas Pitre , Jiri Slaby , Anton Vorontsov , Ben Dooks , linux-serial@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, kernel-team@android.com, Dave Martin , linaro-kernel@lists.linaro.org, patches@linaro.org, John Stultz , linux-arm-kernel@lists.infradead.org, Maxime Coquelin , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Colin Cross , Frederic Weisbecker , Srinivas Kandagatla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Add a .poll_init() function that enables UART RX and registers the UART's irq with KGDB. 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). Note that the RX is not only enabled but also unmasked. This is required because otherwise the FIQ handler could 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 8b2d735..2b5eb6e 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" @@ -607,6 +608,25 @@ 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 */ + kgdb_register_fiq(ascport->port.irq); + + /* 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). @@ -649,6 +669,9 @@ 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 */