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: 30792 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9058F20369 for ; Fri, 23 May 2014 13:58:39 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id uo5sf18284901pbc.8 for ; Fri, 23 May 2014 06:58:38 -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=/anrjFkiEbrPWjHQiST6J5BiiE3Zr11S2d1LSm8C1Bg=; b=L5GbdAeNi5fFhreGINPBO1TNGOJ4PibpxCQ0mifVRSzSCRuvmN7peIfQ9ClF/0sldD V1TgJr2RQYV7NnTLhtKfzXdBWKM+rji6IbGmGx30OFHy29SCXrw9S/oLSK/S1lD3Ur6u q1xlcdrLK6ZMDTAn4MrE2+TSmvqOOhHnM0tBDAnv/ap1drLpmEm/nz8pikLS5EtSyE4X iD9IWfeULD79Biy6aZhneAUuKSBV+66V5pcB59gTq22Si7fQgvuVearoLNnhTUGG8i89 qipaocm/5pUj19mqjFBP9JMJ162mKr9NOZxaNHQSH+2B5LdJtBs8g8ULFrz9GlVQ1+vq XT3w== X-Gm-Message-State: ALoCoQluBDkUSN/lCxWRmdb0W5BHwBziuIShHflwH6Pelp5kRoQkpNh7v3fdFEY6y/pMFYcoV1Py X-Received: by 10.66.66.109 with SMTP id e13mr2121266pat.1.1400853518785; Fri, 23 May 2014 06:58:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.87 with SMTP id v81ls1741933qge.0.gmail; Fri, 23 May 2014 06:58:38 -0700 (PDT) X-Received: by 10.58.196.231 with SMTP id ip7mr863970vec.47.1400853518586; Fri, 23 May 2014 06:58:38 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id ob8si1666032vcb.22.2014.05.23.06.58.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 06:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so6232128veb.2 for ; Fri, 23 May 2014 06:58:38 -0700 (PDT) X-Received: by 10.221.69.68 with SMTP id yb4mr566865vcb.49.1400853518514; Fri, 23 May 2014 06:58:38 -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.220.221.72 with SMTP id ib8csp33836vcb; Fri, 23 May 2014 06:58:38 -0700 (PDT) X-Received: by 10.180.96.225 with SMTP id dv1mr3461341wib.37.1400853517671; Fri, 23 May 2014 06:58:37 -0700 (PDT) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id g10si2557528wjs.129.2014.05.23.06.58.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 06:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.177 as permitted sender) client-ip=74.125.82.177; Received: by mail-we0-f177.google.com with SMTP id x48so4826030wes.22 for ; Fri, 23 May 2014 06:58:37 -0700 (PDT) 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 Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, patches@linaro.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, John Stultz , Anton Vorontsov , Colin Cross , Dirk Behme , kernel-team@android.com, Russell King , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Thomas Gleixner , Greg Kroah-Hartman , Jiri Slaby , "David A. Long" , Nicolas Pitre , Catalin Marinas , Frederic Weisbecker , Linus Walleij , Christoffer Dall , kernel@stlinux.com, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Srinivas Kandagatla , Maxime Coquelin , Patrice Chotard 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-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.128.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: , 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);