[PATCH v2] serial: xuartps: keep transmitter enabled

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

 



commit 6e14f7c1f2c2 ("tty: xuartps: Improve startup function") changed
cdns_uart_startup to disable the transmitter. It turns out the disabling
the transmitter may not be the best idea, because it tends to corrupt
serial output and may cause hangs. commit e3538c37ee38 ("tty: xuartps:
Beautify read-modify writes") accidentally changed
cdns_uart_console_write from temporarily enabling the transmitter to
permanently enabling it and thus improved the situation.

Revert the disabling of the transmitter in cdns_uart_startup to have the
transmitter always active.

Clean up cdns_uart_console_write by removing the now unneeded write to
the crontol register that formerly disabled the transmitter.

Signed-off-by: Helmut Grohne <h.grohne@xxxxxxxxxx>
Link: https://lkml.kernel.org/r/20160729073858.GA1416@laureti-dev
Fixes: 6e14f7c1f2c2 ("tty: xuartps: Improve startup function")
Fixes: e3538c37ee38 ("tty: xuartps: Beautify read-modify writes")
---
 drivers/tty/serial/xilinx_uartps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

This patch is the other way to fix commit e3538c37ee38 ("tty: xuartps:
Beautify read-modify writes"). It replaces both the initial patch
"serial: xuartps: reset TX state to initial after write" and "serial:
xuartps: fix typo in cdns_uart_startup".

Either makes the transmitter state in cdns_uart_console_write consistent
with cdns_uart_startup and fixes the typo in cdns_uart_startup. Choose
wisely. Both approaches work for me.

Helmut

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index cd46e64..112e7fb 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -757,8 +757,8 @@ static int cdns_uart_startup(struct uart_port *port)
 	 * the receiver.
 	 */
 	status = readl(port->membase + CDNS_UART_CR);
-	status &= CDNS_UART_CR_RX_DIS;
-	status |= CDNS_UART_CR_RX_EN;
+	status &= ~(CDNS_UART_CR_RX_DIS | CDNS_UART_CR_TX_DIS);
+	status |= CDNS_UART_CR_RX_EN | CDNS_UART_CR_TX_EN;
 	writel(status, port->membase + CDNS_UART_CR);
 
 	/* Set the Mode Register with normal mode,8 data bits,1 stop bit,
@@ -1118,8 +1118,6 @@ static void cdns_uart_console_write(struct console *co, const char *s,
 	uart_console_write(port, s, count, cdns_uart_console_putchar);
 	cdns_uart_console_wait_tx(port);
 
-	writel(ctrl, port->membase + CDNS_UART_CR);
-
 	/* restore interrupt state */
 	writel(imr, port->membase + CDNS_UART_IER);
 
-- 
2.1.4

--
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