From patchwork Wed May 14 15:58:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 30175 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF10420446 for ; Wed, 14 May 2014 15:59:39 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q108sf4244600qgd.11 for ; Wed, 14 May 2014 08:59:39 -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=kO72XDDUQ/ucO4BLR+d4a8khxCwu7S0Xh8m/aiwygC8=; b=llDdoNU9B5WUXXjUmaN8G9eVONVpI9VwGRjnIbRyqJUcMG3PnKi03xhluRfHx4mPOx 4XtBIAt29vRtykPE2nfABwXtbtNEUUHbLpIdj/5c46ajc34OEKSxQyoLSMRIabQURxQd b+IvPGRzLp8jyFRJaNlYxPYYehu3I0V1DMYY9HLkKXv7JDh9C4InDsbWuk8CH9Sf1fKH ncaHweNmbrXnMCKtKm7ArGEHBkSacvYIWXsANsf4EiCqnF/QRhLBoHTX4hiun3mYcdhC BuEKNb9flCMM17g+chDC1yFWvaztyZII1flyLXDnuzjNmBfrhDI8PAnO/nEyAW6WUvTf aisw== X-Gm-Message-State: ALoCoQkmyo9Cmie+rF3FIhnSIWXvy2Az79l/eSkEnaughTe72SGgQH41NTdKjOZsaToB5K6PVu9m X-Received: by 10.236.142.212 with SMTP id i60mr1660023yhj.39.1400083179520; Wed, 14 May 2014 08:59:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.100 with SMTP id o91ls2443433qgd.30.gmail; Wed, 14 May 2014 08:59:39 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr3744768vcy.8.1400083179401; Wed, 14 May 2014 08:59:39 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id fj7si401357vec.13.2014.05.14.08.59.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 08:59:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so2715678vcb.18 for ; Wed, 14 May 2014 08:59:39 -0700 (PDT) X-Received: by 10.53.13.133 with SMTP id ey5mr1511360vdd.8.1400083179333; Wed, 14 May 2014 08:59:39 -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 ib8csp251771vcb; Wed, 14 May 2014 08:59:38 -0700 (PDT) X-Received: by 10.180.93.41 with SMTP id cr9mr26839503wib.7.1400083178468; Wed, 14 May 2014 08:59:38 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by mx.google.com with ESMTPS id b11si837265wjr.223.2014.05.14.08.59.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 08:59:38 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.41 as permitted sender) client-ip=74.125.82.41; Received: by mail-wg0-f41.google.com with SMTP id z12so2163589wgg.24 for ; Wed, 14 May 2014 08:59:37 -0700 (PDT) X-Received: by 10.180.206.36 with SMTP id ll4mr4082517wic.57.1400083177681; Wed, 14 May 2014 08:59: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 dn4sm4687808wib.18.2014.05.14.08.59.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 May 2014 08:59:36 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , kgdb-bugreport@lists.sourceforge.net Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, Daniel Thompson , 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 , linux-arm-kernel@lists.infradead.org, kernel@stlinux.com, devicetree@vger.kernel.org, linux-serial@vger.kernel.org Subject: [RFC 6/8] serial: asc: Add support for KGDB's FIQ/NMI mode Date: Wed, 14 May 2014 16:58:43 +0100 Message-Id: <1400083125-1464-7-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400083125-1464-1-git-send-email-daniel.thompson@linaro.org> References: <1400083125-1464-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.173 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: , For a serial driver to support FIQ/NMI debugging it must enable the RX interrupt when a polling client attaches itself (otherwise the FIQ signal will never be asserted). This concept is copied from similar code in amba-pl011.c . It must also register the appropriate FIQ number with kgdb. kgdb will use this to make calls to enable_fiq/disable_fiq/eoi_fiq. The FIQ number must be supplied via the devices bus (in this case platform bus). Signed-off-by: Daniel Thompson --- drivers/tty/serial/st-asc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index c7f61ac..e93803f 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" @@ -613,6 +614,14 @@ asc_verify_port(struct uart_port *port, struct serial_struct *ser) } #ifdef CONFIG_CONSOLE_POLL +static int asc_poll_init(struct uart_port *port) +{ + /* enable RX interrupts in case the interrupt is used for NMI entry. */ + asc_enable_rx_interrupts(port); + + return 0; +} + /* * Console polling routines for writing and reading from the uart while * in an interrupt or debug context (i.e. kgdb). @@ -656,11 +665,25 @@ static struct uart_ops asc_uart_ops = { .verify_port = asc_verify_port, .pm = asc_pm, #ifdef CONFIG_CONSOLE_POLL + .poll_init = asc_poll_init, .poll_get_char = asc_get_poll_char, .poll_put_char = asc_put_poll_char, #endif /* CONFIG_CONSOLE_POLL */ }; +#ifdef CONFIG_KGDB_FIQ +/* Register with KGDB if there is a FIQ linked to this device */ +static void asc_register_fiq(struct platform_device *pdev) +{ + int fiq = platform_get_irq(pdev, 1); + if (fiq >= 0) + kgdb_register_fiq(fiq); +} +#else +static void asc_register_fiq(struct platform_device *pdev) {} +#endif + + static int asc_init_port(struct asc_port *ascport, struct platform_device *pdev) { @@ -692,6 +715,8 @@ static int asc_init_port(struct asc_port *ascport, WARN_ON(ascport->port.uartclk == 0); clk_disable_unprepare(ascport->clk); + asc_register_fiq(pdev); + return 0; }