All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
@ 2017-06-26  9:07 ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

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:
<20170623094945.31908-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>) 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

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
@ 2017-06-26  9:07 ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

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:
<20170623094945.31908-1-u.kleine-koenig@pengutronix.de>) 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

-- 
2.11.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 1/9] serial: fsl_lpuart: clear unsupported options in .rs485_config()
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:07     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA, Shawn Guo,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/fsl_lpuart.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 15df1ba78095..6e39ef96c6ca 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -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;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 1/9] serial: fsl_lpuart: clear unsupported options in .rs485_config()
@ 2017-06-26  9:07     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/fsl_lpuart.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 15df1ba78095..6e39ef96c6ca 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:07     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/rs485.txt b/Documentation/devicetree/bindings/serial/rs485.txt
index 32b1fa1f2a5b..b8415936dfdb 100644
--- a/Documentation/devicetree/bindings/serial/rs485.txt
+++ b/Documentation/devicetree/bindings/serial/rs485.txt
@@ -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
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional
@ 2017-06-26  9:07     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/rs485.txt b/Documentation/devicetree/bindings/serial/rs485.txt
index 32b1fa1f2a5b..b8415936dfdb 100644
--- a/Documentation/devicetree/bindings/serial/rs485.txt
+++ b/Documentation/devicetree/bindings/serial/rs485.txt
@@ -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
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 3/9] serial: Add common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:07     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA, Nicolas Ferre,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
[ukl: implement default <0 0> for rts-delay, unset unspecified flags]
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 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

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 5c8850f7a2a0..8baef5b95bed 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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"
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 53c03e005132..0fee8f4e36cb 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -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.
diff --git a/drivers/tty/serial/of.c b/drivers/tty/serial/of.c
new file mode 100644
index 000000000000..b24e4357661b
--- /dev/null
+++ b/drivers/tty/serial/of.c
@@ -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);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 64d892f1e5cd..5ba00b1be093 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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 */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 3/9] serial: Add common rs485 device tree parsing function
@ 2017-06-26  9:07     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[ukl: implement default <0 0> for rts-delay, unset unspecified flags]
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 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

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 5c8850f7a2a0..8baef5b95bed 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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"
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 53c03e005132..0fee8f4e36cb 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -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.
diff --git a/drivers/tty/serial/of.c b/drivers/tty/serial/of.c
new file mode 100644
index 000000000000..b24e4357661b
--- /dev/null
+++ b/drivers/tty/serial/of.c
@@ -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);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 64d892f1e5cd..5ba00b1be093 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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 */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:07     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, Richard Genoud, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Alexandre Belloni, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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.

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
[ukleinek: point out semantic change in commit log]
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/atmel_serial.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 937d67f22fba..245d9c227ad5 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -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;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
@ 2017-06-26  9:07     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[ukleinek: point out semantic change in commit log]
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/atmel_serial.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 937d67f22fba..245d9c227ad5 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 5/9] serial: fsl_lpuart: Use common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:07     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Shawn Guo, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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.

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 6e39ef96c6ca..68ac72a5c5fe 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -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;
 }
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 5/9] serial: fsl_lpuart: Use common rs485 device tree parsing function
@ 2017-06-26  9:07     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 6e39ef96c6ca..68ac72a5c5fe 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -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;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 6/9] serial: omap-serial: Use common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:08     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, Tony Lindgren, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/omap-serial.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1ea05ac57aa7..6d22097e6dd0 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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;
 }
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 6/9] serial: omap-serial: Use common rs485 device tree parsing function
@ 2017-06-26  9:08     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/omap-serial.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1ea05ac57aa7..6d22097e6dd0 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 7/9] serial: imx: default to half duplex rs485
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:08     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Shawn Guo, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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.

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index bbefddd92bfe..d5deeef0cd5b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 7/9] serial: imx: default to half duplex rs485
@ 2017-06-26  9:08     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index bbefddd92bfe..d5deeef0cd5b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 8/9] serial: imx: Use common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:08     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Shawn Guo, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/tty/serial/imx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index d5deeef0cd5b..951bb754ad9b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 8/9] serial: imx: Use common rs485 device tree parsing function
@ 2017-06-26  9:08     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sascha Hauer <s.hauer@pengutronix.de>

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

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/imx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index d5deeef0cd5b..951bb754ad9b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -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
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-26  9:08     ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 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(+)

diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
index e6e6142e33ac..7c0d6b2f53e4 100644
--- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
+++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
@@ -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
diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
index 574c3a2c77d5..860a9559839a 100644
--- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
@@ -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.
diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
index c95005efbcb8..4eca15378584 100644
--- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
@@ -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.
 
diff --git a/Documentation/devicetree/bindings/serial/omap_serial.txt b/Documentation/devicetree/bindings/serial/omap_serial.txt
index 7a71b5de77d6..43eac675f21f 100644
--- a/Documentation/devicetree/bindings/serial/omap_serial.txt
+++ b/Documentation/devicetree/bindings/serial/omap_serial.txt
@@ -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:
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
@ 2017-06-26  9:08     ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-26  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 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(+)

diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
index e6e6142e33ac..7c0d6b2f53e4 100644
--- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
+++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
@@ -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
diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
index 574c3a2c77d5..860a9559839a 100644
--- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
@@ -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.
diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
index c95005efbcb8..4eca15378584 100644
--- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
@@ -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.
 
diff --git a/Documentation/devicetree/bindings/serial/omap_serial.txt b/Documentation/devicetree/bindings/serial/omap_serial.txt
index 7a71b5de77d6..43eac675f21f 100644
--- a/Documentation/devicetree/bindings/serial/omap_serial.txt
+++ b/Documentation/devicetree/bindings/serial/omap_serial.txt
@@ -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:
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 3/9] serial: Add common rs485 device tree parsing function
  2017-06-26  9:07     ` Uwe Kleine-König
@ 2017-06-27  7:40         ` Nicolas Ferre
  -1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:40 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ

On 26/06/2017 at 11:07, Uwe Kleine-König wrote:
> From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 
> Several drivers have the same device tree parsing code. Create
> a common helper function for it.
> 
> Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> [ukl: implement default <0 0> for rts-delay, unset unspecified flags]
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Acked-by: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>

> ---
>  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
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 5c8850f7a2a0..8baef5b95bed 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -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"
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 53c03e005132..0fee8f4e36cb 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -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.
> diff --git a/drivers/tty/serial/of.c b/drivers/tty/serial/of.c
> new file mode 100644
> index 000000000000..b24e4357661b
> --- /dev/null
> +++ b/drivers/tty/serial/of.c
> @@ -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);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 64d892f1e5cd..5ba00b1be093 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -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 */
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 3/9] serial: Add common rs485 device tree parsing function
@ 2017-06-27  7:40         ` Nicolas Ferre
  0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/06/2017 at 11:07, Uwe Kleine-K?nig wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Several drivers have the same device tree parsing code. Create
> a common helper function for it.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> [ukl: implement default <0 0> for rts-delay, unset unspecified flags]
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>  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
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 5c8850f7a2a0..8baef5b95bed 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -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"
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 53c03e005132..0fee8f4e36cb 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -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.
> diff --git a/drivers/tty/serial/of.c b/drivers/tty/serial/of.c
> new file mode 100644
> index 000000000000..b24e4357661b
> --- /dev/null
> +++ b/drivers/tty/serial/of.c
> @@ -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);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 64d892f1e5cd..5ba00b1be093 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -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 */
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
  2017-06-26  9:07     ` Uwe Kleine-König
@ 2017-06-27  7:41         ` Nicolas Ferre
  -1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:41 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Richard Genoud, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer,
	Alexandre Belloni, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

On 26/06/2017 at 11:07, Uwe Kleine-König wrote:
> From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 
> 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:
Acked-by: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>

Thanks Sasha and Uwe!

> Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> [ukleinek: point out semantic change in commit log]
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  drivers/tty/serial/atmel_serial.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 937d67f22fba..245d9c227ad5 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -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;
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
@ 2017-06-27  7:41         ` Nicolas Ferre
  0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/06/2017 at 11:07, Uwe Kleine-K?nig wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> 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:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks Sasha and Uwe!

> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> [ukleinek: point out semantic change in commit log]
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/tty/serial/atmel_serial.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 937d67f22fba..245d9c227ad5 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -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;
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
  2017-06-26  9:08     ` Uwe Kleine-König
@ 2017-06-27  7:42         ` Nicolas Ferre
  -1 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:42 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

On 26/06/2017 at 11:08, Uwe Kleine-König wrote:
> The drivers support the rs485 binding described in rs485.txt, this commit
> just makes that explicit.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Acked-by: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>

> ---
>  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(+)
> 
> diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
> index e6e6142e33ac..7c0d6b2f53e4 100644
> --- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
> +++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
> @@ -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
> diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> index 574c3a2c77d5..860a9559839a 100644
> --- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> +++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> @@ -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.
> diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> index c95005efbcb8..4eca15378584 100644
> --- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> +++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> @@ -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.
>  
> diff --git a/Documentation/devicetree/bindings/serial/omap_serial.txt b/Documentation/devicetree/bindings/serial/omap_serial.txt
> index 7a71b5de77d6..43eac675f21f 100644
> --- a/Documentation/devicetree/bindings/serial/omap_serial.txt
> +++ b/Documentation/devicetree/bindings/serial/omap_serial.txt
> @@ -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:
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
@ 2017-06-27  7:42         ` Nicolas Ferre
  0 siblings, 0 replies; 38+ messages in thread
From: Nicolas Ferre @ 2017-06-27  7:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/06/2017 at 11:08, Uwe Kleine-K?nig wrote:
> The drivers support the rs485 binding described in rs485.txt, this commit
> just makes that explicit.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>  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(+)
> 
> diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
> index e6e6142e33ac..7c0d6b2f53e4 100644
> --- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
> +++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
> @@ -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
> diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> index 574c3a2c77d5..860a9559839a 100644
> --- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> +++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> @@ -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.
> diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> index c95005efbcb8..4eca15378584 100644
> --- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> +++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
> @@ -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.
>  
> diff --git a/Documentation/devicetree/bindings/serial/omap_serial.txt b/Documentation/devicetree/bindings/serial/omap_serial.txt
> index 7a71b5de77d6..43eac675f21f 100644
> --- a/Documentation/devicetree/bindings/serial/omap_serial.txt
> +++ b/Documentation/devicetree/bindings/serial/omap_serial.txt
> @@ -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:
>  
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
  2017-06-27  7:41         ` Nicolas Ferre
@ 2017-06-27  8:27           ` Richard Genoud
  -1 siblings, 0 replies; 38+ messages in thread
From: Richard Genoud @ 2017-06-27  8:27 UTC (permalink / raw)
  To: Nicolas Ferre, Uwe Kleine-König, linux-serial, linux-arm-kernel
  Cc: devicetree, Sascha Hauer, Alexandre Belloni, kernel

On 27/06/2017 09:41, Nicolas Ferre wrote:
> On 26/06/2017 at 11:07, Uwe Kleine-König wrote:
>> From: Sascha Hauer <s.hauer@pengutronix.de>
>>
>> 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:
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> 
> Thanks Sasha and Uwe!
> 
Acked-by: Richard Genoud <richard.genoud@gmail.com>

Thanks !
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> [ukleinek: point out semantic change in commit log]
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> ---
>>  drivers/tty/serial/atmel_serial.c | 25 +------------------------
>>  1 file changed, 1 insertion(+), 24 deletions(-)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index 937d67f22fba..245d9c227ad5 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -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;
>>
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
@ 2017-06-27  8:27           ` Richard Genoud
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Genoud @ 2017-06-27  8:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 27/06/2017 09:41, Nicolas Ferre wrote:
> On 26/06/2017 at 11:07, Uwe Kleine-K?nig wrote:
>> From: Sascha Hauer <s.hauer@pengutronix.de>
>>
>> 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:
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> 
> Thanks Sasha and Uwe!
> 
Acked-by: Richard Genoud <richard.genoud@gmail.com>

Thanks !
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> [ukleinek: point out semantic change in commit log]
>> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
>> ---
>>  drivers/tty/serial/atmel_serial.c | 25 +------------------------
>>  1 file changed, 1 insertion(+), 24 deletions(-)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index 937d67f22fba..245d9c227ad5 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -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;
>>
> 
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional
  2017-06-26  9:07     ` Uwe Kleine-König
@ 2017-06-28 16:48         ` Rob Herring
  -1 siblings, 0 replies; 38+ messages in thread
From: Rob Herring @ 2017-06-28 16:48 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

On Mon, Jun 26, 2017 at 11:07:56AM +0200, Uwe Kleine-König wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional
@ 2017-06-28 16:48         ` Rob Herring
  0 siblings, 0 replies; 38+ messages in thread
From: Rob Herring @ 2017-06-28 16:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 11:07:56AM +0200, Uwe Kleine-K?nig wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/serial/rs485.txt | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
  2017-06-26  9:08     ` Uwe Kleine-König
@ 2017-06-28 18:04       ` Rob Herring
  -1 siblings, 0 replies; 38+ messages in thread
From: Rob Herring @ 2017-06-28 18:04 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: kernel, devicetree, linux-arm-kernel, linux-serial

On Mon, Jun 26, 2017 at 11:08:03AM +0200, Uwe Kleine-König wrote:
> 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,

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
@ 2017-06-28 18:04       ` Rob Herring
  0 siblings, 0 replies; 38+ messages in thread
From: Rob Herring @ 2017-06-28 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 11:08:03AM +0200, Uwe Kleine-K?nig wrote:
> 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,

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
  2017-06-26  9:07 ` Uwe Kleine-König
@ 2017-06-29 15:12   ` Greg KH
  -1 siblings, 0 replies; 38+ messages in thread
From: Greg KH @ 2017-06-29 15:12 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: kernel, devicetree, linux-arm-kernel, linux-serial

On Mon, Jun 26, 2017 at 11:07:54AM +0200, Uwe Kleine-König wrote:
> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
@ 2017-06-29 15:12   ` Greg KH
  0 siblings, 0 replies; 38+ messages in thread
From: Greg KH @ 2017-06-29 15:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 11:07:54AM +0200, Uwe Kleine-K?nig wrote:
> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
  2017-06-29 15:12   ` Greg KH
@ 2017-06-29 18:47       ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-29 18:47 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

Hello Greg,

On Thu, Jun 29, 2017 at 05:12:00PM +0200, Greg KH wrote:
> On Mon, Jun 26, 2017 at 11:07:54AM +0200, Uwe Kleine-König wrote:
> > 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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
@ 2017-06-29 18:47       ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-29 18:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Greg,

On Thu, Jun 29, 2017 at 05:12:00PM +0200, Greg KH wrote:
> On Mon, Jun 26, 2017 at 11:07:54AM +0200, Uwe Kleine-K?nig wrote:
> > 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

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
  2017-06-28 18:04       ` Rob Herring
@ 2017-06-29 18:53         ` Uwe Kleine-König
  -1 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-29 18:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ

On Wed, Jun 28, 2017 at 01:04:00PM -0500, Rob Herring wrote:
> On Mon, Jun 26, 2017 at 11:08:03AM +0200, Uwe Kleine-König wrote:
> > 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.

	Acked-by: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
	Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
	Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
@ 2017-06-29 18:53         ` Uwe Kleine-König
  0 siblings, 0 replies; 38+ messages in thread
From: Uwe Kleine-König @ 2017-06-29 18:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 28, 2017 at 01:04:00PM -0500, Rob Herring wrote:
> On Mon, Jun 26, 2017 at 11:08:03AM +0200, Uwe Kleine-K?nig wrote:
> > 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.

	Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
	Acked-by: Rob Herring <robh@kernel.org>
	Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2017-06-29 18:53 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26  9:07 [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function Uwe Kleine-König
2017-06-26  9:07 ` Uwe Kleine-König
     [not found] ` <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-26  9:07   ` [PATCH v3 1/9] serial: fsl_lpuart: clear unsupported options in .rs485_config() Uwe Kleine-König
2017-06-26  9:07     ` Uwe Kleine-König
2017-06-26  9:07   ` [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional Uwe Kleine-König
2017-06-26  9:07     ` Uwe Kleine-König
     [not found]     ` <20170626090803.10981-3-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-28 16:48       ` Rob Herring
2017-06-28 16:48         ` Rob Herring
2017-06-26  9:07   ` [PATCH v3 3/9] serial: Add common rs485 device tree parsing function Uwe Kleine-König
2017-06-26  9:07     ` Uwe Kleine-König
     [not found]     ` <20170626090803.10981-4-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-27  7:40       ` Nicolas Ferre
2017-06-27  7:40         ` Nicolas Ferre
2017-06-26  9:07   ` [PATCH v3 4/9] serial: atmel: Use " Uwe Kleine-König
2017-06-26  9:07     ` Uwe Kleine-König
     [not found]     ` <20170626090803.10981-5-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-27  7:41       ` Nicolas Ferre
2017-06-27  7:41         ` Nicolas Ferre
2017-06-27  8:27         ` Richard Genoud
2017-06-27  8:27           ` Richard Genoud
2017-06-26  9:07   ` [PATCH v3 5/9] serial: fsl_lpuart: " Uwe Kleine-König
2017-06-26  9:07     ` Uwe Kleine-König
2017-06-26  9:08   ` [PATCH v3 6/9] serial: omap-serial: " Uwe Kleine-König
2017-06-26  9:08     ` Uwe Kleine-König
2017-06-26  9:08   ` [PATCH v3 7/9] serial: imx: default to half duplex rs485 Uwe Kleine-König
2017-06-26  9:08     ` Uwe Kleine-König
2017-06-26  9:08   ` [PATCH v3 8/9] serial: imx: Use common rs485 device tree parsing function Uwe Kleine-König
2017-06-26  9:08     ` Uwe Kleine-König
2017-06-26  9:08   ` [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART Uwe Kleine-König
2017-06-26  9:08     ` Uwe Kleine-König
     [not found]     ` <20170626090803.10981-10-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-27  7:42       ` Nicolas Ferre
2017-06-27  7:42         ` Nicolas Ferre
2017-06-28 18:04     ` Rob Herring
2017-06-28 18:04       ` Rob Herring
2017-06-29 18:53       ` Uwe Kleine-König
2017-06-29 18:53         ` Uwe Kleine-König
2017-06-29 15:12 ` [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function Greg KH
2017-06-29 15:12   ` Greg KH
     [not found]   ` <20170629151200.GA16362-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2017-06-29 18:47     ` Uwe Kleine-König
2017-06-29 18:47       ` Uwe Kleine-König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.