Skip to contentSkip to conversation

tty: serial: imx: Enable UART before toggling CTS on probe

PATCH New Marek Vasut 1 participant 1 message Feb 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: serial: imx: Enable UART before toggling CTS on probe

In case the UART and RX is not enabled, the CTS control is inoperable. This is noticable with SER_RS485_RTS_ON_SEND, which should pull the CTS line low when probing the driver, however it does nothing instead. With this patch, the CTS line is correctly pulled low.

Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/tty/serial/imx.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/tty/serial/imx.c +9 -1
index d8034f1666861..958e8ed98b6d9 100644
@@ -1901,7 +1901,7 @@ static int imx_uart_rs485_config(struct uart_port *port,
 				 struct serial_rs485 *rs485conf)
 {
 	struct imx_port *sport = (struct imx_port *)port;
-	u32 ucr2;
+	u32 ucr1, ucr2;
 
 	/* RTS is required to control the transmitter */
 	if (!sport->have_rtscts && !sport->have_rtsgpio)
@@ -1913,6 +1913,14 @@ static int imx_uart_rs485_config(struct uart_port *port,
 		    !(rs485conf->flags & SER_RS485_RTS_ON_SEND))
 			rs485conf->flags |= SER_RS485_RX_DURING_TX;
 
+		ucr1 = imx_uart_readl(sport, UCR1);
+		ucr1 |= UCR1_UARTEN;
+		imx_uart_writel(sport, ucr1, UCR1);
+
+		ucr2 = imx_uart_readl(sport, UCR2);
+		ucr2 |= UCR2_RXEN;
+		imx_uart_writel(sport, ucr2, UCR2);
+
 		/* disable transmitter */
 		ucr2 = imx_uart_readl(sport, UCR2);
 		if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
Signature · 7 lines
2.34.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel