X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fserial%2Fm32r_sio.c;h=321a40f33b5042c93db4baac5ef6300c1f7f1f68;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=08d61f13edc61501f4aa8d5e34a46806b98bb346;hpb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;p=linux-2.6.git diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index 08d61f13e..321a40f33 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c @@ -80,7 +80,7 @@ #include /* Standard COM flags */ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST) /* * SERIAL_PORT_DFNS tells us about built-in ports that have no @@ -248,17 +248,17 @@ static void sio_error(int *status) #endif /* CONFIG_SERIAL_M32R_PLDSIO */ -static _INLINE_ unsigned int sio_in(struct uart_sio_port *up, int offset) +static unsigned int sio_in(struct uart_sio_port *up, int offset) { return __sio_in(up->port.iobase + offset); } -static _INLINE_ void sio_out(struct uart_sio_port *up, int offset, int value) +static void sio_out(struct uart_sio_port *up, int offset, int value) { __sio_out(value, up->port.iobase + offset); } -static _INLINE_ unsigned int serial_in(struct uart_sio_port *up, int offset) +static unsigned int serial_in(struct uart_sio_port *up, int offset) { if (!offset) return 0; @@ -266,8 +266,7 @@ static _INLINE_ unsigned int serial_in(struct uart_sio_port *up, int offset) return __sio_in(offset); } -static _INLINE_ void -serial_out(struct uart_sio_port *up, int offset, int value) +static void serial_out(struct uart_sio_port *up, int offset, int value) { if (!offset) return; @@ -275,7 +274,7 @@ serial_out(struct uart_sio_port *up, int offset, int value) __sio_out(value, offset); } -static void m32r_sio_stop_tx(struct uart_port *port, unsigned int tty_stop) +static void m32r_sio_stop_tx(struct uart_port *port) { struct uart_sio_port *up = (struct uart_sio_port *)port; @@ -285,7 +284,7 @@ static void m32r_sio_stop_tx(struct uart_port *port, unsigned int tty_stop) } } -static void m32r_sio_start_tx(struct uart_port *port, unsigned int tty_start) +static void m32r_sio_start_tx(struct uart_port *port) { #ifdef CONFIG_SERIAL_M32R_PLDSIO struct uart_sio_port *up = (struct uart_sio_port *)port; @@ -326,22 +325,17 @@ static void m32r_sio_enable_ms(struct uart_port *port) serial_out(up, UART_IER, up->ier); } -static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status, - struct pt_regs *regs) +static void receive_chars(struct uart_sio_port *up, int *status, + struct pt_regs *regs) { struct tty_struct *tty = up->port.info->tty; unsigned char ch; + unsigned char flag; int max_count = 256; do { - if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { - tty->flip.work.func((void *)tty); - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; // if TTY_DONT_FLIP is set - } ch = sio_in(up, SIORXB); - *tty->flip.char_buf_ptr = ch; - *tty->flip.flag_buf_ptr = TTY_NORMAL; + flag = TTY_NORMAL; up->port.icount.rx++; if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | @@ -380,30 +374,24 @@ static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status, if (*status & UART_LSR_BI) { DEBUG_INTR("handling break...."); - *tty->flip.flag_buf_ptr = TTY_BREAK; + flag = TTY_BREAK; } else if (*status & UART_LSR_PE) - *tty->flip.flag_buf_ptr = TTY_PARITY; + flag = TTY_PARITY; else if (*status & UART_LSR_FE) - *tty->flip.flag_buf_ptr = TTY_FRAME; + flag = TTY_FRAME; } if (uart_handle_sysrq_char(&up->port, ch, regs)) goto ignore_char; - if ((*status & up->port.ignore_status_mask) == 0) { - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - tty->flip.count++; - } - if ((*status & UART_LSR_OE) && - tty->flip.count < TTY_FLIPBUF_SIZE) { + if ((*status & up->port.ignore_status_mask) == 0) + tty_insert_flip_char(tty, ch, flag); + + if (*status & UART_LSR_OE) { /* * Overrun is special, since it's reported * immediately, and doesn't affect the current * character. */ - *tty->flip.flag_buf_ptr = TTY_OVERRUN; - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - tty->flip.count++; + tty_insert_flip_char(tty, 0, TTY_OVERRUN); } ignore_char: *status = serial_in(up, UART_LSR); @@ -411,7 +399,7 @@ static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status, tty_flip_buffer_push(tty); } -static _INLINE_ void transmit_chars(struct uart_sio_port *up) +static void transmit_chars(struct uart_sio_port *up) { struct circ_buf *xmit = &up->port.info->xmit; int count; @@ -425,7 +413,7 @@ static _INLINE_ void transmit_chars(struct uart_sio_port *up) return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { - m32r_sio_stop_tx(&up->port, 0); + m32r_sio_stop_tx(&up->port); return; } @@ -446,7 +434,7 @@ static _INLINE_ void transmit_chars(struct uart_sio_port *up) DEBUG_INTR("THRE..."); if (uart_circ_empty(xmit)) - m32r_sio_stop_tx(&up->port, 0); + m32r_sio_stop_tx(&up->port); } /* @@ -724,22 +712,22 @@ static void m32r_sio_set_termios(struct uart_port *port, switch (termios->c_cflag & CSIZE) { case CS5: - cval = 0x00; + cval = UART_LCR_WLEN5; break; case CS6: - cval = 0x01; + cval = UART_LCR_WLEN6; break; case CS7: - cval = 0x02; + cval = UART_LCR_WLEN7; break; default: case CS8: - cval = 0x03; + cval = UART_LCR_WLEN8; break; } if (termios->c_cflag & CSTOPB) - cval |= 0x04; + cval |= UART_LCR_STOP; if (termios->c_cflag & PARENB) cval |= UART_LCR_PARITY; if (!(termios->c_cflag & PARODD)) @@ -1050,6 +1038,14 @@ static inline void wait_for_xmitr(struct uart_sio_port *up) } } +static void m32r_sio_console_putchar(struct uart_port *port, int ch) +{ + struct uart_sio_port *up = (struct uart_sio_port *)port; + + wait_for_xmitr(up); + sio_out(up, SIOTXB, ch); +} + /* * Print a string to the serial port trying not to disturb * any possible real use of the port... @@ -1061,7 +1057,6 @@ static void m32r_sio_console_write(struct console *co, const char *s, { struct uart_sio_port *up = &m32r_sio_ports[co->index]; unsigned int ier; - int i; /* * First save the UER then disable the interrupts @@ -1069,23 +1064,7 @@ static void m32r_sio_console_write(struct console *co, const char *s, ier = sio_in(up, SIOTRCR); sio_out(up, SIOTRCR, 0); - /* - * Now, do each character - */ - for (i = 0; i < count; i++, s++) { - wait_for_xmitr(up); - - /* - * Send the character out. - * If a LF, also do CR... - */ - sio_out(up, SIOTXB, *s); - - if (*s == 10) { - wait_for_xmitr(up); - sio_out(up, SIOTXB, 13); - } - } + uart_console_write(&up->port, s, count, m32r_sio_console_putchar); /* * Finally, wait for transmitter to become empty @@ -1123,7 +1102,7 @@ static int __init m32r_sio_console_setup(struct console *co, char *options) return uart_set_options(port, co, baud, parity, bits, flow); } -extern struct uart_driver m32r_sio_reg; +static struct uart_driver m32r_sio_reg; static struct console m32r_sio_console = { .name = "ttyS", .write = m32r_sio_console_write,