From patchwork Tue Jan 7 10:45:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 3447081 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0D068C02DC for ; Tue, 7 Jan 2014 10:48:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECFB92011E for ; Tue, 7 Jan 2014 10:48:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 DC1A620109 for ; Tue, 7 Jan 2014 10:48:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0UC3-0003hh-Td; Tue, 07 Jan 2014 10:47:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0UBh-0003ER-3s; Tue, 07 Jan 2014 10:47:09 +0000 Received: from eusmtp01.atmel.com ([212.144.249.243]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0UBe-0003DH-If for linux-arm-kernel@lists.infradead.org; Tue, 07 Jan 2014 10:47:06 +0000 Received: from tenerife.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.2.347.0; Tue, 7 Jan 2014 11:46:42 +0100 From: Nicolas Ferre To: Subject: [PATCH 4/4] tty/serial: at91: reset rx_ring when port is shutdown Date: Tue, 7 Jan 2014 11:45:09 +0100 Message-ID: X-Mailer: git-send-email 1.8.2.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140107_054706_723931_87B6AFAC X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -2.2 (--) Cc: mdeneen@gmail.com, Nicolas Ferre , linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-serial@vger.kernel.org, mark.roszko@gmail.com, Leilei Zhao , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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, 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 From: Mark Deneen When using RX DMA, the driver won't pass any data to the uart layer until the buffer is flipped. When the port is shutdown, the dma buffers are unmapped, but the head and tail of the ring buffer are not reseted. Since the serial console will keep the port open, this will only present itself when the uart is not shared. To reproduce the issue, with an unpatched driver, run a getty on /dev/ttyS0 with no serial console and exit. Getty will exit, and when the new one returns you will be unable to log in. If you hold down a key long enough to fill the DMA buffer and flip it, you can then log in. Signed-off-by: Mark Deneen Acked-by: Leilei Zhao [nicolas.ferre@atmel.com: adapt to mainline kernel, handle !DMA case] Cc: # v3.12 Signed-off-by: Nicolas Ferre --- drivers/tty/serial/atmel_serial.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 6e68486c83cb..2d925455c1ec 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1681,6 +1681,12 @@ static void atmel_shutdown(struct uart_port *port) atmel_port->release_tx(port); /* + * Reset ring buffer pointers + */ + atmel_port->rx_ring.head = 0; + atmel_port->rx_ring.tail = 0; + + /* * Free the interrupt */ free_irq(port->irq, port);