Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 6/9] serial: omap-serial: Use common rs485 device tree parsing function
From: Uwe Kleine-König @ 2017-06-23  9:49 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Sascha Hauer, Tony Lindgren, linux-omap-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170623094945.31908-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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>
---
Changes since v1:
 - drop paragraph in commit log that of_get_rs485_mode is more strict as this is wrong in v2.

 drivers/tty/serial/omap-serial.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1ea05ac57aa7..6e4728d3a24c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1638,17 +1638,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

* [PATCH v2 7/9] serial: imx: default to half duplex rs485
From: Uwe Kleine-König @ 2017-06-23  9:49 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Sascha Hauer, Fabio Estevam, Shawn Guo
In-Reply-To: <20170623094945.31908-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v2 8/9] serial: imx: Use common rs485 device tree parsing function
From: Uwe Kleine-König @ 2017-06-23  9:49 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Sascha Hauer, Fabio Estevam, Shawn Guo
In-Reply-To: <20170623094945.31908-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v2 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
From: Uwe Kleine-König @ 2017-06-23  9:49 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170623094945.31908-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v2.5 6/9] serial: omap-serial: Use common rs485 device tree parsing function
From: Uwe Kleine-König @ 2017-06-23  9:58 UTC (permalink / raw)
  To: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Tony Lindgren, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	Sascha Hauer
In-Reply-To: <20170623094945.31908-7-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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>
---
Changes since v2:
 - remove now unused variable

Changes since v1:
 - drop paragraph in commit log that of_get_rs485_mode is more strict as this is wrong in v2.

 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

* Re: [PATCH v2 4/9] serial: atmel: Use common rs485 device tree parsing function
From: Richard Genoud @ 2017-06-23  9:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sascha Hauer,
	Alexandre Belloni
In-Reply-To: <20170623094945.31908-5-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

2017-06-23 11:49 GMT+02:00 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> 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>
> ---
> Changes since v1:
>  - as I dropped my two atmel patches and used Alexandre Belloni's (that are
>    already in next) instead, there are a few changes that are necessary to
>    adapt to the new base.
>
>  drivers/tty/serial/atmel_serial.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 937d67f22fba..357570a216ad 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1689,22 +1689,7 @@ static void atmel_init_rs485(struct uart_port *port,
>  {
>         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;
> +       of_get_rs485_mode(np, &port->rs485);
>  }

as atmel_init_rs485() is only used once in the code, what do you think of
getting rid of it and just have something like:
of_get_rs485_mode(pdev->dev.of_node, &port->rs485);
in atmel_init_port() ?
(possibly with a little comment)

regards,
Richard.
>
>  static void atmel_set_ops(struct uart_port *port)
> --
> 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

* Re: [PATCH v2 4/9] serial: atmel: Use common rs485 device tree parsing function
From: Uwe Kleine-König @ 2017-06-23 10:01 UTC (permalink / raw)
  To: Richard Genoud
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sascha Hauer, Alexandre Belloni, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <CACQ1gAh3jpcyPLexNgEU7KV0qX1Wor2dsLRV8LJYpA-1Wmp9SA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Jun 23, 2017 at 11:58:37AM +0200, Richard Genoud wrote:
> 2017-06-23 11:49 GMT+02:00 Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>:
> > 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>
> > ---
> > Changes since v1:
> >  - as I dropped my two atmel patches and used Alexandre Belloni's (that are
> >    already in next) instead, there are a few changes that are necessary to
> >    adapt to the new base.
> >
> >  drivers/tty/serial/atmel_serial.c | 17 +----------------
> >  1 file changed, 1 insertion(+), 16 deletions(-)
> >
> > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> > index 937d67f22fba..357570a216ad 100644
> > --- a/drivers/tty/serial/atmel_serial.c
> > +++ b/drivers/tty/serial/atmel_serial.c
> > @@ -1689,22 +1689,7 @@ static void atmel_init_rs485(struct uart_port *port,
> >  {
> >         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;
> > +       of_get_rs485_mode(np, &port->rs485);
> >  }
> 
> as atmel_init_rs485() is only used once in the code, what do you think of
> getting rid of it and just have something like:
> of_get_rs485_mode(pdev->dev.of_node, &port->rs485);
> in atmel_init_port() ?
> (possibly with a little comment)

Right, that is something that I thought once, too, but then forgot on
the other changes I still had to do. Noted for v3.

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

* Re: [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function
From: Uwe Kleine-König @ 2017-06-23 11:13 UTC (permalink / raw)
  To: Richard Genoud
  Cc: kernel, devicetree, Sascha Hauer, linux-serial, linux-arm-kernel
In-Reply-To: <8ab92dee-d9ba-0f7d-389c-e35a0f7f304c@gmail.com>

On Fri, Jun 23, 2017 at 11:49:38AM +0200, Richard Genoud wrote:
> On 21/06/2017 12:21, 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 the common function is more strict, so some device trees
> > needed fixing in the previous commit.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> > Cc: Richard Genoud <richard.genoud@gmail.com>
> > 
> >  drivers/tty/serial/atmel_serial.c | 17 +----------------
> >  1 file changed, 1 insertion(+), 16 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> > index b753d2020068..a6b0c0087e2d 100644
> > --- a/drivers/tty/serial/atmel_serial.c
> > +++ b/drivers/tty/serial/atmel_serial.c
> > @@ -1706,22 +1706,7 @@ static void atmel_init_rs485(struct uart_port *port,
> >  	struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev);
> >  
> >  	if (np) {
> > -		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;
> > +		of_get_rs485_mode(np, &port->rs485);
> >  	} else if (pdata) {
> >  		port->rs485 = pdata->rs485;
> >  	} else {
> > 
> I don't kown if the serie will make it to 4.12, but as you may have
> noticed, this patch will break with tty-next.

I'm pretty sure it won't make it into 4.12 given we're already at -rc6.
And there is a v2 that should apply on top of tty-next. (I have it on
4.12-rc6 + the two patches by Alexandre Belloni.)

> In fact, you could get rid of atmel_init_rs485() and just replace it
> with of_get_rs485_mode() :)

As mentioned in the v2 thread I plan to do this for v3.

Best regards
Uwe

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

^ permalink raw reply

* Re: 4.3 serial driver crashes with console shortly after boot
From: Jiri Slaby @ 2017-06-23 11:23 UTC (permalink / raw)
  To: Andi Kleen, Peter Hurley; +Cc: gregkh, linux-serial, linux-kernel
In-Reply-To: <20151111165035.GL3533@two.firstfloor.org>

On 11/11/2015, 05:50 PM, Andi Kleen wrote:
> On Wed, Nov 11, 2015 at 06:14:30AM -0500, Peter Hurley wrote:
>> On 11/10/2015 06:15 PM, Peter Hurley wrote:
>>> On 11/10/2015 05:43 PM, Andi Kleen wrote:
>>>> On Tue, Nov 10, 2015 at 11:39:57PM +0100, Andi Kleen wrote:
>>>>>> I've just tried to reproduce this without success on my current
>>>>>> tree which has some additional patches I just posted this am. They weren't
>>>>>> intended to fix crashes but they directly impact the area of concern. Could
>>>>>> you try these three?
>>>>>>
>>>>>> [PATCH v2 2/4] n_tty: Ignore all read data when closing
>>>>>> [PATCH v2 3/4] tty: Abstract and encapsulate tty->closing behavior
>>>>>> [PATCH v2 4/4] tty: Remove drivers' extra tty_ldisc_flush()
>>>>>>
>>>>> Applying the three patches fixes the crash. 
>>>>> I haven't tried to figure out which one did the trick.
>>>>
>>>> Actually I was wrong sorry. It still crashes, but now it doesn't
>>>> hang the system anymore.
>>>
>>> Argghh.
>>> Can you run the patch below and send me full dmesg (privately if you prefer)?
>>
>> Nevermind. I see how it's happening now; it's being initiated by hangup,
>> not close. FWIW, it's been like that nearly forever; your user-space/tool is
>> triggering this because ECHO is on.
> 
> It's just agetty i believe, but there may be some funkiness going on
> with the terminal server or the cable.
> 
> Thanks. I'll just add a NULL pointer check for now, until you have
> a real patch.

It looks like 4.4 (-stable) still suffers from this. Has this ever been
fixed somehow?

thanks,
-- 
js
suse labs

^ permalink raw reply

* Re: [PATCH v6 00/10] serial/gpio: exar: Fixes and support for IOT2000
From: Jan Kiszka @ 2017-06-23 20:09 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, Greg Kroah-Hartman, Linux Kernel Mailing List,
	linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org,
	Sudip Mukherjee, Andy Shevchenko, Sascha Weisenberger
In-Reply-To: <c0a29540-7946-4e95-1b59-3a2f478757da@siemens.com>

On 2017-06-21 08:29, Jan Kiszka wrote:
> On 2017-06-20 13:38, Linus Walleij wrote:
>> On Tue, Jun 20, 2017 at 10:54 AM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>> On 2017-06-20 10:19, Linus Walleij wrote:
>>>> On Fri, Jun 9, 2017 at 8:33 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>>
>>>>> This makes the gpio-exar driver usable, which was prevented by a number
>>>>> of fatal bugs, and adds support for the SIMATIC IOT2040 to the 8250-exar
>>>>> driver and, indirectly, to gpio-exar as well. It's a cross-subsystem
>>>>> series, so I'm also cross-posting to the serial and gpio lists.
>>>>>
>>>>> Changes in v6:
>>>>
>>>> I merged some of the patches, that applied. Let's see if they survive
>>>> in linux-next, else I guess we need to fix this in the -rcs or for the next
>>>> kernel cycle.
>>>
>>> Weird that things did not apply. I just did a cherry-pick for all those
>>> 10 patches on top of 5c996b7eb52c, and that went smoothly. Please let me
>>> know which baseline is needed, and I will rebase.
>>
>> This was on the "devel" branch of my GPIO tree:
>> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=devel
> 
> Again, all (missing) patches applied absolutely cleanly for me, see
> 
> http://git.kiszka.org/?p=linux.git;a=shortlog;h=refs/heads/queues/gpio-iot2000

I've rebased over devel and noticed along this that you will have to
include "serial: uapi: Add support for bus termination" from Greg's
tty-next for the last patch to avoid breaking the build. Result pushed to

http://git.kiszka.org/?p=linux.git;a=shortlog;h=refs/heads/queues/gpio-iot2000

If you want me to resend anything, just let me know. Would be great to
have the remaining pieces lined up in time for the next merge window.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply

* Re: [PATCH 01/11] dma-mapping: remove dmam_free_noncoherent
From: Christoph Hellwig @ 2017-06-26  7:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, linux-serial, netdev, linux-metag, nios2-dev,
	linux-fbdev, alsa-devel, linux-kernel, Tejun Heo
In-Reply-To: <20170616071716.17321-2-hch@lst.de>

Tejun, does this look ok to you?

On Fri, Jun 16, 2017 at 09:17:06AM +0200, Christoph Hellwig wrote:
> This function was never used since it was added.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  Documentation/driver-model/devres.txt |  1 -
>  drivers/base/dma-mapping.c            | 20 --------------------
>  include/linux/dma-mapping.h           |  2 --
>  3 files changed, 23 deletions(-)
> 
> diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
> index e72587fe477d..9070ff06b558 100644
> --- a/Documentation/driver-model/devres.txt
> +++ b/Documentation/driver-model/devres.txt
> @@ -243,7 +243,6 @@ DMA
>    dmam_alloc_noncoherent()
>    dmam_declare_coherent_memory()
>    dmam_free_coherent()
> -  dmam_free_noncoherent()
>    dmam_pool_create()
>    dmam_pool_destroy()
>  
> diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
> index f3deb6af42ad..5940c9dace36 100644
> --- a/drivers/base/dma-mapping.c
> +++ b/drivers/base/dma-mapping.c
> @@ -148,26 +148,6 @@ void *dmam_alloc_noncoherent(struct device *dev, size_t size,
>  }
>  EXPORT_SYMBOL(dmam_alloc_noncoherent);
>  
> -/**
> - * dmam_free_coherent - Managed dma_free_noncoherent()
> - * @dev: Device to free noncoherent memory for
> - * @size: Size of allocation
> - * @vaddr: Virtual address of the memory to free
> - * @dma_handle: DMA handle of the memory to free
> - *
> - * Managed dma_free_noncoherent().
> - */
> -void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
> -			   dma_addr_t dma_handle)
> -{
> -	struct dma_devres match_data = { size, vaddr, dma_handle };
> -
> -	dma_free_noncoherent(dev, size, vaddr, dma_handle);
> -	WARN_ON(!devres_destroy(dev, dmam_noncoherent_release, dmam_match,
> -				&match_data));
> -}
> -EXPORT_SYMBOL(dmam_free_noncoherent);
> -
>  #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
>  
>  static void dmam_coherent_decl_release(struct device *dev, void *res)
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 4f3eecedca2d..830ec5f06a4f 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -749,8 +749,6 @@ extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
>  			       dma_addr_t dma_handle);
>  extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
>  				    dma_addr_t *dma_handle, gfp_t gfp);
> -extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
> -				  dma_addr_t dma_handle);
>  #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
>  extern int dmam_declare_coherent_memory(struct device *dev,
>  					phys_addr_t phys_addr,
> -- 
> 2.11.0
> 
---end quoted text---

^ permalink raw reply

* Re: [PATCH 02/11] dma-mapping: replace dmam_alloc_noncoherent with dmam_alloc_attrs
From: Christoph Hellwig @ 2017-06-26  7:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-fbdev, linux-scsi, netdev, alsa-devel, linux-kernel,
	linux-serial, Tejun Heo, nios2-dev, linux-metag
In-Reply-To: <20170616071716.17321-3-hch@lst.de>

Tejun, does this look ok to you?

On Fri, Jun 16, 2017 at 09:17:07AM +0200, Christoph Hellwig wrote:
> dmam_alloc_noncoherent is a trivial wrapper around dmam_alloc_attrs,
> that hardcodes one particular flag.  Make the devres code more
> flexible by allowing the callers to pass arbitrary flags.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  Documentation/driver-model/devres.txt |  2 +-
>  drivers/base/dma-mapping.c            | 36 ++++++++++++++++-------------------
>  drivers/video/fbdev/au1200fb.c        |  5 +++--
>  include/linux/dma-mapping.h           |  5 +++--
>  4 files changed, 23 insertions(+), 25 deletions(-)
> 
> diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
> index 9070ff06b558..7e08c02b5393 100644
> --- a/Documentation/driver-model/devres.txt
> +++ b/Documentation/driver-model/devres.txt
> @@ -240,7 +240,7 @@ CLOCK
>  
>  DMA
>    dmam_alloc_coherent()
> -  dmam_alloc_noncoherent()
> +  dmam_alloc_attrs()
>    dmam_declare_coherent_memory()
>    dmam_free_coherent()
>    dmam_pool_create()
> diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
> index 5940c9dace36..10e7c022e8cf 100644
> --- a/drivers/base/dma-mapping.c
> +++ b/drivers/base/dma-mapping.c
> @@ -22,20 +22,15 @@ struct dma_devres {
>  	size_t		size;
>  	void		*vaddr;
>  	dma_addr_t	dma_handle;
> +	unsigned long	attrs;
>  };
>  
> -static void dmam_coherent_release(struct device *dev, void *res)
> +static void dmam_release(struct device *dev, void *res)
>  {
>  	struct dma_devres *this = res;
>  
> -	dma_free_coherent(dev, this->size, this->vaddr, this->dma_handle);
> -}
> -
> -static void dmam_noncoherent_release(struct device *dev, void *res)
> -{
> -	struct dma_devres *this = res;
> -
> -	dma_free_noncoherent(dev, this->size, this->vaddr, this->dma_handle);
> +	dma_free_attrs(dev, this->size, this->vaddr, this->dma_handle,
> +			this->attrs);
>  }
>  
>  static int dmam_match(struct device *dev, void *res, void *match_data)
> @@ -69,7 +64,7 @@ void *dmam_alloc_coherent(struct device *dev, size_t size,
>  	struct dma_devres *dr;
>  	void *vaddr;
>  
> -	dr = devres_alloc(dmam_coherent_release, sizeof(*dr), gfp);
> +	dr = devres_alloc(dmam_release, sizeof(*dr), gfp);
>  	if (!dr)
>  		return NULL;
>  
> @@ -104,35 +99,35 @@ void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
>  	struct dma_devres match_data = { size, vaddr, dma_handle };
>  
>  	dma_free_coherent(dev, size, vaddr, dma_handle);
> -	WARN_ON(devres_destroy(dev, dmam_coherent_release, dmam_match,
> -			       &match_data));
> +	WARN_ON(devres_destroy(dev, dmam_release, dmam_match, &match_data));
>  }
>  EXPORT_SYMBOL(dmam_free_coherent);
>  
>  /**
> - * dmam_alloc_non_coherent - Managed dma_alloc_noncoherent()
> + * dmam_alloc_attrs - Managed dma_alloc_attrs()
>   * @dev: Device to allocate non_coherent memory for
>   * @size: Size of allocation
>   * @dma_handle: Out argument for allocated DMA handle
>   * @gfp: Allocation flags
> + * @attrs: Flags in the DMA_ATTR_* namespace.
>   *
> - * Managed dma_alloc_noncoherent().  Memory allocated using this
> - * function will be automatically released on driver detach.
> + * Managed dma_alloc_attrs().  Memory allocated using this function will be
> + * automatically released on driver detach.
>   *
>   * RETURNS:
>   * Pointer to allocated memory on success, NULL on failure.
>   */
> -void *dmam_alloc_noncoherent(struct device *dev, size_t size,
> -			     dma_addr_t *dma_handle, gfp_t gfp)
> +void *dmam_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
>  	struct dma_devres *dr;
>  	void *vaddr;
>  
> -	dr = devres_alloc(dmam_noncoherent_release, sizeof(*dr), gfp);
> +	dr = devres_alloc(dmam_release, sizeof(*dr), gfp);
>  	if (!dr)
>  		return NULL;
>  
> -	vaddr = dma_alloc_noncoherent(dev, size, dma_handle, gfp);
> +	vaddr = dma_alloc_attrs(dev, size, dma_handle, gfp, attrs);
>  	if (!vaddr) {
>  		devres_free(dr);
>  		return NULL;
> @@ -141,12 +136,13 @@ void *dmam_alloc_noncoherent(struct device *dev, size_t size,
>  	dr->vaddr = vaddr;
>  	dr->dma_handle = *dma_handle;
>  	dr->size = size;
> +	dr->attrs = attrs;
>  
>  	devres_add(dev, dr);
>  
>  	return vaddr;
>  }
> -EXPORT_SYMBOL(dmam_alloc_noncoherent);
> +EXPORT_SYMBOL(dmam_alloc_attrs);
>  
>  #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
>  
> diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c
> index 6c2b2ca4a909..5f04b4096c42 100644
> --- a/drivers/video/fbdev/au1200fb.c
> +++ b/drivers/video/fbdev/au1200fb.c
> @@ -1694,9 +1694,10 @@ static int au1200fb_drv_probe(struct platform_device *dev)
>  		/* Allocate the framebuffer to the maximum screen size */
>  		fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;
>  
> -		fbdev->fb_mem = dmam_alloc_noncoherent(&dev->dev,
> +		fbdev->fb_mem = dmam_alloc_attrs(&dev->dev,
>  				PAGE_ALIGN(fbdev->fb_len),
> -				&fbdev->fb_phys, GFP_KERNEL);
> +				&fbdev->fb_phys, GFP_KERNEL,
> +				DMA_ATTR_NON_CONSISTENT);
>  		if (!fbdev->fb_mem) {
>  			print_err("fail to allocate frambuffer (size: %dK))",
>  				  fbdev->fb_len / 1024);
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 830ec5f06a4f..6cdf5634906d 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -747,8 +747,9 @@ extern void *dmam_alloc_coherent(struct device *dev, size_t size,
>  				 dma_addr_t *dma_handle, gfp_t gfp);
>  extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
>  			       dma_addr_t dma_handle);
> -extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
> -				    dma_addr_t *dma_handle, gfp_t gfp);
> +extern void *dmam_alloc_attrs(struct device *dev, size_t size,
> +			      dma_addr_t *dma_handle, gfp_t gfp,
> +			      unsigned long attrs);
>  #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
>  extern int dmam_declare_coherent_memory(struct device *dev,
>  					phys_addr_t phys_addr,
> -- 
> 2.11.0
> 
---end quoted text---

^ permalink raw reply

* [PATCH v3 0/9] Add and make use of a common rs485 device tree parsing function
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

* [PATCH v3 1/9] serial: fsl_lpuart: clear unsupported options in .rs485_config()
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 2/9] dt-bindings: serial/rs485: make rs485-rts-delay optional
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 3/9] serial: Add common rs485 device tree parsing function
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 4/9] serial: atmel: Use common rs485 device tree parsing function
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 5/9] serial: fsl_lpuart: Use common rs485 device tree parsing function
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 6/9] serial: omap-serial: Use common rs485 device tree parsing function
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 7/9] serial: imx: default to half duplex rs485
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 8/9] serial: imx: Use common rs485 device tree parsing function
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH v3 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART
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
In-Reply-To: <20170626090803.10981-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

* [PATCH 00/20] Update STM32 usart driver
From: Bich HEMON @ 2017-06-26 12:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre TORGUE, Jiri Slaby, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
  Cc: Bich HEMON

From: Bich Hemon <bich.hemon@st.com>

This patchset updates the stm32 usart driver. It mainly adds
support for fifo, dma, debugfs anf fixes various bugs.

Bich Hemon (20):
  serial: stm32: adding fifo support
  dt-bindings: serial: each stm32 usart needs an alias
  serial: stm32: fix multi ports management
  serial: stm32: make fifoen as property for each port
  serial: stm32: add debugfs
  serial: stm32: fix pio transmit timeout
  serial: stm32: less messages on dma alloc error
  serial: stm32: timeout interrupt using with dma
  serial: stm32: fix end of transfer
  serial: stm32: fix dma receive
  serial: stm32: add RTS support
  serial: stm32: fix last_res value
  serial: stm32: fix error handling in probe
  dt-bindings: serial: document option wake-up interrupt for STM32 USART
  serial: stm32: Add wakeup mechanism
  serial: stm32: fix fifo usage
  dt-bindings: serial: stm32: add dma using note
  serial: stm32: update dma buffers length
  serial: stm32: add dma rx callback
  serial: stm32: fix rx interrupt handling in startup

 .../devicetree/bindings/serial/st,stm32-usart.txt  |  55 +++-
 drivers/tty/serial/stm32-usart.c                   | 310 ++++++++++++++++++---
 drivers/tty/serial/stm32-usart.h                   |  51 +++-
 3 files changed, 375 insertions(+), 41 deletions(-)

-- 
1.9.1

^ permalink raw reply

* [PATCH 02/20] dt-bindings: serial: each stm32 usart needs an alias
From: Bich HEMON @ 2017-06-26 12:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre TORGUE, Jiri Slaby, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
  Cc: Bich HEMON
In-Reply-To: <1498481318-1894-1-git-send-email-bich.hemon@st.com>

From: Bich Hemon <bich.hemon@st.com>

Each usart controller should have an alias correctly
numbered in "aliases" node.

Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
---
 Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
index 85ec5f2..a229b14 100644
--- a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
+++ b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
@@ -15,14 +15,23 @@ Optional properties:
 - dmas: phandle(s) to DMA controller node(s). Refer to stm32-dma.txt
 - dma-names: "rx" and/or "tx"
 
+Note: Each usart controller should have an alias correctly numbered
+in "aliases" node.
+
 Examples:
-usart4: serial@40004c00 {
+aliases {
+	serial0 = &usart1;
+	serial1 = &usart2;
+	serial3 = &uart4;
+};
+
+uart4: serial@40004c00 {
 	compatible = "st,stm32-uart";
 	reg = <0x40004c00 0x400>;
 	interrupts = <52>;
 	clocks = <&clk_pclk1>;
 	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_usart4>;
+	pinctrl-0 = <&pinctrl_uart4>;
 };
 
 usart2: serial@40004400 {
-- 
1.9.1

^ permalink raw reply related

* [PATCH 01/20] serial: stm32: adding fifo support
From: Bich HEMON @ 2017-06-26 12:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Maxime Coquelin,
	Alexandre TORGUE, Jiri Slaby, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
  Cc: Bich HEMON
In-Reply-To: <1498481318-1894-1-git-send-email-bich.hemon@st.com>

From: Bich Hemon <bich.hemon@st.com>

This patch adds fifo mode support for rx and tx.

Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
---
 drivers/tty/serial/stm32-usart.c | 3 +++
 drivers/tty/serial/stm32-usart.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 0338562..50948f6 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -453,6 +453,7 @@ static int stm32_startup(struct uart_port *port)
 		return ret;
 
 	val = USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE;
+	val |= USART_CR1_FIFOEN;
 	stm32_set_bits(port, ofs->cr1, val);
 
 	return 0;
@@ -467,6 +468,7 @@ static void stm32_shutdown(struct uart_port *port)
 
 	val = USART_CR1_TXEIE | USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE;
 	val |= BIT(cfg->uart_enable_bit);
+	val |= USART_CR1_FIFOEN;
 	stm32_clr_bits(port, ofs->cr1, val);
 
 	free_irq(port->irq, port);
@@ -496,6 +498,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	cr1 = USART_CR1_TE | USART_CR1_RE | USART_CR1_RXNEIE;
 	cr1 |= BIT(cfg->uart_enable_bit);
+	cr1 |= USART_CR1_FIFOEN;
 	cr2 = 0;
 	cr3 = 0;
 
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index cd97ceb..9f0d0e8 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -134,6 +134,7 @@ struct stm32_usart_info stm32f7_info = {
 #define USART_CR1_EOBIE		BIT(27)		/* F7 */
 #define USART_CR1_M1		BIT(28)		/* F7 */
 #define USART_CR1_IE_MASK	(GENMASK(8, 4) | BIT(14) | BIT(26) | BIT(27))
+#define USART_CR1_FIFOEN	BIT(29)		/* H7 */
 
 /* USART_CR2 */
 #define USART_CR2_ADD_MASK	GENMASK(3, 0)	/* F4 */
-- 
1.9.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox