diff options
Diffstat (limited to 'drivers/tty/serial/8250/8250.c')
-rw-r--r-- | drivers/tty/serial/8250/8250.c | 84 |
1 files changed, 33 insertions, 51 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 8123f784bcda..d4e0b07cb130 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -2202,6 +2202,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2202 | unsigned char cval, fcr = 0; | 2202 | unsigned char cval, fcr = 0; |
2203 | unsigned long flags; | 2203 | unsigned long flags; |
2204 | unsigned int baud, quot; | 2204 | unsigned int baud, quot; |
2205 | int fifo_bug = 0; | ||
2205 | 2206 | ||
2206 | switch (termios->c_cflag & CSIZE) { | 2207 | switch (termios->c_cflag & CSIZE) { |
2207 | case CS5: | 2208 | case CS5: |
@@ -2221,8 +2222,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2221 | 2222 | ||
2222 | if (termios->c_cflag & CSTOPB) | 2223 | if (termios->c_cflag & CSTOPB) |
2223 | cval |= UART_LCR_STOP; | 2224 | cval |= UART_LCR_STOP; |
2224 | if (termios->c_cflag & PARENB) | 2225 | if (termios->c_cflag & PARENB) { |
2225 | cval |= UART_LCR_PARITY; | 2226 | cval |= UART_LCR_PARITY; |
2227 | if (up->bugs & UART_BUG_PARITY) | ||
2228 | fifo_bug = 1; | ||
2229 | } | ||
2226 | if (!(termios->c_cflag & PARODD)) | 2230 | if (!(termios->c_cflag & PARODD)) |
2227 | cval |= UART_LCR_EPAR; | 2231 | cval |= UART_LCR_EPAR; |
2228 | #ifdef CMSPAR | 2232 | #ifdef CMSPAR |
@@ -2246,7 +2250,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2246 | 2250 | ||
2247 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { | 2251 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { |
2248 | fcr = uart_config[port->type].fcr; | 2252 | fcr = uart_config[port->type].fcr; |
2249 | if (baud < 2400) { | 2253 | if (baud < 2400 || fifo_bug) { |
2250 | fcr &= ~UART_FCR_TRIGGER_MASK; | 2254 | fcr &= ~UART_FCR_TRIGGER_MASK; |
2251 | fcr |= UART_FCR_TRIGGER_1; | 2255 | fcr |= UART_FCR_TRIGGER_1; |
2252 | } | 2256 | } |
@@ -2336,7 +2340,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2336 | serial_port_out(port, UART_EFR, efr); | 2340 | serial_port_out(port, UART_EFR, efr); |
2337 | } | 2341 | } |
2338 | 2342 | ||
2339 | #ifdef CONFIG_ARCH_OMAP | 2343 | #ifdef CONFIG_ARCH_OMAP1 |
2340 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ | 2344 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ |
2341 | if (cpu_is_omap1510() && is_omap_port(up)) { | 2345 | if (cpu_is_omap1510() && is_omap_port(up)) { |
2342 | if (baud == 115200) { | 2346 | if (baud == 115200) { |
@@ -2426,7 +2430,7 @@ static unsigned int serial8250_port_size(struct uart_8250_port *pt) | |||
2426 | { | 2430 | { |
2427 | if (pt->port.iotype == UPIO_AU) | 2431 | if (pt->port.iotype == UPIO_AU) |
2428 | return 0x1000; | 2432 | return 0x1000; |
2429 | #ifdef CONFIG_ARCH_OMAP | 2433 | #ifdef CONFIG_ARCH_OMAP1 |
2430 | if (is_omap_port(pt)) | 2434 | if (is_omap_port(pt)) |
2431 | return 0x16 << pt->port.regshift; | 2435 | return 0x16 << pt->port.regshift; |
2432 | #endif | 2436 | #endif |
@@ -2979,36 +2983,36 @@ void serial8250_resume_port(int line) | |||
2979 | static int __devinit serial8250_probe(struct platform_device *dev) | 2983 | static int __devinit serial8250_probe(struct platform_device *dev) |
2980 | { | 2984 | { |
2981 | struct plat_serial8250_port *p = dev->dev.platform_data; | 2985 | struct plat_serial8250_port *p = dev->dev.platform_data; |
2982 | struct uart_port port; | 2986 | struct uart_8250_port uart; |
2983 | int ret, i, irqflag = 0; | 2987 | int ret, i, irqflag = 0; |
2984 | 2988 | ||
2985 | memset(&port, 0, sizeof(struct uart_port)); | 2989 | memset(&uart, 0, sizeof(uart)); |
2986 | 2990 | ||
2987 | if (share_irqs) | 2991 | if (share_irqs) |
2988 | irqflag = IRQF_SHARED; | 2992 | irqflag = IRQF_SHARED; |
2989 | 2993 | ||
2990 | for (i = 0; p && p->flags != 0; p++, i++) { | 2994 | for (i = 0; p && p->flags != 0; p++, i++) { |
2991 | port.iobase = p->iobase; | 2995 | uart.port.iobase = p->iobase; |
2992 | port.membase = p->membase; | 2996 | uart.port.membase = p->membase; |
2993 | port.irq = p->irq; | 2997 | uart.port.irq = p->irq; |
2994 | port.irqflags = p->irqflags; | 2998 | uart.port.irqflags = p->irqflags; |
2995 | port.uartclk = p->uartclk; | 2999 | uart.port.uartclk = p->uartclk; |
2996 | port.regshift = p->regshift; | 3000 | uart.port.regshift = p->regshift; |
2997 | port.iotype = p->iotype; | 3001 | uart.port.iotype = p->iotype; |
2998 | port.flags = p->flags; | 3002 | uart.port.flags = p->flags; |
2999 | port.mapbase = p->mapbase; | 3003 | uart.port.mapbase = p->mapbase; |
3000 | port.hub6 = p->hub6; | 3004 | uart.port.hub6 = p->hub6; |
3001 | port.private_data = p->private_data; | 3005 | uart.port.private_data = p->private_data; |
3002 | port.type = p->type; | 3006 | uart.port.type = p->type; |
3003 | port.serial_in = p->serial_in; | 3007 | uart.port.serial_in = p->serial_in; |
3004 | port.serial_out = p->serial_out; | 3008 | uart.port.serial_out = p->serial_out; |
3005 | port.handle_irq = p->handle_irq; | 3009 | uart.port.handle_irq = p->handle_irq; |
3006 | port.handle_break = p->handle_break; | 3010 | uart.port.handle_break = p->handle_break; |
3007 | port.set_termios = p->set_termios; | 3011 | uart.port.set_termios = p->set_termios; |
3008 | port.pm = p->pm; | 3012 | uart.port.pm = p->pm; |
3009 | port.dev = &dev->dev; | 3013 | uart.port.dev = &dev->dev; |
3010 | port.irqflags |= irqflag; | 3014 | uart.port.irqflags |= irqflag; |
3011 | ret = serial8250_register_port(&port); | 3015 | ret = serial8250_register_8250_port(&uart); |
3012 | if (ret < 0) { | 3016 | if (ret < 0) { |
3013 | dev_err(&dev->dev, "unable to register port at index %d " | 3017 | dev_err(&dev->dev, "unable to register port at index %d " |
3014 | "(IO%lx MEM%llx IRQ%d): %d\n", i, | 3018 | "(IO%lx MEM%llx IRQ%d): %d\n", i, |
@@ -3081,7 +3085,7 @@ static struct platform_driver serial8250_isa_driver = { | |||
3081 | static struct platform_device *serial8250_isa_devs; | 3085 | static struct platform_device *serial8250_isa_devs; |
3082 | 3086 | ||
3083 | /* | 3087 | /* |
3084 | * serial8250_register_port and serial8250_unregister_port allows for | 3088 | * serial8250_register_8250_port and serial8250_unregister_port allows for |
3085 | * 16x50 serial ports to be configured at run-time, to support PCMCIA | 3089 | * 16x50 serial ports to be configured at run-time, to support PCMCIA |
3086 | * modems and PCI multiport cards. | 3090 | * modems and PCI multiport cards. |
3087 | */ | 3091 | */ |
@@ -3155,6 +3159,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up) | |||
3155 | uart->port.regshift = up->port.regshift; | 3159 | uart->port.regshift = up->port.regshift; |
3156 | uart->port.iotype = up->port.iotype; | 3160 | uart->port.iotype = up->port.iotype; |
3157 | uart->port.flags = up->port.flags | UPF_BOOT_AUTOCONF; | 3161 | uart->port.flags = up->port.flags | UPF_BOOT_AUTOCONF; |
3162 | uart->bugs = up->bugs; | ||
3158 | uart->port.mapbase = up->port.mapbase; | 3163 | uart->port.mapbase = up->port.mapbase; |
3159 | uart->port.private_data = up->port.private_data; | 3164 | uart->port.private_data = up->port.private_data; |
3160 | if (up->port.dev) | 3165 | if (up->port.dev) |
@@ -3198,29 +3203,6 @@ int serial8250_register_8250_port(struct uart_8250_port *up) | |||
3198 | EXPORT_SYMBOL(serial8250_register_8250_port); | 3203 | EXPORT_SYMBOL(serial8250_register_8250_port); |
3199 | 3204 | ||
3200 | /** | 3205 | /** |
3201 | * serial8250_register_port - register a serial port | ||
3202 | * @port: serial port template | ||
3203 | * | ||
3204 | * Configure the serial port specified by the request. If the | ||
3205 | * port exists and is in use, it is hung up and unregistered | ||
3206 | * first. | ||
3207 | * | ||
3208 | * The port is then probed and if necessary the IRQ is autodetected | ||
3209 | * If this fails an error is returned. | ||
3210 | * | ||
3211 | * On success the port is ready to use and the line number is returned. | ||
3212 | */ | ||
3213 | int serial8250_register_port(struct uart_port *port) | ||
3214 | { | ||
3215 | struct uart_8250_port up; | ||
3216 | |||
3217 | memset(&up, 0, sizeof(up)); | ||
3218 | memcpy(&up.port, port, sizeof(*port)); | ||
3219 | return serial8250_register_8250_port(&up); | ||
3220 | } | ||
3221 | EXPORT_SYMBOL(serial8250_register_port); | ||
3222 | |||
3223 | /** | ||
3224 | * serial8250_unregister_port - remove a 16x50 serial port at runtime | 3206 | * serial8250_unregister_port - remove a 16x50 serial port at runtime |
3225 | * @line: serial line number | 3207 | * @line: serial line number |
3226 | * | 3208 | * |