summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2018-04-17 11:34:34 +0200
committerPhilippe Schenker <philippe.schenker@toradex.com>2019-05-24 11:34:17 +0200
commit3398c34481c1dafcc8cea6244a29ab8c85843055 (patch)
tree5ff4536b4d42dc5e50b18e77e1f9cdc2ea3599b1
parent6c93371b2b0484ac43e7b35ab4e459bbb2a0714b (diff)
serial: imx: add RS-485 device tree properties
Add device tree properties to influence RTS polarity and whether the receiver is enabled during transmission (rs485-rts-active-low, rs485-rx-during-tx). This aligns with behavior with upstream Linux, where RTS is active high by default (SER_RS485_RTS_AFTER_SEND) and the receiver is disabled by default when using RS485 (SER_RS485_RX_DURING_TX). Note that for Toradex hardware both properties are required, hence using RS-485 on Toradex Carrier Boards requires the following properties being specified in the device tree: linux,rs485-enabled-at-boot-time; rs485-rts-active-low; rs485-rx-during-tx; Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 72919eb5f9e7a9aeb5fc1c2aa694b07994fb5a8d) Conflicts: drivers/tty/serial/imx.c
-rw-r--r--drivers/tty/serial/imx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 2a8062cbe984..77881ce9828b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2120,8 +2120,16 @@ static int serial_imx_probe_dt(struct imx_port *sport,
if (of_get_property(np, "rts-gpios", NULL))
sport->have_rtsgpio = 1;
- if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) {
+ sport->port.rs485.flags |= SER_RS485_RTS_AFTER_SEND;
+
+ if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time"))
sport->port.rs485.flags |= SER_RS485_ENABLED;
+
+ if (of_property_read_bool(np, "rs485-rx-during-tx"))
+ sport->port.rs485.flags |= SER_RS485_RX_DURING_TX;
+
+ if (of_property_read_bool(np, "rs485-rts-active-low")) {
+ sport->port.rs485.flags &= ~SER_RS485_RTS_ON_SEND;
sport->port.rs485.flags |= SER_RS485_RTS_AFTER_SEND;
}