Skip to contentSkip to conversation

Don't shutdown mpc5200 serial port if it is a console

PATCH In review Grant Likely 2 participants 2 messages Apr 19, 2007 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't shutdown mpc5200 serial port if it is a console

If the serial port gets shut down, then console output stalls. 9 out of 10 kernel hackers agree, this is a bad thing.

---

This is a simple bug fix, but it's not a critical one. It would be really nice to get this merged for 2.6.21

 drivers/serial/mpc52xx_uart.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/serial/mpc52xx_uart.c +8 -6
index f8c1761..35669f8 100644
@@ -257,14 +257,16 @@ mpc52xx_uart_shutdown(struct uart_port *port)
 {
 	struct mpc52xx_psc __iomem *psc = PSC(port);
 
-	/* Shut down the port, interrupt and all */
-	out_8(&psc->command,MPC52xx_PSC_RST_RX);
-	out_8(&psc->command,MPC52xx_PSC_RST_TX);
+	/* We don't want to shut down a port that is used as a console */
+	if (!uart_console(port)) {
+		out_8(&psc->command,MPC52xx_PSC_RST_RX);
+		out_8(&psc->command,MPC52xx_PSC_RST_TX);
 
-	port->read_status_mask = 0;
-	out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+		port->read_status_mask = 0;
+		out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+	}
 
-	/* Release interrupt */
+	/* Release interrupt (OK for console port b/c console uses polling) */
 	free_irq(port->irq, port);
 }
 
Signature · 1 line
1.5.1
#1 lore raw

The idea is OK,

but only TX should be left active and the interrupts should still be disabled (imr set to 0), so we don't generate unhandled interrupts ...

Sylvain

Quoted 40 lines · Grant Likely

If the serial port gets shut down, then console output stalls. 9 out of 10 kernel hackers agree, this is a bad thing.

---

This is a simple bug fix, but it's not a critical one. It would be really nice to get this merged for 2.6.21

 drivers/serial/mpc52xx_uart.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/serial/mpc52xx_uart.c +8 -6
index f8c1761..35669f8 100644
@@ -257,14 +257,16 @@ mpc52xx_uart_shutdown(struct uart_port *port)
 {
 	struct mpc52xx_psc __iomem *psc = PSC(port);
 
-	/* Shut down the port, interrupt and all */
-	out_8(&psc->command,MPC52xx_PSC_RST_RX);
-	out_8(&psc->command,MPC52xx_PSC_RST_TX);
+	/* We don't want to shut down a port that is used as a console */
+	if (!uart_console(port)) {
+		out_8(&psc->command,MPC52xx_PSC_RST_RX);
+		out_8(&psc->command,MPC52xx_PSC_RST_TX);
 
-	port->read_status_mask = 0;
-	out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+		port->read_status_mask = 0;
+		out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+	}
 
-	/* Release interrupt */
+	/* Release interrupt (OK for console port b/c console uses polling) */
 	free_irq(port->irq, port);
 }