From patchwork Fri Nov 28 00:23:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 5400451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 496679F1C5 for ; Fri, 28 Nov 2014 00:27:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0CA120142 for ; Fri, 28 Nov 2014 00:27:01 +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 CB3932012E for ; Fri, 28 Nov 2014 00:27:00 +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 1Xu9Mj-0007PE-6n; Fri, 28 Nov 2014 00:24:53 +0000 Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xu9Lj-0006rJ-BW for linux-arm-kernel@lists.infradead.org; Fri, 28 Nov 2014 00:23:53 +0000 Received: from trochilidae.agner.local (195-226-23-137.pool.cyberlink.ch [195.226.23.137]) by mail.kmu-office.ch (Postfix) with ESMTPSA id B156F5E35A4; Fri, 28 Nov 2014 01:23:03 +0100 (CET) From: Stefan Agner To: gregkh@linuxfoundation.org Subject: [PATCH 3/4] serial: fsl_lpuart: avoid new transfer while DMA is running Date: Fri, 28 Nov 2014 01:23:24 +0100 Message-Id: <1417134205-4400-4-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417134205-4400-1-git-send-email-stefan@agner.ch> References: <1417134205-4400-1-git-send-email-stefan@agner.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141127_162351_628510_518E17ED X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: 0.0 (/) Cc: linux-kernel@vger.kernel.org, stefan@agner.ch, linux-serial@vger.kernel.org, jingchang.lu@freescale.com, shawn.guo@linaro.org, jslaby@suse.cz, 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 When the UART is DMA receive mode (RDMAS set) and a character just arrived, while another interrupt is handled, the RDRF (receiver data register full flag) is set. But since the DMA will take care of it there is no need to handle it by calling lpuart_prepare_rx. Handling it leads in adding the RX timeout timer twice: [ 43.528029] Kernel BUG at 8004ee7c [verbose debug info unavailable] [ 43.534329] Internal error: Oops - BUG: 0 [#1] ARM [ 43.539145] Modules linked in: [ 43.542242] CPU: 0 PID: 0 Comm: swapper Not tainted 3.18.0-rc5-00014-ge956e1a-dirty #1293 [ 43.550448] task: 80795630 ti: 8078a000 task.ti: 8078a000 [ 43.555886] PC is at add_timer+0x24/0x28 [ 43.559833] LR is at lpuart_int+0x188/0x3b0 [ 43.564039] pc : [<8004ee7c>] lr : [<802cbd3c>] psr: a0000193 [ 43.564039] sp : 8078be18 ip : 8078be28 fp : 8078be24 [ 43.575560] r10: 8e80b840 r9 : 807d23ff r8 : 20000193 [ 43.580812] r7 : 00000020 r6 : 00000001 r5 : 000000a0 r4 : 8e994e10 [ 43.587368] r3 : ffff9bd1 r2 : 80815360 r1 : 8e994e10 r0 : 8e994f20 [ 43.593923] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [ 43.601352] Control: 10c5387d Table: 8c424059 DAC: 00000015 [ 43.607125] Process swapper (pid: 0, stack limit = 0x8078a238) ... Signed-off-by: Stefan Agner --- drivers/tty/serial/fsl_lpuart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 629291d..be9ccdf 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -756,18 +756,18 @@ out: static irqreturn_t lpuart_int(int irq, void *dev_id) { struct lpuart_port *sport = dev_id; - unsigned char sts; + unsigned char sts, crdma; sts = readb(sport->port.membase + UARTSR1); + crdma = readb(sport->port.membase + UARTCR5); - if (sts & UARTSR1_RDRF) { + if (sts & UARTSR1_RDRF && !(crdma & UARTCR5_RDMAS)) { if (sport->lpuart_dma_rx_use) lpuart_prepare_rx(sport); else lpuart_rxint(irq, dev_id); } - if (sts & UARTSR1_TDRE && - !(readb(sport->port.membase + UARTCR5) & UARTCR5_TDMAS)) { + if (sts & UARTSR1_TDRE && !(crdma & UARTCR5_TDMAS)) { if (sport->lpuart_dma_tx_use) lpuart_pio_tx(sport); else