aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index a81ff7bc5fa1..c3db16b7afa1 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2408,6 +2408,21 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
2408} 2408}
2409 2409
2410static void 2410static void
2411serial8250_set_ldisc(struct uart_port *port)
2412{
2413 int line = port->line;
2414
2415 if (line >= port->state->port.tty->driver->num)
2416 return;
2417
2418 if (port->state->port.tty->ldisc->ops->num == N_PPS) {
2419 port->flags |= UPF_HARDPPS_CD;
2420 serial8250_enable_ms(port);
2421 } else
2422 port->flags &= ~UPF_HARDPPS_CD;
2423}
2424
2425static void
2411serial8250_pm(struct uart_port *port, unsigned int state, 2426serial8250_pm(struct uart_port *port, unsigned int state,
2412 unsigned int oldstate) 2427 unsigned int oldstate)
2413{ 2428{
@@ -2628,6 +2643,7 @@ static struct uart_ops serial8250_pops = {
2628 .startup = serial8250_startup, 2643 .startup = serial8250_startup,
2629 .shutdown = serial8250_shutdown, 2644 .shutdown = serial8250_shutdown,
2630 .set_termios = serial8250_set_termios, 2645 .set_termios = serial8250_set_termios,
2646 .set_ldisc = serial8250_set_ldisc,
2631 .pm = serial8250_pm, 2647 .pm = serial8250_pm,
2632 .type = serial8250_type, 2648 .type = serial8250_type,
2633 .release_port = serial8250_release_port, 2649 .release_port = serial8250_release_port,
@@ -2690,6 +2706,15 @@ static void __init serial8250_isa_init_ports(void)
2690 } 2706 }
2691} 2707}
2692 2708
2709static void
2710serial8250_init_fixed_type_port(struct uart_8250_port *up, unsigned int type)
2711{
2712 up->port.type = type;
2713 up->port.fifosize = uart_config[type].fifo_size;
2714 up->capabilities = uart_config[type].flags;
2715 up->tx_loadsz = uart_config[type].tx_loadsz;
2716}
2717
2693static void __init 2718static void __init
2694serial8250_register_ports(struct uart_driver *drv, struct device *dev) 2719serial8250_register_ports(struct uart_driver *drv, struct device *dev)
2695{ 2720{
@@ -2706,6 +2731,10 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
2706 struct uart_8250_port *up = &serial8250_ports[i]; 2731 struct uart_8250_port *up = &serial8250_ports[i];
2707 2732
2708 up->port.dev = dev; 2733 up->port.dev = dev;
2734
2735 if (up->port.flags & UPF_FIXED_TYPE)
2736 serial8250_init_fixed_type_port(up, up->port.type);
2737
2709 uart_add_one_port(drv, &up->port); 2738 uart_add_one_port(drv, &up->port);
2710 } 2739 }
2711} 2740}
@@ -3118,12 +3147,8 @@ int serial8250_register_port(struct uart_port *port)
3118 if (port->dev) 3147 if (port->dev)
3119 uart->port.dev = port->dev; 3148 uart->port.dev = port->dev;
3120 3149
3121 if (port->flags & UPF_FIXED_TYPE) { 3150 if (port->flags & UPF_FIXED_TYPE)
3122 uart->port.type = port->type; 3151 serial8250_init_fixed_type_port(uart, port->type);
3123 uart->port.fifosize = uart_config[port->type].fifo_size;
3124 uart->capabilities = uart_config[port->type].flags;
3125 uart->tx_loadsz = uart_config[port->type].tx_loadsz;
3126 }
3127 3152
3128 set_io_from_upio(&uart->port); 3153 set_io_from_upio(&uart->port);
3129 /* Possibly override default I/O functions. */ 3154 /* Possibly override default I/O functions. */