Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752720AbdGENHr (ORCPT ); Wed, 5 Jul 2017 09:07:47 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59321 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639AbdGENHp (ORCPT ); Wed, 5 Jul 2017 09:07:45 -0400 From: Romain Perier To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nandor Han , Romain Perier 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> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1605 Lines: 58 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); -- 1.8.3.1