diff options
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r-- | drivers/serial/8250.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index b4b39811b445..fb867a9f55e9 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -137,6 +137,7 @@ struct uart_8250_port { | |||
137 | unsigned char mcr; | 137 | unsigned char mcr; |
138 | unsigned char mcr_mask; /* mask of user bits */ | 138 | unsigned char mcr_mask; /* mask of user bits */ |
139 | unsigned char mcr_force; /* mask of forced bits */ | 139 | unsigned char mcr_force; /* mask of forced bits */ |
140 | unsigned char cur_iotype; /* Running I/O type */ | ||
140 | 141 | ||
141 | /* | 142 | /* |
142 | * Some bits in registers are cleared on a read, so they must | 143 | * Some bits in registers are cleared on a read, so they must |
@@ -286,6 +287,13 @@ static const struct serial8250_config uart_config[] = { | |||
286 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 287 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
287 | .flags = UART_CAP_FIFO, | 288 | .flags = UART_CAP_FIFO, |
288 | }, | 289 | }, |
290 | [PORT_AR7] = { | ||
291 | .name = "AR7", | ||
292 | .fifo_size = 16, | ||
293 | .tx_loadsz = 16, | ||
294 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, | ||
295 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
296 | }, | ||
289 | }; | 297 | }; |
290 | 298 | ||
291 | #if defined (CONFIG_SERIAL_8250_AU1X00) | 299 | #if defined (CONFIG_SERIAL_8250_AU1X00) |
@@ -471,6 +479,7 @@ static void io_serial_out(struct uart_port *p, int offset, int value) | |||
471 | 479 | ||
472 | static void set_io_from_upio(struct uart_port *p) | 480 | static void set_io_from_upio(struct uart_port *p) |
473 | { | 481 | { |
482 | struct uart_8250_port *up = (struct uart_8250_port *)p; | ||
474 | switch (p->iotype) { | 483 | switch (p->iotype) { |
475 | case UPIO_HUB6: | 484 | case UPIO_HUB6: |
476 | p->serial_in = hub6_serial_in; | 485 | p->serial_in = hub6_serial_in; |
@@ -509,6 +518,8 @@ static void set_io_from_upio(struct uart_port *p) | |||
509 | p->serial_out = io_serial_out; | 518 | p->serial_out = io_serial_out; |
510 | break; | 519 | break; |
511 | } | 520 | } |
521 | /* Remember loaded iotype */ | ||
522 | up->cur_iotype = p->iotype; | ||
512 | } | 523 | } |
513 | 524 | ||
514 | static void | 525 | static void |
@@ -1937,6 +1948,9 @@ static int serial8250_startup(struct uart_port *port) | |||
1937 | up->capabilities = uart_config[up->port.type].flags; | 1948 | up->capabilities = uart_config[up->port.type].flags; |
1938 | up->mcr = 0; | 1949 | up->mcr = 0; |
1939 | 1950 | ||
1951 | if (up->port.iotype != up->cur_iotype) | ||
1952 | set_io_from_upio(port); | ||
1953 | |||
1940 | if (up->port.type == PORT_16C950) { | 1954 | if (up->port.type == PORT_16C950) { |
1941 | /* Wake up and initialize UART */ | 1955 | /* Wake up and initialize UART */ |
1942 | up->acr = 0; | 1956 | up->acr = 0; |
@@ -2563,6 +2577,9 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
2563 | if (ret < 0) | 2577 | if (ret < 0) |
2564 | probeflags &= ~PROBE_RSA; | 2578 | probeflags &= ~PROBE_RSA; |
2565 | 2579 | ||
2580 | if (up->port.iotype != up->cur_iotype) | ||
2581 | set_io_from_upio(port); | ||
2582 | |||
2566 | if (flags & UART_CONFIG_TYPE) | 2583 | if (flags & UART_CONFIG_TYPE) |
2567 | autoconfig(up, probeflags); | 2584 | autoconfig(up, probeflags); |
2568 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) | 2585 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) |
@@ -2671,6 +2688,11 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) | |||
2671 | { | 2688 | { |
2672 | int i; | 2689 | int i; |
2673 | 2690 | ||
2691 | for (i = 0; i < nr_uarts; i++) { | ||
2692 | struct uart_8250_port *up = &serial8250_ports[i]; | ||
2693 | up->cur_iotype = 0xFF; | ||
2694 | } | ||
2695 | |||
2674 | serial8250_isa_init_ports(); | 2696 | serial8250_isa_init_ports(); |
2675 | 2697 | ||
2676 | for (i = 0; i < nr_uarts; i++) { | 2698 | for (i = 0; i < nr_uarts; i++) { |