X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fserial%2F21285.c;h=7572665a885516d89ece6dcb5898154a14be2916;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=759addd51854745dd7fe5118c84b58ba79324a38;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index 759addd51..7572665a8 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c @@ -58,8 +58,7 @@ static const char serial21285_name[] = "Footbridge UART"; * int((BAUD_BASE - (baud >> 1)) / baud) */ -static void -serial21285_stop_tx(struct uart_port *port, unsigned int tty_stop) +static void serial21285_stop_tx(struct uart_port *port) { if (tx_enabled(port)) { disable_irq(IRQ_CONTX); @@ -67,8 +66,7 @@ serial21285_stop_tx(struct uart_port *port, unsigned int tty_stop) } } -static void -serial21285_start_tx(struct uart_port *port, unsigned int tty_start) +static void serial21285_start_tx(struct uart_port *port) { if (!tx_enabled(port)) { enable_irq(IRQ_CONTX); @@ -96,21 +94,12 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id, struct pt_regs *r status = *CSR_UARTFLG; while (!(status & 0x10) && max_count--) { - if (tty->flip.count >= TTY_FLIPBUF_SIZE) { - if (tty->low_latency) - tty_flip_buffer_push(tty); - /* - * If this failed then we will throw away the - * bytes but must do so to clear interrupts - */ - } - ch = *CSR_UARTDR; flag = TTY_NORMAL; port->icount.rx++; rxs = *CSR_RXSTAT | RXSTAT_DUMMY_READ; - if (rxs & RXSTAT_ANYERR) { + if (unlikely(rxs & RXSTAT_ANYERR)) { if (rxs & RXSTAT_PARITY) port->icount.parity++; else if (rxs & RXSTAT_FRAME) @@ -126,23 +115,12 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id, struct pt_regs *r flag = TTY_FRAME; } - if ((rxs & port->ignore_status_mask) == 0) { - tty_insert_flip_char(tty, ch, flag); - } - if ((rxs & RXSTAT_OVERRUN) && - tty->flip.count < TTY_FLIPBUF_SIZE) { - /* - * Overrun is special, since it's reported - * immediately, and doesn't affect the current - * character. - */ - tty_insert_flip_char(tty, 0, TTY_OVERRUN); - } + uart_insert_char(port, rxs, RXSTAT_OVERRUN, ch, flag); + status = *CSR_UARTFLG; } tty_flip_buffer_push(tty); - out: return IRQ_HANDLED; } @@ -159,7 +137,7 @@ static irqreturn_t serial21285_tx_chars(int irq, void *dev_id, struct pt_regs *r goto out; } if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { - serial21285_stop_tx(port, 0); + serial21285_stop_tx(port); goto out; } @@ -175,7 +153,7 @@ static irqreturn_t serial21285_tx_chars(int irq, void *dev_id, struct pt_regs *r uart_write_wakeup(port); if (uart_circ_empty(xmit)) - serial21285_stop_tx(port, 0); + serial21285_stop_tx(port); out: return IRQ_HANDLED; @@ -383,14 +361,12 @@ static struct uart_ops serial21285_ops = { }; static struct uart_port serial21285_port = { - .membase = 0, .mapbase = 0x42000160, - .iotype = SERIAL_IO_MEM, + .iotype = UPIO_MEM, .irq = NO_IRQ, - .uartclk = 0, .fifosize = 16, .ops = &serial21285_ops, - .flags = ASYNC_BOOT_AUTOCONF, + .flags = UPF_BOOT_AUTOCONF, }; static void serial21285_setup_ports(void) @@ -399,23 +375,18 @@ static void serial21285_setup_ports(void) } #ifdef CONFIG_SERIAL_21285_CONSOLE +static void serial21285_console_putchar(struct uart_port *port, int ch) +{ + while (*CSR_UARTFLG & 0x20) + barrier(); + *CSR_UARTDR = ch; +} static void serial21285_console_write(struct console *co, const char *s, unsigned int count) { - int i; - - for (i = 0; i < count; i++) { - while (*CSR_UARTFLG & 0x20) - barrier(); - *CSR_UARTDR = s[i]; - if (s[i] == '\n') { - while (*CSR_UARTFLG & 0x20) - barrier(); - *CSR_UARTDR = '\r'; - } - } + uart_console_write(&serial21285_port, s, count, serial21285_console_putchar); } static void __init @@ -478,7 +449,7 @@ static int __init serial21285_console_setup(struct console *co, char *options) return uart_set_options(port, co, baud, parity, bits, flow); } -extern struct uart_driver serial21285_reg; +static struct uart_driver serial21285_reg; static struct console serial21285_console = {