Commit d6b0d2f2 authored by Stefan Agner's avatar Stefan Agner Committed by Greg Kroah-Hartman

tty: serial: fsl_lpuart: support suspend/resume

Add suspend/resume support.
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b70b6361
...@@ -483,9 +483,8 @@ static void lpuart_dma_rx_complete(void *arg) ...@@ -483,9 +483,8 @@ static void lpuart_dma_rx_complete(void *arg)
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock_irqrestore(&sport->port.lock, flags);
} }
static void lpuart_timer_func(unsigned long data) static void lpuart_dma_rx_terminate(struct lpuart_port *sport)
{ {
struct lpuart_port *sport = (struct lpuart_port *)data;
struct tty_port *port = &sport->port.state->port; struct tty_port *port = &sport->port.state->port;
struct dma_tx_state state; struct dma_tx_state state;
unsigned long flags; unsigned long flags;
...@@ -510,6 +509,11 @@ static void lpuart_timer_func(unsigned long data) ...@@ -510,6 +509,11 @@ static void lpuart_timer_func(unsigned long data)
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock_irqrestore(&sport->port.lock, flags);
} }
static void lpuart_timer_func(unsigned long data)
{
lpuart_dma_rx_terminate((struct lpuart_port *)data);
}
static inline void lpuart_prepare_rx(struct lpuart_port *sport) static inline void lpuart_prepare_rx(struct lpuart_port *sport)
{ {
unsigned long flags; unsigned long flags;
...@@ -1931,7 +1935,12 @@ static int lpuart_suspend(struct device *dev) ...@@ -1931,7 +1935,12 @@ static int lpuart_suspend(struct device *dev)
writeb(temp, sport->port.membase + UARTCR2); writeb(temp, sport->port.membase + UARTCR2);
} }
if (sport->dma_rx_in_progress)
lpuart_dma_rx_terminate(sport);
uart_suspend_port(&lpuart_reg, &sport->port); uart_suspend_port(&lpuart_reg, &sport->port);
if (sport->port.suspended && !sport->port.irq_wake)
clk_disable_unprepare(sport->clk);
return 0; return 0;
} }
...@@ -1941,6 +1950,9 @@ static int lpuart_resume(struct device *dev) ...@@ -1941,6 +1950,9 @@ static int lpuart_resume(struct device *dev)
struct lpuart_port *sport = dev_get_drvdata(dev); struct lpuart_port *sport = dev_get_drvdata(dev);
unsigned long temp; unsigned long temp;
if (sport->port.suspended && !sport->port.irq_wake)
clk_prepare_enable(sport->clk);
if (sport->lpuart32) { if (sport->lpuart32) {
lpuart32_setup_watermark(sport); lpuart32_setup_watermark(sport);
temp = lpuart32_read(sport->port.membase + UARTCTRL); temp = lpuart32_read(sport->port.membase + UARTCTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment