From patchwork Tue Sep 2 13:00:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4825551 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 7B01AC0338 for ; Tue, 2 Sep 2014 13:12:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A221F20170 for ; Tue, 2 Sep 2014 13:11:58 +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 EB41520155 for ; Tue, 2 Sep 2014 13:11: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 1XOnoq-000567-5b; Tue, 02 Sep 2014 13:08:20 +0000 Received: from mail-wi0-f178.google.com ([209.85.212.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XOnoM-0004Mq-Tv for linux-arm-kernel@lists.infradead.org; Tue, 02 Sep 2014 13:07:51 +0000 Received: by mail-wi0-f178.google.com with SMTP id r20so7837980wiv.5 for ; Tue, 02 Sep 2014 06:07:29 -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=evscmWWvJ6Y9R5Nr1oTU5oj6pmbPD2eNTZFnyK66nLG/V6qOgTTw/8Lc3TNjhZey7K ZNMRbwvh6Dz+/N0Cx8T2L4G/J/K5TjejxD1CO40wL5ruIYydQQIvHOXP0b9v3CM4flqw NiNdsMaPxR3ilG3Oz9lFC61ZY/EpwUBgcHMkydOAk1E7IVPBq0AvUdCLDSooW+6jIypU CCH79oAQqNDsIorlE+VgR42w43MgN8/JogVzV3yJcMQ0hxU+egb37mo8Jq9IUUQJUnBH oGGZ2yEUt/JAoLLQO0XgLzL713G9QPhzQa2Wfkoi0p9Zkn8bXacVfPIDvkGhbhnvjUcF HkYA== X-Gm-Message-State: ALoCoQk1tGSbg7QRhfgl+Mz6W6qfF572LAHOE0xOl+U5IEiALRR5fmhAkpKSHQFq1E+7rmXmbM1F X-Received: by 10.194.118.232 with SMTP id kp8mr39645799wjb.42.1409663248893; Tue, 02 Sep 2014 06:07:28 -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 ec2sm34928892wib.19.2014.09.02.06.07.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Sep 2014 06:07:27 -0700 (PDT) From: Daniel Thompson To: Russell King Subject: [PATCH v11 16/19] serial: asc: Add support for KGDB's FIQ/NMI mode Date: Tue, 2 Sep 2014 14:00:50 +0100 Message-Id: <1409662853-29313-17-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1409662853-29313-1-git-send-email-daniel.thompson@linaro.org> References: <1408466769-20004-1-git-send-email-daniel.thompson@linaro.org> <1409662853-29313-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140902_060751_119026_7FAEC452 X-CRM114-Status: GOOD ( 16.03 ) 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=-3.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 */