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: 35642 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ABE81202DD for ; Tue, 19 Aug 2014 16:57:49 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf51489472pde.2 for ; Tue, 19 Aug 2014 09:57:43 -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=igtABmpAweoOkZ8Ymillr+NDkhvuNpPei5flXnEx+oxE+q4lUjKSJspmQShntb51rO I1U0U6CdeoS8x4FrRO14ZtDdWcNGAxWVvxu84sSIpWPS53tUXIc5ajSwkP+G1rObrUir vynY84zSt1agbNEg5Bo7ZBHD+GJeXe7DBHH60wSI4t1VxtryTEw30qi5y8xdURXjSa0C Ykl8YWSGkRXl8N+5at//iM9qH2JtX/7r05LBoCC4ErwCSYSoX1hZasJfWfydrn6wP/xY FdrzEyhKT8TwunlTEG/JYdmDgI/JsXBvS8MQrQW8sxRhF08SizUxVnT0qCDWNnO5Cils KzEg== X-Gm-Message-State: ALoCoQnA6ppWbJAfLKSsqi/b+xXqphpLHI2Xl6wmRWwzXMtI/58Slfp22gGrDF2lGEP/WYB9HjVn X-Received: by 10.70.87.202 with SMTP id ba10mr22445850pdb.1.1408467463342; Tue, 19 Aug 2014 09:57:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.228 with SMTP id b91ls1299061qge.88.gmail; Tue, 19 Aug 2014 09:57:43 -0700 (PDT) X-Received: by 10.52.127.5 with SMTP id nc5mr1318529vdb.59.1408467463236; Tue, 19 Aug 2014 09:57:43 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id l12si2396097vcy.45.2014.08.19.09.57.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 09:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so7769043vcb.16 for ; Tue, 19 Aug 2014 09:57:43 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr674929vcb.71.1408467463118; Tue, 19 Aug 2014 09:57:43 -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.37.5 with SMTP id tc5csp255141vcb; Tue, 19 Aug 2014 09:57:42 -0700 (PDT) X-Received: by 10.180.80.165 with SMTP id s5mr8037389wix.61.1408467461882; Tue, 19 Aug 2014 09:57:41 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx.google.com with ESMTPS id d2si41317wix.49.2014.08.19.09.57.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 09:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id d1so5606440wiv.9 for ; Tue, 19 Aug 2014 09:57:41 -0700 (PDT) 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 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 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-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.171 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 */