From patchwork Wed Jul 5 13:07:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9826493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3AC8E60237 for ; Wed, 5 Jul 2017 13:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A80E205AF for ; Wed, 5 Jul 2017 13:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E1CF283F2; Wed, 5 Jul 2017 13:09:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C39C205AF for ; Wed, 5 Jul 2017 13:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=GU5Ttcf+8FSext83Xd2XoO1krZgNjEQqwXaafwOZlHY=; b=TwmUauK0JsnBoUKd6O8LWdyJ4Y dsiu4mO2setd66nJqTufbA+Eb/hO43KtycCpe5oEZSYLfZq62Qb1lGHiIPqHwN/QHpIWglUV4+Bwc hF8dUoHRUpBWZnIUZxQHB4vvu7zP59/za6pPtUemUfY2GypAukzu9p0mPkf0HZbmyVI/1hRuu3AqT YFbVWEZkjDqKzZRNhcUa+0hGIRR58gntuNybXX5wmjLYlV25FRJSunWAExIe7oDfPvqUBAo7nCFeB HFqcUAINBDy8I0gq/OGdHo9gTTRANivDksSt/1pmFOXdND0mS/a3ErsL83yj/teWlZ4WN0sQA/2DZ qwuuIH3A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dSk3k-0005gp-Dt; Wed, 05 Jul 2017 13:09:36 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dSk2U-0004GQ-4d for linux-arm-kernel@lists.infradead.org; Wed, 05 Jul 2017 13:08:24 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id 575E526BFFB From: Romain Perier To: Greg Kroah-Hartman Subject: [PATCH v2 5/6] serial: imx: update the stop rx,tx procedures Date: Wed, 5 Jul 2017 15:07:05 +0200 Message-Id: <20170705130706.10388-6-romain.perier@collabora.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170705130706.10388-1-romain.perier@collabora.com> References: <20170705130706.10388-1-romain.perier@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170705_060818_969084_A3D345ED X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Perier , Nandor Han , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nandor Han According to "Documentation/serial/driver" both procedures should stop receiving or sending data. Based on this the procedures should stop the activity regardless if DMA is enabled or not. This commit updates both imx_stop_{rx|tx} procedures to stop the activity and disable the interrupts related to that. Signed-off-by: Nandor Han Signed-off-by: Romain Perier --- drivers/tty/serial/imx.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 3112d88..d35112f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -398,15 +398,14 @@ static void imx_stop_tx(struct uart_port *port) struct imx_port *sport = (struct imx_port *)port; unsigned long temp; - /* - * We are maybe in the SMP context, so if the DMA TX thread is running - * on other cpu, we have to wait for it to finish. - */ - if (sport->dma_is_enabled && sport->dma_is_txing) - return; + sport->tx_bytes = 0; + + if (sport->dma_is_enabled) + imx_stop_tx_dma(sport); temp = readl(port->membase + UCR1); - writel(temp & ~UCR1_TXMPTYEN, port->membase + UCR1); + temp &= ~(UCR1_TXMPTYEN | UCR1_TRDYEN | UCR1_RTSDEN); + writel(temp, port->membase + UCR1); /* in rs485 mode disable transmitter if shifter is empty */ if (port->rs485.flags & SER_RS485_ENABLED && @@ -433,21 +432,20 @@ static void imx_stop_rx(struct uart_port *port) struct imx_port *sport = (struct imx_port *)port; unsigned long temp; - if (sport->dma_is_enabled && sport->dma_is_rxing) { - if (sport->port.suspended) { - dmaengine_terminate_all(sport->dma_chan_rx); - sport->dma_is_rxing = 0; - } else { - return; - } - } + if (sport->dma_is_enabled) + imx_stop_rx_dma(sport); + + temp = readl(sport->port.membase + UCR1); + temp &= ~UCR1_RRDYEN; + writel(temp, sport->port.membase + UCR1); temp = readl(sport->port.membase + UCR2); - writel(temp & ~UCR2_RXEN, sport->port.membase + UCR2); + temp &= ~UCR2_ATEN; + writel(temp, sport->port.membase + UCR2); - /* disable the `Receiver Ready Interrrupt` */ - temp = readl(sport->port.membase + UCR1); - writel(temp & ~UCR1_RRDYEN, sport->port.membase + UCR1); + temp = readl(sport->port.membase + UCR3); + temp &= ~UCR3_AWAKEN; + writel(temp, sport->port.membase + UCR3); } /*