X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fserial%2F8250.c;h=545f50802cdf0c065d6c359ddf5158ccb5e8a8d4;hb=refs%2Fheads%2Fvserver;hp=fd8b94e8d8e0198761964fbab9dd45715d21d491;hpb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;p=linux-2.6.git diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index fd8b94e8d..545f50802 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -323,8 +323,8 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset) case UPIO_TSI: if (offset == UART_IIR) { - tmp = readl((u32 *)(up->port.membase + UART_RX)); - return (cpu_to_le32(tmp) >> 8) & 0xff; + tmp = readl(up->port.membase + (UART_IIR & ~3)); + return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */ } else return readb(up->port.membase + offset); @@ -1178,7 +1178,7 @@ static void serial8250_enable_ms(struct uart_port *port) } static void -receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) +receive_chars(struct uart_8250_port *up, int *status) { struct tty_struct *tty = up->port.info->tty; unsigned char ch, lsr = *status; @@ -1236,7 +1236,7 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) else if (lsr & UART_LSR_FE) flag = TTY_FRAME; } - if (uart_handle_sysrq_char(&up->port, ch, regs)) + if (uart_handle_sysrq_char(&up->port, ch)) goto ignore_char; uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag); @@ -1292,7 +1292,8 @@ static unsigned int check_modem_status(struct uart_8250_port *up) { unsigned int status = serial_in(up, UART_MSR); - if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI) { + if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && + up->port.info != NULL) { if (status & UART_MSR_TERI) up->port.icount.rng++; if (status & UART_MSR_DDSR) @@ -1312,7 +1313,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up) * This handles the interrupt from one port. */ static inline void -serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) +serial8250_handle_port(struct uart_8250_port *up) { unsigned int status; @@ -1323,7 +1324,7 @@ serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) DEBUG_INTR("status = %x...", status); if (status & UART_LSR_DR) - receive_chars(up, &status, regs); + receive_chars(up, &status); check_modem_status(up); if (status & UART_LSR_THRE) transmit_chars(up); @@ -1345,7 +1346,7 @@ serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) * This means we need to loop through all ports. checking that they * don't have an interrupt pending. */ -static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t serial8250_interrupt(int irq, void *dev_id) { struct irq_info *i = dev_id; struct list_head *l, *end = NULL; @@ -1364,7 +1365,7 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *r iir = serial_in(up, UART_IIR); if (!(iir & UART_IIR_NO_INT)) { - serial8250_handle_port(up, regs); + serial8250_handle_port(up); handled = 1; @@ -1464,7 +1465,7 @@ static void serial8250_timeout(unsigned long data) iir = serial_in(up, UART_IIR); if (!(iir & UART_IIR_NO_INT)) - serial8250_handle_port(up, NULL); + serial8250_handle_port(up); timeout = up->port.timeout; timeout = timeout > 6 ? (timeout / 2 - 2) : 1; @@ -1774,8 +1775,8 @@ static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int } static void -serial8250_set_termios(struct uart_port *port, struct termios *termios, - struct termios *old) +serial8250_set_termios(struct uart_port *port, struct ktermios *termios, + struct ktermios *old) { struct uart_8250_port *up = (struct uart_8250_port *)port; unsigned char cval, fcr = 0; @@ -1921,6 +1922,17 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios, serial_outp(up, UART_EFR, efr); } +#ifdef CONFIG_ARCH_OMAP15XX + /* Workaround to enable 115200 baud on OMAP1510 internal ports */ + if (cpu_is_omap1510() && is_omap_port((unsigned int)up->port.membase)) { + if (baud == 115200) { + quot = 1; + serial_out(up, UART_OMAP_OSC_12M_SEL, 1); + } else + serial_out(up, UART_OMAP_OSC_12M_SEL, 0); + } +#endif + if (up->capabilities & UART_NATSEMI) { /* Switch to bank 2 not bank 1, to avoid resetting EXCR2 */ serial_outp(up, UART_LCR, 0xe0); @@ -1974,6 +1986,8 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) case UPIO_AU: size = 0x100000; /* fall thru */ + case UPIO_TSI: + case UPIO_MEM32: case UPIO_MEM: if (!up->port.mapbase) break; @@ -2009,6 +2023,8 @@ static void serial8250_release_std_resource(struct uart_8250_port *up) case UPIO_AU: size = 0x100000; /* fall thru */ + case UPIO_TSI: + case UPIO_MEM32: case UPIO_MEM: if (!up->port.mapbase) break; @@ -2032,17 +2048,15 @@ static int serial8250_request_rsa_resource(struct uart_8250_port *up) { unsigned long start = UART_RSA_BASE << up->port.regshift; unsigned int size = 8 << up->port.regshift; - int ret = 0; + int ret = -EINVAL; switch (up->port.iotype) { - case UPIO_MEM: - ret = -EINVAL; - break; - case UPIO_HUB6: case UPIO_PORT: start += up->port.iobase; - if (!request_region(start, size, "serial-rsa")) + if (request_region(start, size, "serial-rsa")) + ret = 0; + else ret = -EBUSY; break; } @@ -2056,9 +2070,6 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up) unsigned int size = 8 << up->port.regshift; switch (up->port.iotype) { - case UPIO_MEM: - break; - case UPIO_HUB6: case UPIO_PORT: release_region(up->port.iobase + offset, size); @@ -2249,8 +2260,7 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) tmout = 1000000; while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) { udelay(1); - if ((tmout % 1000) == 0) - touch_nmi_watchdog(); + touch_nmi_watchdog(); } } } @@ -2312,7 +2322,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) local_irq_restore(flags); } -static int serial8250_console_setup(struct console *co, char *options) +static int __init serial8250_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 9600; @@ -2424,7 +2434,6 @@ int __init early_serial_setup(struct uart_port *port) /** * serial8250_suspend_port - suspend one serial port * @line: serial line number - * @level: the level of port suspension, as per uart_suspend_port * * Suspend one serial port. */ @@ -2436,7 +2445,6 @@ void serial8250_suspend_port(int line) /** * serial8250_resume_port - resume one serial port * @line: serial line number - * @level: the level of port resumption, as per uart_resume_port * * Resume one serial port. */