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: 36481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 65955203BE for ; Tue, 2 Sep 2014 13:07:31 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id q200sf22862811ykb.5 for ; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=H/OVumPYHu57WxdFIo4QtoQh8hH1r+NiM0qdefaYdVU=; b=kWZkErIe67HRUl378fI3QmRqT1sPEcsVBwdMgFoOYLSppQQB4hifJqibalSrok4mIz kqGuBIq9WjhpHnpVLkiDSayGfvBexImnDHV9BkQckEJ3OnBiWzEsJ99fiX5R/rBe/8O+ zU+4vtFZTFgcLZLKgEASLbJrsZYYN3HHvWf5bxGbRyB/WbZ0Z/iJ6MnXDrAsuTfqdchD zO9C43aTPfNvxc9kBr5KJf8FQRcG5unUb+4KovksIV46zGU0PJfyJfQBZ7u3egidkwSq 4xMS+hcSdTp7UF2nCxege9aJo6CS1hWUhcyRN36bDQC4KX9GWViLsmeP1cULjS+SQjV6 qXzQ== X-Gm-Message-State: ALoCoQkUjVCaHanqZ4pFPxCuSOwLMrvz5Q8mSTr7f42OODvvDbMpI92PP6fC32mWgi/LXkzyIBn0 X-Received: by 10.236.126.103 with SMTP id a67mr19763485yhi.4.1409663251223; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.113 with SMTP id e104ls2334331qgd.33.gmail; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) X-Received: by 10.52.1.39 with SMTP id 7mr25399480vdj.17.1409663251132; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id k3si2220546vdq.67.2014.09.02.06.07.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Sep 2014 06:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so7041000vcb.1 for ; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) X-Received: by 10.220.17.145 with SMTP id s17mr13941vca.77.1409663251031; Tue, 02 Sep 2014 06:07:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp524801vcb; Tue, 2 Sep 2014 06:07:30 -0700 (PDT) X-Received: by 10.194.172.137 with SMTP id bc9mr16859331wjc.72.1409663249526; Tue, 02 Sep 2014 06:07:29 -0700 (PDT) Received: from mail-we0-f173.google.com (mail-we0-f173.google.com [74.125.82.173]) by mx.google.com with ESMTPS id dw7si15176249wib.14.2014.09.02.06.07.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Sep 2014 06:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.173 as permitted sender) client-ip=74.125.82.173; Received: by mail-we0-f173.google.com with SMTP id t60so6929517wes.32 for ; Tue, 02 Sep 2014 06:07:29 -0700 (PDT) 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 Cc: Daniel Thompson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Anton Vorontsov , Colin Cross , kernel-team@android.com, Rob Herring , Linus Walleij , Ben Dooks , Catalin Marinas , Dave Martin , Fabio Estevam , Frederic Weisbecker , Nicolas Pitre , Srinivas Kandagatla , Maxime Coquelin , Patrice Chotard , Greg Kroah-Hartman , Jiri Slaby , kernel@stlinux.com, linux-serial@vger.kernel.org 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */