diff options
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r-- | drivers/serial/8250.c | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 891e1dd65f24..24110f6f61e0 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -241,7 +241,7 @@ static const struct serial8250_config uart_config[] = { | |||
241 | .fifo_size = 128, | 241 | .fifo_size = 128, |
242 | .tx_loadsz = 128, | 242 | .tx_loadsz = 128, |
243 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 243 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
244 | .flags = UART_CAP_FIFO, | 244 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, |
245 | }, | 245 | }, |
246 | [PORT_16654] = { | 246 | [PORT_16654] = { |
247 | .name = "ST16654", | 247 | .name = "ST16654", |
@@ -300,9 +300,16 @@ static const struct serial8250_config uart_config[] = { | |||
300 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, | 300 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, |
301 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | 301 | .flags = UART_CAP_FIFO | UART_CAP_AFE, |
302 | }, | 302 | }, |
303 | [PORT_U6_16550A] = { | ||
304 | .name = "U6_16550A", | ||
305 | .fifo_size = 64, | ||
306 | .tx_loadsz = 64, | ||
307 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
308 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
309 | }, | ||
303 | }; | 310 | }; |
304 | 311 | ||
305 | #if defined (CONFIG_SERIAL_8250_AU1X00) | 312 | #if defined(CONFIG_MIPS_ALCHEMY) |
306 | 313 | ||
307 | /* Au1x00 UART hardware has a weird register layout */ | 314 | /* Au1x00 UART hardware has a weird register layout */ |
308 | static const u8 au_io_in_map[] = { | 315 | static const u8 au_io_in_map[] = { |
@@ -422,7 +429,6 @@ static unsigned int mem32_serial_in(struct uart_port *p, int offset) | |||
422 | return readl(p->membase + offset); | 429 | return readl(p->membase + offset); |
423 | } | 430 | } |
424 | 431 | ||
425 | #ifdef CONFIG_SERIAL_8250_AU1X00 | ||
426 | static unsigned int au_serial_in(struct uart_port *p, int offset) | 432 | static unsigned int au_serial_in(struct uart_port *p, int offset) |
427 | { | 433 | { |
428 | offset = map_8250_in_reg(p, offset) << p->regshift; | 434 | offset = map_8250_in_reg(p, offset) << p->regshift; |
@@ -434,7 +440,6 @@ static void au_serial_out(struct uart_port *p, int offset, int value) | |||
434 | offset = map_8250_out_reg(p, offset) << p->regshift; | 440 | offset = map_8250_out_reg(p, offset) << p->regshift; |
435 | __raw_writel(value, p->membase + offset); | 441 | __raw_writel(value, p->membase + offset); |
436 | } | 442 | } |
437 | #endif | ||
438 | 443 | ||
439 | static unsigned int tsi_serial_in(struct uart_port *p, int offset) | 444 | static unsigned int tsi_serial_in(struct uart_port *p, int offset) |
440 | { | 445 | { |
@@ -503,12 +508,11 @@ static void set_io_from_upio(struct uart_port *p) | |||
503 | p->serial_out = mem32_serial_out; | 508 | p->serial_out = mem32_serial_out; |
504 | break; | 509 | break; |
505 | 510 | ||
506 | #ifdef CONFIG_SERIAL_8250_AU1X00 | ||
507 | case UPIO_AU: | 511 | case UPIO_AU: |
508 | p->serial_in = au_serial_in; | 512 | p->serial_in = au_serial_in; |
509 | p->serial_out = au_serial_out; | 513 | p->serial_out = au_serial_out; |
510 | break; | 514 | break; |
511 | #endif | 515 | |
512 | case UPIO_TSI: | 516 | case UPIO_TSI: |
513 | p->serial_in = tsi_serial_in; | 517 | p->serial_in = tsi_serial_in; |
514 | p->serial_out = tsi_serial_out; | 518 | p->serial_out = tsi_serial_out; |
@@ -535,9 +539,7 @@ serial_out_sync(struct uart_8250_port *up, int offset, int value) | |||
535 | switch (p->iotype) { | 539 | switch (p->iotype) { |
536 | case UPIO_MEM: | 540 | case UPIO_MEM: |
537 | case UPIO_MEM32: | 541 | case UPIO_MEM32: |
538 | #ifdef CONFIG_SERIAL_8250_AU1X00 | ||
539 | case UPIO_AU: | 542 | case UPIO_AU: |
540 | #endif | ||
541 | case UPIO_DWAPB: | 543 | case UPIO_DWAPB: |
542 | p->serial_out(p, offset, value); | 544 | p->serial_out(p, offset, value); |
543 | p->serial_in(p, UART_LCR); /* safe, no side-effects */ | 545 | p->serial_in(p, UART_LCR); /* safe, no side-effects */ |
@@ -573,7 +575,7 @@ static inline void _serial_dl_write(struct uart_8250_port *up, int value) | |||
573 | serial_outp(up, UART_DLM, value >> 8 & 0xff); | 575 | serial_outp(up, UART_DLM, value >> 8 & 0xff); |
574 | } | 576 | } |
575 | 577 | ||
576 | #if defined(CONFIG_SERIAL_8250_AU1X00) | 578 | #if defined(CONFIG_MIPS_ALCHEMY) |
577 | /* Au1x00 haven't got a standard divisor latch */ | 579 | /* Au1x00 haven't got a standard divisor latch */ |
578 | static int serial_dl_read(struct uart_8250_port *up) | 580 | static int serial_dl_read(struct uart_8250_port *up) |
579 | { | 581 | { |
@@ -1075,6 +1077,15 @@ static void autoconfig_16550a(struct uart_8250_port *up) | |||
1075 | DEBUG_AUTOCONF("Couldn't force IER_UUE to 0 "); | 1077 | DEBUG_AUTOCONF("Couldn't force IER_UUE to 0 "); |
1076 | } | 1078 | } |
1077 | serial_outp(up, UART_IER, iersave); | 1079 | serial_outp(up, UART_IER, iersave); |
1080 | |||
1081 | /* | ||
1082 | * We distinguish between 16550A and U6 16550A by counting | ||
1083 | * how many bytes are in the FIFO. | ||
1084 | */ | ||
1085 | if (up->port.type == PORT_16550A && size_fifo(up) == 64) { | ||
1086 | up->port.type = PORT_U6_16550A; | ||
1087 | up->capabilities |= UART_CAP_AFE; | ||
1088 | } | ||
1078 | } | 1089 | } |
1079 | 1090 | ||
1080 | /* | 1091 | /* |
@@ -2229,9 +2240,9 @@ static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int | |||
2229 | return quot; | 2240 | return quot; |
2230 | } | 2241 | } |
2231 | 2242 | ||
2232 | static void | 2243 | void |
2233 | serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | 2244 | serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, |
2234 | struct ktermios *old) | 2245 | struct ktermios *old) |
2235 | { | 2246 | { |
2236 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 2247 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
2237 | unsigned char cval, fcr = 0; | 2248 | unsigned char cval, fcr = 0; |
@@ -2407,16 +2418,22 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2407 | if (tty_termios_baud_rate(termios)) | 2418 | if (tty_termios_baud_rate(termios)) |
2408 | tty_termios_encode_baud_rate(termios, baud, baud); | 2419 | tty_termios_encode_baud_rate(termios, baud, baud); |
2409 | } | 2420 | } |
2421 | EXPORT_SYMBOL(serial8250_do_set_termios); | ||
2410 | 2422 | ||
2411 | static void | 2423 | static void |
2412 | serial8250_set_ldisc(struct uart_port *port) | 2424 | serial8250_set_termios(struct uart_port *port, struct ktermios *termios, |
2425 | struct ktermios *old) | ||
2413 | { | 2426 | { |
2414 | int line = port->line; | 2427 | if (port->set_termios) |
2415 | 2428 | port->set_termios(port, termios, old); | |
2416 | if (line >= port->state->port.tty->driver->num) | 2429 | else |
2417 | return; | 2430 | serial8250_do_set_termios(port, termios, old); |
2431 | } | ||
2418 | 2432 | ||
2419 | if (port->state->port.tty->ldisc->ops->num == N_PPS) { | 2433 | static void |
2434 | serial8250_set_ldisc(struct uart_port *port, int new) | ||
2435 | { | ||
2436 | if (new == N_PPS) { | ||
2420 | port->flags |= UPF_HARDPPS_CD; | 2437 | port->flags |= UPF_HARDPPS_CD; |
2421 | serial8250_enable_ms(port); | 2438 | serial8250_enable_ms(port); |
2422 | } else | 2439 | } else |
@@ -2596,11 +2613,9 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
2596 | if (flags & UART_CONFIG_TYPE) | 2613 | if (flags & UART_CONFIG_TYPE) |
2597 | autoconfig(up, probeflags); | 2614 | autoconfig(up, probeflags); |
2598 | 2615 | ||
2599 | #ifdef CONFIG_SERIAL_8250_AU1X00 | ||
2600 | /* if access method is AU, it is a 16550 with a quirk */ | 2616 | /* if access method is AU, it is a 16550 with a quirk */ |
2601 | if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU) | 2617 | if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU) |
2602 | up->bugs |= UART_BUG_NOMSR; | 2618 | up->bugs |= UART_BUG_NOMSR; |
2603 | #endif | ||
2604 | 2619 | ||
2605 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) | 2620 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) |
2606 | autoconfig_irq(up); | 2621 | autoconfig_irq(up); |
@@ -2994,6 +3009,7 @@ static int __devinit serial8250_probe(struct platform_device *dev) | |||
2994 | port.type = p->type; | 3009 | port.type = p->type; |
2995 | port.serial_in = p->serial_in; | 3010 | port.serial_in = p->serial_in; |
2996 | port.serial_out = p->serial_out; | 3011 | port.serial_out = p->serial_out; |
3012 | port.set_termios = p->set_termios; | ||
2997 | port.dev = &dev->dev; | 3013 | port.dev = &dev->dev; |
2998 | port.irqflags |= irqflag; | 3014 | port.irqflags |= irqflag; |
2999 | ret = serial8250_register_port(&port); | 3015 | ret = serial8250_register_port(&port); |
@@ -3157,6 +3173,9 @@ int serial8250_register_port(struct uart_port *port) | |||
3157 | uart->port.serial_in = port->serial_in; | 3173 | uart->port.serial_in = port->serial_in; |
3158 | if (port->serial_out) | 3174 | if (port->serial_out) |
3159 | uart->port.serial_out = port->serial_out; | 3175 | uart->port.serial_out = port->serial_out; |
3176 | /* Possibly override set_termios call */ | ||
3177 | if (port->set_termios) | ||
3178 | uart->port.set_termios = port->set_termios; | ||
3160 | 3179 | ||
3161 | ret = uart_add_one_port(&serial8250_reg, &uart->port); | 3180 | ret = uart_add_one_port(&serial8250_reg, &uart->port); |
3162 | if (ret == 0) | 3181 | if (ret == 0) |