Commit 5c4e472b authored by Aubrey Li's avatar Aubrey Li Committed by Linus Torvalds

Blackfin serial driver: fix overhead issue

Signed-off-by: default avatarAubrey Li <aubrey.li@analog.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9d7b6677
...@@ -240,24 +240,30 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) ...@@ -240,24 +240,30 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
bfin_serial_stop_tx(&uart->port); bfin_serial_stop_tx(&uart->port);
} }
static irqreturn_t bfin_serial_int(int irq, void *dev_id) static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id)
{
struct bfin_serial_port *uart = dev_id;
spin_lock(&uart->port.lock);
while ((UART_GET_IIR(uart) & IIR_STATUS) == IIR_RX_READY)
bfin_serial_rx_chars(uart);
spin_unlock(&uart->port.lock);
return IRQ_HANDLED;
}
static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
{ {
struct bfin_serial_port *uart = dev_id; struct bfin_serial_port *uart = dev_id;
unsigned short status; unsigned short status;
spin_lock(&uart->port.lock); spin_lock(&uart->port.lock);
status = UART_GET_IIR(uart); while ((UART_GET_IIR(uart) & IIR_STATUS) == IIR_TX_READY)
do { bfin_serial_tx_chars(uart);
if ((status & IIR_STATUS) == IIR_TX_READY)
bfin_serial_tx_chars(uart);
if ((status & IIR_STATUS) == IIR_RX_READY)
bfin_serial_rx_chars(uart);
status = UART_GET_IIR(uart);
} while (status & (IIR_TX_READY | IIR_RX_READY));
spin_unlock(&uart->port.lock); spin_unlock(&uart->port.lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void bfin_serial_do_work(struct work_struct *work) static void bfin_serial_do_work(struct work_struct *work)
{ {
struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue); struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue);
...@@ -545,14 +551,14 @@ static int bfin_serial_startup(struct uart_port *port) ...@@ -545,14 +551,14 @@ static int bfin_serial_startup(struct uart_port *port)
add_timer(&(uart->rx_dma_timer)); add_timer(&(uart->rx_dma_timer));
#else #else
if (request_irq if (request_irq
(uart->port.irq, bfin_serial_int, IRQF_DISABLED, (uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED,
"BFIN_UART_RX", uart)) { "BFIN_UART_RX", uart)) {
printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n"); printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n");
return -EBUSY; return -EBUSY;
} }
if (request_irq if (request_irq
(uart->port.irq+1, bfin_serial_int, IRQF_DISABLED, (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
"BFIN_UART_TX", uart)) { "BFIN_UART_TX", uart)) {
printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n"); printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n");
free_irq(uart->port.irq, uart); free_irq(uart->port.irq, uart);
......
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