These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / tty / serial / mpc52xx_uart.c
index 1589f17..8c3e513 100644 (file)
@@ -239,8 +239,9 @@ static int mpc52xx_psc_tx_rdy(struct uart_port *port)
 
 static int mpc52xx_psc_tx_empty(struct uart_port *port)
 {
-       return in_be16(&PSC(port)->mpc52xx_psc_status)
-           & MPC52xx_PSC_SR_TXEMP;
+       u16 sts = in_be16(&PSC(port)->mpc52xx_psc_status);
+
+       return (sts & MPC52xx_PSC_SR_TXEMP) ? TIOCSER_TEMT : 0;
 }
 
 static void mpc52xx_psc_start_tx(struct uart_port *port)
@@ -405,7 +406,7 @@ static struct psc_ops mpc5200b_psc_ops = {
        .get_mr1 = mpc52xx_psc_get_mr1,
 };
 
-#endif /* CONFIG_MPC52xx */
+#endif /* CONFIG_PPC_MPC52xx */
 
 #ifdef CONFIG_PPC_MPC512x
 #define FIFO_512x(port) ((struct mpc512x_psc_fifo __iomem *)(PSC(port)+1))
@@ -1134,6 +1135,13 @@ mpc52xx_uart_startup(struct uart_port *port)
        psc_ops->command(port, MPC52xx_PSC_RST_RX);
        psc_ops->command(port, MPC52xx_PSC_RST_TX);
 
+       /*
+        * According to Freescale's support the RST_TX command can produce a
+        * spike on the TX pin. So they recommend to delay "for one character".
+        * One millisecond should be enough for everyone.
+        */
+       msleep(1);
+
        psc_ops->set_sicr(port, 0);     /* UART mode DCD ignored */
 
        psc_ops->fifo_init(port);