Skip to contentSkip to conversation

Add and make use of a common rs485 device tree parsing function

PATCH Superseded Uwe Kleine-König 5 participants 19 messages Jun 26, 2017 – Jun 29, 2017

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add and make use of a common rs485 device tree parsing function

Hello,

this is v3 of the series that targets to consolidate parsing the rs485 specific dt properties in a single place.

The only changes since v2 (Message-Id:
<[email protected]>) are:

- simplify atmel driver to not have a single line function that is only called once
- build warning fix in omap driver (already sent a v2.5 for that)

Best regards
Uwe

Sascha Hauer (6):
serial: Add common rs485 device tree parsing function
serial: atmel: Use common rs485 device tree parsing function
serial: fsl_lpuart: Use common rs485 device tree parsing function
serial: omap-serial: Use common rs485 device tree parsing function
serial: imx: default to half duplex rs485
serial: imx: Use common rs485 device tree parsing function

Uwe Kleine-K?nig (3):
serial: fsl_lpuart: clear unsupported options in .rs485_config()
dt-bindings: serial/rs485: make rs485-rts-delay optional
of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP
UART

 .../devicetree/bindings/serial/atmel-usart.txt     |  1 +
 .../devicetree/bindings/serial/fsl-imx-uart.txt    |  1 +
 .../devicetree/bindings/serial/fsl-lpuart.txt      |  1 +
 .../devicetree/bindings/serial/omap_serial.txt     |  1 +
 Documentation/devicetree/bindings/serial/rs485.txt |  5 +--
 drivers/tty/serial/Kconfig                         |  4 ++
 drivers/tty/serial/Makefile                        |  2 +
 drivers/tty/serial/atmel_serial.c                  | 25 +-----------
 drivers/tty/serial/fsl_lpuart.c                    | 29 ++++++++++---
 drivers/tty/serial/imx.c                           |  5 ++-
 drivers/tty/serial/of.c                            | 47 ++++++++++++++++++++++
 drivers/tty/serial/omap-serial.c                   | 13 +-----
 include/linux/serial_core.h                        | 13 ++++++
 13 files changed, 100 insertions(+), 47 deletions(-)
 create mode 100644 drivers/tty/serial/of.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/9 serial: fsl_lpuart: clear unsupported options in .rs485_config()

The struct serial_rs485 parameter is both input and output and is supposed to hold the actually used configuration on return. So clear unsupported settings.

---
 drivers/tty/serial/fsl_lpuart.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/tty/serial/fsl_lpuart.c +5 -0
index 15df1ba78095..6e39ef96c6ca 100644
@@ -985,6 +985,11 @@ static int lpuart_config_rs485(struct uart_port *port,
 		~(UARTMODEM_TXRTSPOL | UARTMODEM_TXRTSE);
 	writeb(modem, sport->port.membase + UARTMODEM);
 
+	/* clear unsupported configurations */
+	rs485->delay_rts_before_send = 0;
+	rs485->delay_rts_after_send = 0;
+	rs485->flags &= ~SER_RS485_RX_DURING_TX;
+
 	if (rs485->flags & SER_RS485_ENABLED) {
 		/* Enable auto RS-485 RTS mode */
 		modem |= UARTMODEM_TXRTSE;
Signature · 1 line
2.11.0
#2 lore raw

PATCH v3 2/9 dt-bindings: serial/rs485: make rs485-rts-delay optional

In reply to Uwe Kleine-König

There are a few device trees that specify one of the already optional properties without also having the up to now required property rs485-rts-delay. Additionally there is no technical reason to require rs485-rts-delay and that's also what most drivers implement.

So give existing users and implementers a blessing and document rs485-rts-delay as optional.

---
 Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/rs485.txt +2 -3
index 32b1fa1f2a5b..b8415936dfdb 100644
@@ -5,14 +5,13 @@ the built-in half-duplex mode.
 The properties described hereafter shall be given to a half-duplex capable
 UART node.
 
-Required properties:
+Optional properties:
 - rs485-rts-delay: prop-encoded-array <a b> where:
   * a is the delay between rts signal and beginning of data sent in milliseconds.
       it corresponds to the delay before sending data.
   * b is the delay between end of data sent and rts signal in milliseconds
       it corresponds to the delay after sending data and actual release of the line.
-
-Optional properties:
+  If this property is not specified, <0 0> is assumed.
 - linux,rs485-enabled-at-boot-time: empty property telling to enable the rs485
   feature at boot time. It can be disabled later with proper ioctl.
 - rs485-rx-during-tx: empty property that enables the receiving of data even
Signature · 1 line
2.11.0
maintainer
#3 lore raw

PATCH v3 2/9 dt-bindings: serial/rs485: make rs485-rts-delay optional

Quoted 5 lines · Uwe Kleine-K?nig

There are a few device trees that specify one of the already optional properties without also having the up to now required property rs485-rts-delay. Additionally there is no technical reason to require rs485-rts-delay and that's also what most drivers implement.

Quoted 7 lines

So give existing users and implementers a blessing and document rs485-rts-delay as optional.

---
 Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
#4 lore raw

PATCH v3 3/9 serial: Add common rs485 device tree parsing function

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

Several drivers have the same device tree parsing code. Create a common helper function for it.

[ukl: implement default <0 0> for rts-delay, unset unspecified flags]
---
 drivers/tty/serial/Kconfig  |  4 ++++
 drivers/tty/serial/Makefile |  2 ++
 drivers/tty/serial/of.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/serial_core.h | 13 +++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 drivers/tty/serial/of.c
drivers/tty/serial/Kconfig +4 -0
index 5c8850f7a2a0..8baef5b95bed 100644
@@ -14,6 +14,10 @@ config SERIAL_EARLYCON
 	  the console before standard serial driver is probed. The console is
 	  enabled when early_param is processed.
 
+config OF_SERIAL
+	depends on SERIAL_CORE
+	def_bool y
+
 source "drivers/tty/serial/8250/Kconfig"
 
 comment "Non-8250 serial port support"
drivers/tty/serial/Makefile +2 -0
index 53c03e005132..0fee8f4e36cb 100644
@@ -7,6 +7,8 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o
 obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o
 obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o
 
+obj-$(CONFIG_OF_SERIAL) += of.o
+
 # These Sparc drivers have to appear before others such as 8250
 # which share ttySx minor node space.  Otherwise console device
 # names change and other unplesantries.
drivers/tty/serial/of.c new file +47 -0

47 lines not on this page · raw message

include/linux/serial_core.h +13 -0
index 64d892f1e5cd..5ba00b1be093 100644
@@ -500,4 +500,17 @@ static inline int uart_handle_break(struct uart_port *port)
 					 (cflag) & CRTSCTS || \
 					 !((cflag) & CLOCAL))
 
+/*
+ * Common device tree parsing helpers
+ */
+#ifdef CONFIG_OF_SERIAL
+int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf);
+#else
+static inline int of_get_rs485_mode(struct device_node *np,
+				    struct serial_rs485 *rs485conf)
+{
+	return 1;
+}
+#endif
+
 #endif /* LINUX_SERIAL_CORE_H */
Signature · 1 line
2.11.0
maintainer
#5 lore raw

PATCH v3 3/9 serial: Add common rs485 device tree parsing function

Quoted 8 lines · Uwe Kleine-K?nig

From: Sascha Hauer <[email protected]>

Several drivers have the same device tree parsing code. Create a common helper function for it.

[ukl: implement default <0 0> for rts-delay, unset unspecified flags]
Quoted 112 lines
---
 drivers/tty/serial/Kconfig  |  4 ++++
 drivers/tty/serial/Makefile |  2 ++
 drivers/tty/serial/of.c     | 47 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/serial_core.h | 13 +++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 drivers/tty/serial/of.c
drivers/tty/serial/Kconfig +4 -0
index 5c8850f7a2a0..8baef5b95bed 100644
@@ -14,6 +14,10 @@ config SERIAL_EARLYCON
 	  the console before standard serial driver is probed. The console is
 	  enabled when early_param is processed.
 
+config OF_SERIAL
+	depends on SERIAL_CORE
+	def_bool y
+
 source "drivers/tty/serial/8250/Kconfig"
 
 comment "Non-8250 serial port support"
drivers/tty/serial/Makefile +2 -0
index 53c03e005132..0fee8f4e36cb 100644
@@ -7,6 +7,8 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o
 obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o
 obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o
 
+obj-$(CONFIG_OF_SERIAL) += of.o
+
 # These Sparc drivers have to appear before others such as 8250
 # which share ttySx minor node space.  Otherwise console device
 # names change and other unplesantries.
drivers/tty/serial/of.c new file +47 -0
new file mode 100644
index 000000000000..b24e4357661b
@@ -0,0 +1,47 @@
+#include <linux/kernel.h>
+#include <linux/export.h>
+#include <linux/of.h>
+#include <linux/serial_core.h>
+
+/**
+ * of_get_rs485_mode() - Implement parsing rs485 properties
+ * @np: uart node
+ * @rs485conf: output parameter
+ *
+ * This function implements the device tree binding described in
+ * Documentation/devicetree/bindings/serial/rs485.txt.
+ *
+ * Return: 0 on success, 1 if the node doesn't contain rs485 stuff.
+ */
+int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf)
+{
+	u32 rs485_delay[2];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_OF) || !np)
+		return 1;
+
+	ret = of_property_read_u32_array(np, "rs485-rts-delay" rs485_delay, 2);
+	if (!ret) {
+		rs485conf->delay_rts_before_send = rs485_delay[0];
+		rs485conf->delay_rts_after_send = rs485_delay[1];
+	} else {
+		rs485conf->delay_rts_before_send = 0;
+		rs485conf->delay_rts_after_send = 0;
+	}
+
+	/*
+	 * clear full-duplex and enabled flags to get to a defined state with
+	 * the two following properties.
+	 */
+	rs485conf->flags &= ~(SER_RS485_RX_DURING_TX | SER_RS485_ENABLED);
+
+	if (of_property_read_bool(np, "rs485-rx-during-tx"))
+		rs485conf->flags |= SER_RS485_RX_DURING_TX;
+
+	if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time"))
+		rs485conf->flags |= SER_RS485_ENABLED;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_get_rs485_mode);
include/linux/serial_core.h +13 -0
index 64d892f1e5cd..5ba00b1be093 100644
@@ -500,4 +500,17 @@ static inline int uart_handle_break(struct uart_port *port)
 					 (cflag) & CRTSCTS || \
 					 !((cflag) & CLOCAL))
 
+/*
+ * Common device tree parsing helpers
+ */
+#ifdef CONFIG_OF_SERIAL
+int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf);
+#else
+static inline int of_get_rs485_mode(struct device_node *np,
+				    struct serial_rs485 *rs485conf)
+{
+	return 1;
+}
+#endif
+
 #endif /* LINUX_SERIAL_CORE_H */
Signature · 1 line
Nicolas Ferre
#6 lore raw

PATCH v3 4/9 serial: atmel: Use common rs485 device tree parsing function

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.

Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears SER_RS485_RX_DURING_TX and SER_RS485_ENABLED only but always which makes more sense.

[ukleinek: point out semantic change in commit log]
---
 drivers/tty/serial/atmel_serial.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/tty/serial/atmel_serial.c +1 -24
index 937d67f22fba..245d9c227ad5 100644
@@ -1684,29 +1684,6 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port,
 	}
 }
 
-static void atmel_init_rs485(struct uart_port *port,
-				struct platform_device *pdev)
-{
-	struct device_node *np = pdev->dev.of_node;
-
-	struct serial_rs485 *rs485conf = &port->rs485;
-	u32 rs485_delay[2];
-
-	/* rs485 properties */
-	if (of_property_read_u32_array(np, "rs485-rts-delay",
-				       rs485_delay, 2) == 0) {
-		rs485conf->delay_rts_before_send = rs485_delay[0];
-		rs485conf->delay_rts_after_send = rs485_delay[1];
-		rs485conf->flags = 0;
-	}
-
-	if (of_get_property(np, "rs485-rx-during-tx", NULL))
-		rs485conf->flags |= SER_RS485_RX_DURING_TX;
-
-	if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL))
-		rs485conf->flags |= SER_RS485_ENABLED;
-}
-
 static void atmel_set_ops(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
@@ -2390,7 +2367,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
 	atmel_init_property(atmel_port, pdev);
 	atmel_set_ops(port);
 
-	atmel_init_rs485(port, pdev);
+	of_get_rs485_mode(pdev->dev.of_node, &port->rs485);
 
 	port->iotype		= UPIO_MEM;
 	port->flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP;
Signature · 1 line
2.11.0
maintainer
#7 lore raw

PATCH v3 4/9 serial: atmel: Use common rs485 device tree parsing function

Quoted 9 lines · Uwe Kleine-K?nig

From: Sascha Hauer <[email protected]>

We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.

Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears SER_RS485_RX_DURING_TX and SER_RS485_ENABLED only but always which makes more sense.

Sure:

Thanks Sasha and Uwe!

Quoted 51 lines
[ukleinek: point out semantic change in commit log]
---
 drivers/tty/serial/atmel_serial.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/tty/serial/atmel_serial.c +1 -24
index 937d67f22fba..245d9c227ad5 100644
@@ -1684,29 +1684,6 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port,
 	}
 }
 
-static void atmel_init_rs485(struct uart_port *port,
-				struct platform_device *pdev)
-{
-	struct device_node *np = pdev->dev.of_node;
-
-	struct serial_rs485 *rs485conf = &port->rs485;
-	u32 rs485_delay[2];
-
-	/* rs485 properties */
-	if (of_property_read_u32_array(np, "rs485-rts-delay",
-				       rs485_delay, 2) == 0) {
-		rs485conf->delay_rts_before_send = rs485_delay[0];
-		rs485conf->delay_rts_after_send = rs485_delay[1];
-		rs485conf->flags = 0;
-	}
-
-	if (of_get_property(np, "rs485-rx-during-tx", NULL))
-		rs485conf->flags |= SER_RS485_RX_DURING_TX;
-
-	if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL))
-		rs485conf->flags |= SER_RS485_ENABLED;
-}
-
 static void atmel_set_ops(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
@@ -2390,7 +2367,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
 	atmel_init_property(atmel_port, pdev);
 	atmel_set_ops(port);
 
-	atmel_init_rs485(port, pdev);
+	of_get_rs485_mode(pdev->dev.of_node, &port->rs485);
 
 	port->iotype		= UPIO_MEM;
 	port->flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP;
Signature · 1 line
Nicolas Ferre
#8 lore raw

PATCH v3 4/9 serial: atmel: Use common rs485 device tree parsing function

Quoted 11 lines · Nicolas Ferre
Quoted 9 lines · Uwe Kleine-K?nig

From: Sascha Hauer <[email protected]>

We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.

Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears SER_RS485_RX_DURING_TX and SER_RS485_ENABLED only but always which makes more sense.

Quoted 5 lines

Sure:

Thanks Sasha and Uwe!

Thanks !

Quoted 53 lines
Quoted 51 lines
[ukleinek: point out semantic change in commit log]
---
 drivers/tty/serial/atmel_serial.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/tty/serial/atmel_serial.c +1 -24
index 937d67f22fba..245d9c227ad5 100644
@@ -1684,29 +1684,6 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port,
 	}
 }
 
-static void atmel_init_rs485(struct uart_port *port,
-				struct platform_device *pdev)
-{
-	struct device_node *np = pdev->dev.of_node;
-
-	struct serial_rs485 *rs485conf = &port->rs485;
-	u32 rs485_delay[2];
-
-	/* rs485 properties */
-	if (of_property_read_u32_array(np, "rs485-rts-delay",
-				       rs485_delay, 2) == 0) {
-		rs485conf->delay_rts_before_send = rs485_delay[0];
-		rs485conf->delay_rts_after_send = rs485_delay[1];
-		rs485conf->flags = 0;
-	}
-
-	if (of_get_property(np, "rs485-rx-during-tx", NULL))
-		rs485conf->flags |= SER_RS485_RX_DURING_TX;
-
-	if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL))
-		rs485conf->flags |= SER_RS485_ENABLED;
-}
-
 static void atmel_set_ops(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
@@ -2390,7 +2367,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
 	atmel_init_property(atmel_port, pdev);
 	atmel_set_ops(port);
 
-	atmel_init_rs485(port, pdev);
+	of_get_rs485_mode(pdev->dev.of_node, &port->rs485);
 
 	port->iotype		= UPIO_MEM;
 	port->flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP;
#9 lore raw

PATCH v3 5/9 serial: fsl_lpuart: Use common rs485 device tree parsing function

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.

As a side effect this adds support for parsing rs485-rts-delay and rs485-rx-during-tx. As the driver doesn't support this though, probing fails if these are defined.

---
 drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/tty/serial/fsl_lpuart.c +18 -6
index 6e39ef96c6ca..68ac72a5c5fe 100644
@@ -2049,6 +2049,24 @@ static int lpuart_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	of_get_rs485_mode(np, &sport->port.rs485);
+
+	if (sport->port.rs485.flags & SER_RS485_RX_DURING_TX) {
+		dev_err(&pdev->dev, "driver doesn't support RX during TX\n");
+		return -ENOSYS;
+	}
+
+	if (sport->port.rs485.delay_rts_before_send ||
+	    sport->port.rs485.delay_rts_after_send) {
+		dev_err(&pdev->dev, "driver doesn't support RTS delays\n");
+		return -ENOSYS;
+	}
+
+	if (sport->port.rs485.flags & SER_RS485_ENABLED) {
+		sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND;
+		writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM);
+	}
+
 	sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx");
 	if (!sport->dma_tx_chan)
 		dev_info(sport->port.dev, "DMA tx channel request failed, "
@@ -2059,12 +2077,6 @@ static int lpuart_probe(struct platform_device *pdev)
 		dev_info(sport->port.dev, "DMA rx channel request failed, "
 				"operating without rx DMA\n");
 
-	if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) {
-		sport->port.rs485.flags |= SER_RS485_ENABLED;
-		sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND;
-		writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM);
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.11.0
#10 lore raw

PATCH v3 6/9 serial: omap-serial: Use common rs485 device tree parsing function

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.

---
 drivers/tty/serial/omap-serial.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/tty/serial/omap-serial.c +1 -12
index 1ea05ac57aa7..6d22097e6dd0 100644
@@ -1607,7 +1607,6 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up,
 				   struct device_node *np)
 {
 	struct serial_rs485 *rs485conf = &up->port.rs485;
-	u32 rs485_delay[2];
 	enum of_gpio_flags flags;
 	int ret;
 
@@ -1638,17 +1637,7 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up,
 		up->rts_gpio = -EINVAL;
 	}
 
-	if (of_property_read_u32_array(np, "rs485-rts-delay",
-				    rs485_delay, 2) == 0) {
-		rs485conf->delay_rts_before_send = rs485_delay[0];
-		rs485conf->delay_rts_after_send = rs485_delay[1];
-	}
-
-	if (of_property_read_bool(np, "rs485-rx-during-tx"))
-		rs485conf->flags |= SER_RS485_RX_DURING_TX;
-
-	if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time"))
-		rs485conf->flags |= SER_RS485_ENABLED;
+	of_get_rs485_mode(np, rs485conf);
 
 	return 0;
 }
Signature · 1 line
2.11.0
#11 lore raw

PATCH v3 7/9 serial: imx: default to half duplex rs485

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

The i.MX driver defaulted to full duplex rs485 which is rather unusual and doesn't match the default implemented in other drivers.

So change the default to half duplex.

---
 drivers/tty/serial/imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/imx.c +1 -2
index bbefddd92bfe..d5deeef0cd5b 100644
@@ -2137,8 +2137,7 @@ static int serial_imx_probe(struct platform_device *pdev)
 	sport->port.fifosize = 32;
 	sport->port.ops = &imx_pops;
 	sport->port.rs485_config = imx_rs485_config;
-	sport->port.rs485.flags =
-		SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX;
+	sport->port.rs485.flags = SER_RS485_RTS_ON_SEND;
 	sport->port.flags = UPF_BOOT_AUTOCONF;
 	init_timer(&sport->timer);
 	sport->timer.function = imx_timeout;
Signature · 1 line
2.11.0
#12 lore raw

PATCH v3 8/9 serial: imx: Use common rs485 device tree parsing function

In reply to Uwe Kleine-König

From: Sascha Hauer <[email protected]>

This adds support for the rs485 specific properties defined in Documentation/devicetree/bindings/serial/rs485.txt.

---
 drivers/tty/serial/imx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serial/imx.c +2 -0
index d5deeef0cd5b..951bb754ad9b 100644
@@ -2076,6 +2076,8 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 	if (of_get_property(np, "rts-gpios", NULL))
 		sport->have_rtsgpio = 1;
 
+	of_get_rs485_mode(np, &sport->port.rs485);
+
 	return 0;
 }
 #else
Signature · 1 line
2.11.0
#13 lore raw

PATCH v3 9/9 of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART

In reply to Uwe Kleine-König

The drivers support the rs485 binding described in rs485.txt, this commit just makes that explicit.

---
 Documentation/devicetree/bindings/serial/atmel-usart.txt  | 1 +
 Documentation/devicetree/bindings/serial/fsl-imx-uart.txt | 1 +
 Documentation/devicetree/bindings/serial/fsl-lpuart.txt   | 1 +
 Documentation/devicetree/bindings/serial/omap_serial.txt  | 1 +
 4 files changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/atmel-usart.txt +1 -0
index e6e6142e33ac..7c0d6b2f53e4 100644
@@ -24,6 +24,7 @@ Optional properties:
 	- dma-names: "rx" for RX channel, "tx" for TX channel.
 - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
   capable USARTs.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 <chip> compatible description:
 - at91rm9200:  legacy USART support
Documentation/devicetree/bindings/serial/fsl-imx-uart.txt +1 -0
index 574c3a2c77d5..860a9559839a 100644
@@ -9,6 +9,7 @@ Optional properties:
 - fsl,irda-mode : Indicate the uart supports irda mode
 - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works
                   in DCE mode by default.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Please check Documentation/devicetree/bindings/serial/serial.txt
 for the complete list of generic properties.
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +1 -0
index c95005efbcb8..4eca15378584 100644
@@ -14,6 +14,7 @@ Required properties:
 Optional properties:
 - dmas: A list of two dma specifiers, one for each entry in dma-names.
 - dma-names: should contain "tx" and "rx".
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Note: Optional properties for DMA support. Write them both or both not.
 
Documentation/devicetree/bindings/serial/omap_serial.txt +1 -0
index 7a71b5de77d6..43eac675f21f 100644
@@ -19,6 +19,7 @@ Optional properties:
 - dmas : DMA specifier, consisting of a phandle to the DMA controller
          node and a DMA channel number.
 - dma-names : "rx" for receive channel, "tx" for transmit channel.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Example:
 
Signature · 1 line
2.11.0
maintainer
#14 lore raw

PATCH v3 9/9 of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART

Quoted 4 lines · Uwe Kleine-K?nig

The drivers support the rs485 binding described in rs485.txt, this commit just makes that explicit.

Quoted 56 lines
---
 Documentation/devicetree/bindings/serial/atmel-usart.txt  | 1 +
 Documentation/devicetree/bindings/serial/fsl-imx-uart.txt | 1 +
 Documentation/devicetree/bindings/serial/fsl-lpuart.txt   | 1 +
 Documentation/devicetree/bindings/serial/omap_serial.txt  | 1 +
 4 files changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/atmel-usart.txt +1 -0
index e6e6142e33ac..7c0d6b2f53e4 100644
@@ -24,6 +24,7 @@ Optional properties:
 	- dma-names: "rx" for RX channel, "tx" for TX channel.
 - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
   capable USARTs.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 <chip> compatible description:
 - at91rm9200:  legacy USART support
Documentation/devicetree/bindings/serial/fsl-imx-uart.txt +1 -0
index 574c3a2c77d5..860a9559839a 100644
@@ -9,6 +9,7 @@ Optional properties:
 - fsl,irda-mode : Indicate the uart supports irda mode
 - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works
                   in DCE mode by default.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Please check Documentation/devicetree/bindings/serial/serial.txt
 for the complete list of generic properties.
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +1 -0
index c95005efbcb8..4eca15378584 100644
@@ -14,6 +14,7 @@ Required properties:
 Optional properties:
 - dmas: A list of two dma specifiers, one for each entry in dma-names.
 - dma-names: should contain "tx" and "rx".
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Note: Optional properties for DMA support. Write them both or both not.
 
Documentation/devicetree/bindings/serial/omap_serial.txt +1 -0
index 7a71b5de77d6..43eac675f21f 100644
@@ -19,6 +19,7 @@ Optional properties:
 - dmas : DMA specifier, consisting of a phandle to the DMA controller
          node and a DMA channel number.
 - dma-names : "rx" for receive channel, "tx" for transmit channel.
+- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
 
 Example:
 
Signature · 1 line
Nicolas Ferre
maintainer
#15 lore raw

PATCH v3 9/9 of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART

In reply to Uwe Kleine-König
Quoted 2 lines · Uwe Kleine-K?nig

The drivers support the rs485 binding described in rs485.txt, this commit just makes that explicit.

"dt-bindings: serial: ..." for the subject if you respin the series. Otherwise,

#16 lore raw

PATCH v3 9/9 of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART

Quoted 5 lines · Rob Herring
Quoted 2 lines · Uwe Kleine-K?nig

The drivers support the rs485 binding described in rs485.txt, this commit just makes that explicit.

"dt-bindings: serial: ..." for the subject if you respin the series.

Done, I shortend the first line a bit, it now looks as follows:

dt-bindings: serial: document rs485 bindings for various devices

Atmel USART, Freescale UARTs and OMAP UART all support the rs485 binding described in rs485.txt, this commit just makes that explicit.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#17 lore raw

v3 cover Add and make use of a common rs485 device tree parsing function

In reply to Uwe Kleine-König
Quoted 4 lines · Uwe Kleine-K?nig

Hello,

this is v3 of the series that targets to consolidate parsing the rs485 specific dt properties in a single place.

This patch breaks the build, and not all of them applied properly :(

Please be more careful when you fix this up and resend...

thanks,

greg k-h

#18 lore raw

v3 cover Add and make use of a common rs485 device tree parsing function

Hello Greg,

Quoted 5 lines · Greg KH
Quoted 2 lines · Uwe Kleine-K?nig

this is v3 of the series that targets to consolidate parsing the rs485 specific dt properties in a single place.

This patch breaks the build, and not all of them applied properly :(

sigh :( Sorry for the build breaker.

Regarding "doesn't apply": I tested to rebase on next/master (and so tty-next) and it applies there just fine. I considered that good enough. I guess you're talking about tty-testing?! I suggest to mention the branch name you want to apply patches on in such mails.

There is a patch you applied on tty-testing that is not ok I think ("serial: imx-serial - move DMA buffer configuration to DT"). I commented this one in the respective thread now.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |