From patchwork Fri Feb 13 18:51:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 5826881 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 49B0EBF440 for ; Fri, 13 Feb 2015 18:54:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B45020266 for ; Fri, 13 Feb 2015 18:54:09 +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 5E98D2022D for ; Fri, 13 Feb 2015 18:54:08 +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 1YMLLE-0003zV-HB; Fri, 13 Feb 2015 18:51:52 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:db:abcd:42:0:1]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YMLL7-0003oo-6v for linux-arm-kernel@lists.infradead.org; Fri, 13 Feb 2015 18:51:46 +0000 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1YMLKe-0003wK-1D; Fri, 13 Feb 2015 19:51:16 +0100 Date: Fri, 13 Feb 2015 19:51:16 +0100 From: Sebastian Andrzej Siewior To: Peter Hurley Subject: Re: [PATCH 03/16] tty: serial: 8250_core: read only RX if there is something in the FIFO Message-ID: <20150213185115.GF5482@linutronix.de> References: <54D9441B.7070403@hurleysoftware.com> <54D9F3C7.5000809@freebox.fr> <54DA43F8.9090904@hurleysoftware.com> <54DBB531.2030504@hurleysoftware.com> <20150211200313.GE2531@atomide.com> <54DBBE9E.90104@hurleysoftware.com> <54DC6832.3070507@linutronix.de> <54DCD584.3010500@hurleysoftware.com> <20150212192333.GA18882@linutronix.de> <54DD053A.8060905@hurleysoftware.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54DD053A.8060905@hurleysoftware.com> X-Key-Id: 97C4700B X-Key-Fingerprint: 09E2 D1F3 9A3A FF13 C3D3 961C 0688 1C1E 97C4 700B User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150213_105145_407324_AA40C447 X-CRM114-Status: GOOD ( 14.39 ) X-Spam-Score: -2.3 (--) Cc: Nicolas Schichan , Tony Lindgren , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, balbi@ti.com, linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Something like this maybe? Subject: [PATCH] serial: 8250: skip empty RX-read only on OMAP The conditional RX-FIFO read seems to cause spurious interrupts and we see just: |serial8250: too much work for irq29 The previous behaviour was "default" for decades and Marvell's 88f6282 SoC might not be the only that relies on it. Therefore this patch moves this special OMAP3630 behaviour befind a BUG field. Fixes: 0aa525d11859 ("tty: serial: 8250_core: read only RX if there is something in the FIFO") Reported-By: Nicolas Schichan Debuged-By: Peter Hurley Signed-off-by: Sebastian Andrzej Siewior --- drivers/tty/serial/8250/8250.h | 1 + drivers/tty/serial/8250/8250_core.c | 10 ++++++++-- drivers/tty/serial/8250/8250_omap.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index b00836851061..b6899fd69c7e 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -84,6 +84,7 @@ struct serial8250_config { #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ #define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */ +#define UART_BUG_RXEMPT (1 << 5) /* UART can not read empty FIFO */ #define PROBE_RSA (1 << 0) #define PROBE_ANY (~0) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index e3b9570a1eff..185386178023 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -2137,8 +2137,13 @@ int serial8250_do_startup(struct uart_port *port) /* * Clear the interrupt registers. + * + * This (and later) unsolicied read of the RX FIFO seems to clear the + * RX timeout condition which otherwise generates spurious interrupt. + * This behaviour has been observed on Marvell's 88f6282 SoC. */ - if (serial_port_in(port, UART_LSR) & UART_LSR_DR) + if (!(up->bugs & UART_BUG_RXEMPT) || + (serial_port_in(port, UART_LSR) & UART_LSR_DR)) serial_port_in(port, UART_RX); serial_port_in(port, UART_IIR); serial_port_in(port, UART_MSR); @@ -2300,7 +2305,8 @@ int serial8250_do_startup(struct uart_port *port) * saved flags to avoid getting false values from polling * routines or the previous session. */ - if (serial_port_in(port, UART_LSR) & UART_LSR_DR) + if (!(up->bugs & UART_BUG_RXEMPT) || + (serial_port_in(port, UART_LSR) & UART_LSR_DR)) serial_port_in(port, UART_RX); serial_port_in(port, UART_IIR); serial_port_in(port, UART_MSR); diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index fe6d2e51da09..a7ead2fa6a32 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -1021,6 +1021,7 @@ static int omap8250_probe(struct platform_device *pdev) up.port.fifosize = 64; up.tx_loadsz = 64; up.capabilities = UART_CAP_FIFO; + up.bugs = UART_BUG_RXEMPT; #ifdef CONFIG_PM /* * Runtime PM is mostly transparent. However to do it right we need to a