X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fserial%2Fserial_lh7a40x.c;h=4ce3a41f16116478d5b8664274ebbff00e763bda;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=d863368e45e2a1349b13ad7234818e9cd4b82904;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index d863368e4..4ce3a41f1 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c @@ -28,25 +28,24 @@ */ #include + +#if defined(CONFIG_SERIAL_LH7A40X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + #include -#include #include #include -#include #include #include +#include +#include +#include +#include #include #include -#if defined(CONFIG_SERIAL_LH7A40X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -#define SUPPORT_SYSRQ -#endif - -#include - -#include - #define DEV_MAJOR 204 #define DEV_MINOR 16 #define DEV_NR 3 @@ -60,6 +59,15 @@ #define UART_REG_SIZE 32 +#define UART_R_DATA (0x00) +#define UART_R_FCON (0x04) +#define UART_R_BRCON (0x08) +#define UART_R_CON (0x0c) +#define UART_R_STATUS (0x10) +#define UART_R_RAWISR (0x14) +#define UART_R_INTEN (0x18) +#define UART_R_ISR (0x1c) + #define UARTEN (0x01) /* UART enable */ #define SIRDIS (0x02) /* Serial IR disable (UART1 only) */ @@ -138,21 +146,20 @@ lh7a40xuart_rx_chars (struct uart_port* port) { struct tty_struct* tty = port->info->tty; int cbRxMax = 256; /* (Gross) limit on receive */ - unsigned int data; /* Received data and status */ + unsigned int data, flag;/* Received data and status */ while (!(UR (port, UART_R_STATUS) & nRxRdy) && --cbRxMax) { if (tty->flip.count >= TTY_FLIPBUF_SIZE) { - tty->flip.work.func((void*)tty); - if (tty->flip.count >= TTY_FLIPBUF_SIZE) { - printk(KERN_WARNING "TTY_DONT_FLIP set\n"); - return; - } + 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 + */ } data = UR (port, UART_R_DATA); - - *tty->flip.char_buf_ptr = (unsigned char) data; - *tty->flip.flag_buf_ptr = TTY_NORMAL; + flag = TTY_NORMAL; ++port->icount.rx; if (data & RxError) { /* Quick check, short-circuit */ @@ -173,20 +180,18 @@ lh7a40xuart_rx_chars (struct uart_port* port) data &= port->read_status_mask | 0xff; if (data & RxBreak) - *tty->flip.flag_buf_ptr = TTY_BREAK; + flag = TTY_BREAK; else if (data & RxParityError) - *tty->flip.flag_buf_ptr = TTY_PARITY; + flag = TTY_PARITY; else if (data & RxFramingError) - *tty->flip.flag_buf_ptr = TTY_FRAME; + flag = TTY_FRAME; } if (uart_handle_sysrq_char (port, (unsigned char) data, regs)) continue; if ((data & port->ignore_status_mask) == 0) { - ++tty->flip.flag_buf_ptr; - ++tty->flip.char_buf_ptr; - ++tty->flip.count; + tty_insert_flip_char(tty, data, flag); } if ((data & RxOverrunError) && tty->flip.count < TTY_FLIPBUF_SIZE) { @@ -195,9 +200,7 @@ lh7a40xuart_rx_chars (struct uart_port* port) * immediately, and doesn't affect the current * character */ - *tty->flip.char_buf_ptr++ = 0; - *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; - ++tty->flip.count; + tty_insert_flip_char(tty, 0, TTY_OVERRUN); } } tty_flip_buffer_push (tty);