Commit 68a784cb authored by Sonic Zhang's avatar Sonic Zhang Committed by Linus Torvalds

Blackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over UART in DMA mode

Add spin_lock_irqsave() when receive and transfer data.
Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b6efa1ea
...@@ -81,7 +81,9 @@ static void bfin_serial_reset_irda(struct uart_port *port); ...@@ -81,7 +81,9 @@ static void bfin_serial_reset_irda(struct uart_port *port);
static void bfin_serial_stop_tx(struct uart_port *port) static void bfin_serial_stop_tx(struct uart_port *port)
{ {
struct bfin_serial_port *uart = (struct bfin_serial_port *)port; struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
#ifdef CONFIG_SERIAL_BFIN_DMA
struct circ_buf *xmit = &uart->port.info->xmit; struct circ_buf *xmit = &uart->port.info->xmit;
#endif
while (!(UART_GET_LSR(uart) & TEMT)) while (!(UART_GET_LSR(uart) & TEMT))
cpu_relax(); cpu_relax();
...@@ -412,7 +414,9 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) ...@@ -412,7 +414,9 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
{ {
int x_pos, pos; int x_pos, pos, flags;
spin_lock_irqsave(&uart->port.lock, flags);
uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel); uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel);
x_pos = get_dma_curr_xcount(uart->rx_dma_channel); x_pos = get_dma_curr_xcount(uart->rx_dma_channel);
...@@ -430,6 +434,8 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) ...@@ -430,6 +434,8 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
uart->rx_dma_buf.tail = uart->rx_dma_buf.head; uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
} }
spin_unlock_irqrestore(&uart->port.lock, flags);
mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
} }
...@@ -464,10 +470,9 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) ...@@ -464,10 +470,9 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
spin_lock(&uart->port.lock); spin_lock(&uart->port.lock);
irqstat = get_dma_curr_irqstat(uart->rx_dma_channel); irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
clear_dma_irqstat(uart->rx_dma_channel); clear_dma_irqstat(uart->rx_dma_channel);
bfin_serial_dma_rx_chars(uart);
spin_unlock(&uart->port.lock); spin_unlock(&uart->port.lock);
mod_timer(&(uart->rx_dma_timer), jiffies);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
#endif #endif
......
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