From patchwork Wed Jul 5 13:07:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9826487 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 DE0F160237 for ; Wed, 5 Jul 2017 13:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E129D1FE76 for ; Wed, 5 Jul 2017 13:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5A0F28538; Wed, 5 Jul 2017 13:08:18 +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=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 7D5E9283F2 for ; Wed, 5 Jul 2017 13:08:18 +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=gUAQa5Yefl5OCBNDXbOz9G0aSpj1ZI5zqrPgENsaD00=; b=NSB+kcFQLd6EkWcJuCncKP3+HH eYxPsY7yNL2r4UXaKqnuXfkxnOZCfuJ9bvkYSkfN1ZNhKfVbiFadHgJi3xmQTcdGqJWJgYjfQX3ny vwBqdhDDd1dYD8Pirn/4ZNddEtYvp59RQByhP8Cu6neZgCUvNp9JcWySOa+0Fb6J3Ab8tnNK8IZwl tEOPofROZXw2kkeWeocxcGi8RYf4EDml5veWZO6BkuII30kY9hFhZcLQMJEkr4WUeTEeUWLzuqg/J ve0QErlB+TjneDDpJh0XoNTskhM4ZlDeVE76Ipbsn9A5GgmTzMG7ZzlHX8eK7yDdk+26xzPhKaD/b iyQtKbsA==; 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 1dSk2S-0004YO-NN; Wed, 05 Jul 2017 13:08:16 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dSk2C-0004FC-FS for linux-arm-kernel@lists.infradead.org; Wed, 05 Jul 2017 13:08:03 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id F1644260368 From: Romain Perier To: Greg Kroah-Hartman Subject: [PATCH v2 2/6] serial: imx: Simplify DMA disablement Date: Wed, 5 Jul 2017 15:07:02 +0200 Message-Id: <20170705130706.10388-3-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_060800_716275_732D9512 X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. 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 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 --- drivers/tty/serial/imx.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 01df430..5291b86 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -360,6 +360,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 */ @@ -1228,12 +1246,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); /* clear UCR2 */ temp = readl(sport->port.membase + UCR2);