summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorRobert Baldyga <r.baldyga@samsung.com>2015-09-15 14:49:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 17:44:52 +0100
commit09557c0169d20585a12e2900fe6d00b5128e5ba8 (patch)
treede463a4ad4cd55aab0d3f67ce11a59b595b091d7 /drivers/tty
parent01732dd25c06c127b7a7fba1cf8daad60387795a (diff)
downloadtalos-obmc-linux-09557c0169d20585a12e2900fe6d00b5128e5ba8.tar.gz
talos-obmc-linux-09557c0169d20585a12e2900fe6d00b5128e5ba8.zip
serial: samsung: Fix UART status handling in DMA mode
So far, when interrupt occured in DMA mode, it was handled by terminating DMA transfer and draining data remaining in RX FIFO. It worked well until interrupt was caused by timeout, but the same interrupt can be alse caused by special condition (eg. 'break'), which requires special handling. In such case handling mechanism was the same - DMA transaction was terminated and FIFO was drained, but any special conditions were ingnored. Because of this in DMA mode there was no ability to use, for example, Magic SysRq. This patch fixes this problem by using s3c24xx_serial_rx_drain_fifo() function instead of uart_rx_drain_fifo(), which does the same thing (drains RX FIFO) plus checks UART status to detect special conditions (such as 'break'). Thanks to this we have exactly the same UART status handling in both DMA and PIO mode. This change additionally simplifies RX handling code, as we no longer need uart_rx_drain_fifo() function, so we can remove it. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/samsung.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 1d7dd8605b22..d72cd736bdc6 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -385,32 +385,6 @@ static void s3c24xx_uart_copy_rx_to_tty(struct s3c24xx_uart_port *ourport,
}
}
-static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport,
- unsigned long ufstat);
-
-static void uart_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
-{
- struct uart_port *port = &ourport->port;
- struct tty_port *tty = &port->state->port;
- unsigned int ch, ufstat;
- unsigned int count;
-
- ufstat = rd_regl(port, S3C2410_UFSTAT);
- count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
-
- if (!count)
- return;
-
- while (count-- > 0) {
- ch = rd_regb(port, S3C2410_URXH);
-
- ourport->port.icount.rx++;
- tty_insert_flip_char(tty, ch, TTY_NORMAL);
- }
-
- tty_flip_buffer_push(tty);
-}
-
static void s3c24xx_serial_stop_rx(struct uart_port *port)
{
struct s3c24xx_uart_port *ourport = to_ourport(port);
@@ -573,6 +547,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport)
ourport->rx_mode = S3C24XX_RX_PIO;
}
+static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport);
+
static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
{
unsigned int utrstat, ufstat, received;
@@ -606,7 +582,7 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
enable_rx_pio(ourport);
}
- uart_rx_drain_fifo(ourport);
+ s3c24xx_serial_rx_drain_fifo(ourport);
if (tty) {
tty_flip_buffer_push(t);
OpenPOWER on IntegriCloud