From patchwork Fri Jun 30 12:04:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9819449 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 63E866035F for ; Fri, 30 Jun 2017 12:06:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54E7028615 for ; Fri, 30 Jun 2017 12:06:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49A0F28630; Fri, 30 Jun 2017 12:06:58 +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 CFFA128615 for ; Fri, 30 Jun 2017 12:06:57 +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=Jrj1COC5a/XaoFZXCodD2wtp5fewdDAPZAcy4oXKo2Y=; b=cy3BwIVT1Bkt5TQ3/Js/EXpMjF I8vqKzUXc06t7/DoBilCtoeyJrddfy5rT3b0UtrqPvBq1E3tODb/QkHVBHq8Qbp3zcc0AsEwjN2/4 yHJNt/5eGcn1bgKOQmAs7x9j5R6sv+nSRSXHiF6AcQfflxmK+gHhjGIVuylkR8jyn3AYBWJIxsAyf gwrD4PRXQDH24Ty3br8ZkK9Gyx+T6qzBqJILhP6l/PDwsZPRQk+OzhBdfEe6IZ5eME0q5SolH+uMB I/6Ya8HplFgUzXgnQ6qOGTA3g0mik7r6bY6UB72VeoOB+6kZzJcJFzDkmAqmWgt1jVUkpv9z3vAAu udxp2u2Q==; 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 1dQuhK-000183-3X; Fri, 30 Jun 2017 12:06:54 +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 1dQugA-00083R-IO for linux-arm-kernel@lists.infradead.org; Fri, 30 Jun 2017 12:05:47 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id F37EA26BF7F From: Romain Perier To: Greg Kroah-Hartman Subject: [PATCH 5/7] serial: imx: umap sg buffers when DMA channel is released Date: Fri, 30 Jun 2017 14:04:44 +0200 Message-Id: <20170630120446.13994-6-romain.perier@collabora.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170630120446.13994-1-romain.perier@collabora.com> References: <20170630120446.13994-1-romain.perier@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170630_050542_972231_17EF099F X-CRM114-Status: UNSURE ( 7.74 ) 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 unmaps sg buffers when the DMA channel is released Signed-off-by: Nandor Han Signed-off-by: Romain Perier --- drivers/tty/serial/imx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e8cf7cf..58d6b1c 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1215,6 +1215,12 @@ static void imx_stop_tx_dma(struct imx_port *sport) temp = readl(sport->port.membase + UCR1); temp &= ~UCR1_TDMAEN; writel(temp, sport->port.membase + UCR1); + + if (sport->dma_is_txing) { + dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], + sport->dma_tx_nents, DMA_TO_DEVICE); + sport->dma_is_txing = 0; + } } static void imx_stop_rx_dma(struct imx_port *sport) @@ -1224,6 +1230,12 @@ static void imx_stop_rx_dma(struct imx_port *sport) temp = readl(sport->port.membase + UCR1); temp &= ~(UCR1_RDMAEN | UCR1_ATDMAEN); writel(temp, sport->port.membase + UCR1); + + if (sport->dma_is_rxing) { + dma_unmap_sg(sport->port.dev, &sport->rx_sgl, 1, + DMA_FROM_DEVICE); + sport->dma_is_rxing = 0; + } } static void imx_enable_dma(struct imx_port *sport)