diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2016-06-26 09:20:21 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-26 17:57:13 (GMT) |
commit | 5fd2b6ee7a319e0955acff96948fae57321b1f5a (patch) | |
tree | 07c134bb52fbd413e04e8acd1480a36b3e29cc6a /drivers/tty | |
parent | 755dd8aa12d162e40f3c5bd0031ad2f29ce6bc68 (diff) | |
download | linux-5fd2b6ee7a319e0955acff96948fae57321b1f5a.tar.xz |
serial: sh-sci: Stop transfers in sci_shutdown()
Make sure the transmitter and receiver are stopped when shutting down
the port, and related interrupts are disabled.
Without this:
- New input data may be received into the RX FIFO, possibly
triggering a new RX DMA completion,
- Transfers will still be enabled on a subsequent startup of the UART,
before the UART's FIFOs have been reset, causing reading of stale
data.
Inspired by a patch in the BSP by Koji Matsuoka
<koji.matsuoka.xm@renesas.com>.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 432d9ac..d86eee3 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1989,6 +1989,7 @@ static void sci_shutdown(struct uart_port *port) { struct sci_port *s = to_sci_port(port); unsigned long flags; + u16 scr; dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); @@ -1998,6 +1999,9 @@ static void sci_shutdown(struct uart_port *port) spin_lock_irqsave(&port->lock, flags); sci_stop_rx(port); sci_stop_tx(port); + /* Stop RX and TX, disable related interrupts, keep clock source */ + scr = serial_port_in(port, SCSCR); + serial_port_out(port, SCSCR, scr & (SCSCR_CKE1 | SCSCR_CKE0)); spin_unlock_irqrestore(&port->lock, flags); #ifdef CONFIG_SERIAL_SH_SCI_DMA |