Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736831
| From | Martyn Welch <martyn.welch@collabora.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 4/6] serial: imx: unmap sg buffers when DMA channel is released |
| Date | 2017-09-21 18:20 +0200 |
| Message-ID | <uscmK-3iX-39@gated-at.bofh.it> (permalink) |
| References | <uscmJ-3iX-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Nandor Han <nandor.han@ge.com>
This commits unmaps sg buffers when the DMA channel is released. It also
sets to zero `dma_is_rxing` and `dma_is_txing` to state that the
corresponding channels cannot transmit/receive data, as these are
disabled.
Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---
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 2fb3210..ed02783 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -357,6 +357,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)
@@ -366,6 +372,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;
+ }
}
/*
--
1.8.3.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/6] serial: imx: various improvements Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
[PATCH v3 3/6] serial: imx: Simplify DMA disablement Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
[PATCH v3 6/6] serial: imx: Fix imx_shutdown procedure Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
[PATCH v3 4/6] serial: imx: unmap sg buffers when DMA channel is released Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
Re: [PATCH v3 4/6] serial: imx: unmap sg buffers when DMA channel is released Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-09-21 20:30 +0200
[PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from imx_disable_dma Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:30 +0200
Re: [PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from imx_disable_dma Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-09-21 20:30 +0200
Re: [PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from imx_disable_dma Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 21:20 +0200
csiph-web