|
@@ -316,7 +316,7 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset)
|
|
* differ from the value that was last written. As it only
|
|
* differ from the value that was last written. As it only
|
|
* clears after being set, reread conditionally.
|
|
* clears after being set, reread conditionally.
|
|
*/
|
|
*/
|
|
- if (sport->ucr2 & UCR2_SRST)
|
|
|
|
|
|
+ if (!(sport->ucr2 & UCR2_SRST))
|
|
sport->ucr2 = readl(sport->port.membase + offset);
|
|
sport->ucr2 = readl(sport->port.membase + offset);
|
|
return sport->ucr2;
|
|
return sport->ucr2;
|
|
break;
|
|
break;
|
|
@@ -1833,6 +1833,11 @@ static int imx_uart_rs485_config(struct uart_port *port,
|
|
rs485conf->flags &= ~SER_RS485_ENABLED;
|
|
rs485conf->flags &= ~SER_RS485_ENABLED;
|
|
|
|
|
|
if (rs485conf->flags & SER_RS485_ENABLED) {
|
|
if (rs485conf->flags & SER_RS485_ENABLED) {
|
|
|
|
+ /* Enable receiver if low-active RTS signal is requested */
|
|
|
|
+ if (sport->have_rtscts && !sport->have_rtsgpio &&
|
|
|
|
+ !(rs485conf->flags & SER_RS485_RTS_ON_SEND))
|
|
|
|
+ rs485conf->flags |= SER_RS485_RX_DURING_TX;
|
|
|
|
+
|
|
/* disable transmitter */
|
|
/* disable transmitter */
|
|
ucr2 = imx_uart_readl(sport, UCR2);
|
|
ucr2 = imx_uart_readl(sport, UCR2);
|
|
if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
|
|
if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
|
|
@@ -2265,6 +2270,18 @@ static int imx_uart_probe(struct platform_device *pdev)
|
|
(!sport->have_rtscts && !sport->have_rtsgpio))
|
|
(!sport->have_rtscts && !sport->have_rtsgpio))
|
|
dev_err(&pdev->dev, "no RTS control, disabling rs485\n");
|
|
dev_err(&pdev->dev, "no RTS control, disabling rs485\n");
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * If using the i.MX UART RTS/CTS control then the RTS (CTS_B)
|
|
|
|
+ * signal cannot be set low during transmission in case the
|
|
|
|
+ * receiver is off (limitation of the i.MX UART IP).
|
|
|
|
+ */
|
|
|
|
+ if (sport->port.rs485.flags & SER_RS485_ENABLED &&
|
|
|
|
+ sport->have_rtscts && !sport->have_rtsgpio &&
|
|
|
|
+ (!(sport->port.rs485.flags & SER_RS485_RTS_ON_SEND) &&
|
|
|
|
+ !(sport->port.rs485.flags & SER_RS485_RX_DURING_TX)))
|
|
|
|
+ dev_err(&pdev->dev,
|
|
|
|
+ "low-active RTS not possible when receiver is off, enabling receiver\n");
|
|
|
|
+
|
|
imx_uart_rs485_config(&sport->port, &sport->port.rs485);
|
|
imx_uart_rs485_config(&sport->port, &sport->port.rs485);
|
|
|
|
|
|
/* Disable interrupts before requesting them */
|
|
/* Disable interrupts before requesting them */
|