summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/imx.c
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2018-03-21 18:45:06 +0200
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:26:01 +0800
commit9980c095197a680a94f12b2a3d2b989147e33472 (patch)
tree19580071ade355c0fa9b3b4af4d40286b2cb282e /drivers/tty/serial/imx.c
parent9c2e65d02dbeb499576d91939902c285cb37c296 (diff)
Revert "serial: imx: drop useless member from driver data"
This reverts commit 64432a855148fd858e228a0faaebe7036a549706.
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r--drivers/tty/serial/imx.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 18154be26855..3b971fa6fba3 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -227,6 +227,7 @@ struct imx_port {
dma_cookie_t rx_cookie;
unsigned int tx_bytes;
unsigned int dma_tx_nents;
+ wait_queue_head_t dma_wait;
unsigned int saved_reg[10];
bool context_saved;
};
@@ -505,12 +506,20 @@ static void dma_tx_callback(void *data)
sport->dma_is_txing = 0;
+ spin_unlock_irqrestore(&sport->port.lock, flags);
+
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(&sport->port);
+ if (waitqueue_active(&sport->dma_wait)) {
+ wake_up(&sport->dma_wait);
+ dev_dbg(sport->port.dev, "exit in %s.\n", __func__);
+ return;
+ }
+
+ spin_lock_irqsave(&sport->port.lock, flags);
if (!uart_circ_empty(xmit) && !uart_tx_stopped(&sport->port))
imx_dma_tx(sport);
-
spin_unlock_irqrestore(&sport->port.lock, flags);
}
@@ -1207,6 +1216,8 @@ static void imx_enable_dma(struct imx_port *sport)
{
unsigned long temp;
+ init_waitqueue_head(&sport->dma_wait);
+
/* set UCR1 */
temp = readl(sport->port.membase + UCR1);
temp |= UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN;