From patchwork Thu Sep 21 16:18:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 9964239 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 AE25A6020C for ; Thu, 21 Sep 2017 16:19:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95A6A29541 for ; Thu, 21 Sep 2017 16:19:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A9A82956F; Thu, 21 Sep 2017 16:19:08 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham 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 37CCC2956C for ; Thu, 21 Sep 2017 16:19:06 +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=5EN6UKxOZkOuxNlovZHEZ340ZfkGzdlnDI5z+APIgis=; b=NtVkSlISBxd24AiA8JD95JXcR/ g14IkO6onz9ls+8FvlUY9L9u3Qx3zwpgoAxYveYCaidqmYxcn+dPawy2lc1RSPROybA2jCfpL/YkA Gv5axMvzkalqmAdyF1jAF46dYl7Yi6sgfcaFnifV8t94ogmZLzycdUWo3vgBPCo90cJx9awSA6tVt tsTELLZA7lN3Qog5On5a/gYJ6G3/1Zo6BpdDeDXb9GArlNzdGNWHZGIRdYROU1pYWZdXTD07QDLx1 TqqIrr52ThsXwLb2nvS270k59QtlYcafZSZ/x2FwpvOq1ZUeebLYaDipM2KKB2Pif17jRYP0jP5jC k5aNDPTA==; 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 1dv4Bm-0002gX-G9; Thu, 21 Sep 2017 16:18:58 +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 1dv4Bh-0002PA-Nt for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2017 16:18:56 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: martyn) with ESMTPSA id 12DEC26047F Received: by kratos.localdomain (Postfix, from userid 1000) id D8A4A204D84BB; Thu, 21 Sep 2017 17:18:22 +0100 (BST) From: Martyn Welch To: Greg Kroah-Hartman Subject: [PATCH v3 3/6] serial: imx: Simplify DMA disablement Date: Thu, 21 Sep 2017 17:18:14 +0100 Message-Id: <1506010697-22114-4-git-send-email-martyn.welch@collabora.co.uk> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506010697-22114-1-git-send-email-martyn.welch@collabora.co.uk> References: <1506010697-22114-1-git-send-email-martyn.welch@collabora.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170921_091854_018709_A30446E9 X-CRM114-Status: GOOD ( 10.68 ) 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: Martyn Welch , Nandor Han , linux-kernel@vger.kernel.org, Fabio Estevam , linux-serial@vger.kernel.org, u.kleine-koenig@pengutronix.de, Romain Perier , linux-arm-kernel@lists.infradead.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 This commits simplify the function imx_disable_dma() by moving the code for disabling RX and TX DMAs to dedicated functions. This is a preparation for the next commit. Signed-off-by: Nandor Han Signed-off-by: Romain Perier Signed-off-by: Martyn Welch --- drivers/tty/serial/imx.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 7835279..2fb3210 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -350,6 +350,24 @@ static void imx_port_rts_auto(struct imx_port *sport, unsigned long *ucr2) *ucr2 |= UCR2_CTSC; } +static void imx_stop_tx_dma(struct imx_port *sport) +{ + unsigned long temp; + + temp = readl(sport->port.membase + UCR1); + temp &= ~UCR1_TDMAEN; + writel(temp, sport->port.membase + UCR1); +} + +static void imx_stop_rx_dma(struct imx_port *sport) +{ + unsigned long temp; + + temp = readl(sport->port.membase + UCR1); + temp &= ~(UCR1_RDMAEN | UCR1_ATDMAEN); + writel(temp, sport->port.membase + UCR1); +} + /* * interrupts disabled on entry */ @@ -1217,13 +1235,8 @@ static void imx_enable_dma(struct imx_port *sport) static void imx_disable_dma(struct imx_port *sport) { - unsigned long temp; - - /* clear UCR1 */ - temp = readl(sport->port.membase + UCR1); - temp &= ~(UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN); - writel(temp, sport->port.membase + UCR1); - + imx_stop_rx_dma(sport); + imx_stop_tx_dma(sport); imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); sport->dma_is_enabled = 0;