[PATCH] serial: mpc52xx: add delay after resetting transmitter to fix broken chars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes receiving broken characters on the console from an MPC5125
system when systemd comes up which repeatedly opens and shuts down the
console device.

Trial and error with the needed interval showed that 500 us are good
enough most of the time when using 38400 Bd, so I think 1 ms is a good
compromise between fixing the issue and not penalize faster setups too
much.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
Hello,

a probably better fix would be to move the RST_TX command to probe, but
I think this is too invasive as a late fix or to be backported for
stable. I think just adding the delay should be fine for this purpose,
but I let Greg decide.

Best regards
Uwe

 drivers/tty/serial/mpc52xx_uart.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 66dc4ea828f7..b0702d97e75e 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1135,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.
+	 */
+	mdelay(1);
+
 	psc_ops->set_sicr(port, 0);	/* UART mode DCD ignored */
 
 	psc_ops->fifo_init(port);
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux