aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/8250/8250.c
diff options
context:
space:
mode:
authorFlavio Leitner <fbl@redhat.com>2012-09-18 15:21:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-21 12:53:15 -0400
commitbd21f551c365e50a241b4cee4bc8be72914ff236 (patch)
treec67fce569d97f38504fd145bf1f173345aeedbec /drivers/tty/serial/8250/8250.c
parent05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c (diff)
8250: fix autoconfig to work with serial console
The autoconfig prints messages while holding the port's spinlock and that causes a deadlock when using serial console. Signed-off-by: Flavio Leitner <fbl@redhat.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250.c')
-rw-r--r--drivers/tty/serial/8250/8250.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index d4e0b07cb13..932a216aa5b 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -1037,6 +1037,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1037 unsigned char save_lcr, save_mcr; 1037 unsigned char save_lcr, save_mcr;
1038 struct uart_port *port = &up->port; 1038 struct uart_port *port = &up->port;
1039 unsigned long flags; 1039 unsigned long flags;
1040 unsigned int old_capabilities;
1040 1041
1041 if (!port->iobase && !port->mapbase && !port->membase) 1042 if (!port->iobase && !port->mapbase && !port->membase)
1042 return; 1043 return;
@@ -1087,6 +1088,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1087 /* 1088 /*
1088 * We failed; there's nothing here 1089 * We failed; there's nothing here
1089 */ 1090 */
1091 spin_unlock_irqrestore(&port->lock, flags);
1090 DEBUG_AUTOCONF("IER test failed (%02x, %02x) ", 1092 DEBUG_AUTOCONF("IER test failed (%02x, %02x) ",
1091 scratch2, scratch3); 1093 scratch2, scratch3);
1092 goto out; 1094 goto out;
@@ -1110,6 +1112,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1110 status1 = serial_in(up, UART_MSR) & 0xF0; 1112 status1 = serial_in(up, UART_MSR) & 0xF0;
1111 serial_out(up, UART_MCR, save_mcr); 1113 serial_out(up, UART_MCR, save_mcr);
1112 if (status1 != 0x90) { 1114 if (status1 != 0x90) {
1115 spin_unlock_irqrestore(&port->lock, flags);
1113 DEBUG_AUTOCONF("LOOP test failed (%02x) ", 1116 DEBUG_AUTOCONF("LOOP test failed (%02x) ",
1114 status1); 1117 status1);
1115 goto out; 1118 goto out;
@@ -1132,8 +1135,6 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1132 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); 1135 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO);
1133 scratch = serial_in(up, UART_IIR) >> 6; 1136 scratch = serial_in(up, UART_IIR) >> 6;
1134 1137
1135 DEBUG_AUTOCONF("iir=%d ", scratch);
1136
1137 switch (scratch) { 1138 switch (scratch) {
1138 case 0: 1139 case 0:
1139 autoconfig_8250(up); 1140 autoconfig_8250(up);
@@ -1167,19 +1168,13 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1167 1168
1168 serial_out(up, UART_LCR, save_lcr); 1169 serial_out(up, UART_LCR, save_lcr);
1169 1170
1170 if (up->capabilities != uart_config[port->type].flags) {
1171 printk(KERN_WARNING
1172 "ttyS%d: detected caps %08x should be %08x\n",
1173 serial_index(port), up->capabilities,
1174 uart_config[port->type].flags);
1175 }
1176
1177 port->fifosize = uart_config[up->port.type].fifo_size; 1171 port->fifosize = uart_config[up->port.type].fifo_size;
1172 old_capabilities = up->capabilities;
1178 up->capabilities = uart_config[port->type].flags; 1173 up->capabilities = uart_config[port->type].flags;
1179 up->tx_loadsz = uart_config[port->type].tx_loadsz; 1174 up->tx_loadsz = uart_config[port->type].tx_loadsz;
1180 1175
1181 if (port->type == PORT_UNKNOWN) 1176 if (port->type == PORT_UNKNOWN)
1182 goto out; 1177 goto out_lock;
1183 1178
1184 /* 1179 /*
1185 * Reset the UART. 1180 * Reset the UART.
@@ -1196,8 +1191,16 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1196 else 1191 else
1197 serial_out(up, UART_IER, 0); 1192 serial_out(up, UART_IER, 0);
1198 1193
1199 out: 1194out_lock:
1200 spin_unlock_irqrestore(&port->lock, flags); 1195 spin_unlock_irqrestore(&port->lock, flags);
1196 if (up->capabilities != old_capabilities) {
1197 printk(KERN_WARNING
1198 "ttyS%d: detected caps %08x should be %08x\n",
1199 serial_index(port), old_capabilities,
1200 up->capabilities);
1201 }
1202out:
1203 DEBUG_AUTOCONF("iir=%d ", scratch);
1201 DEBUG_AUTOCONF("type=%s\n", uart_config[port->type].name); 1204 DEBUG_AUTOCONF("type=%s\n", uart_config[port->type].name);
1202} 1205}
1203 1206