* [PATCH 0/9] Add and make use of a common rs485 device tree parsing function
@ 2017-06-21 10:21 Uwe Kleine-König
[not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 17+ messages in thread
From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-serial-u79uwXL29TY76Z2rM5mHXA
Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA
Hello,
this series unifies parsing of
rs485-rts-delay
linux,rs485-enabled-at-boot-time
rs485-rx-during-tx
in the drivers that already support some of these. As the function
implmented here is more strict that the open coded stuff already in the
drivers three device trees needed adaption to ensure the machines
continue to work as expected.
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):
ARM: dts/at91: ensure UARTs used for rs485 specify rs485-rts-delay
ARM: dts/imx: ensure UARTs used for rs485 specify rs485-rts-delay
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 +
arch/arm/boot/dts/animeo_ip.dts | 2 +
arch/arm/boot/dts/at91-vinco.dts | 1 +
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 1 +
drivers/tty/serial/Kconfig | 4 ++
drivers/tty/serial/Makefile | 2 +
drivers/tty/serial/atmel_serial.c | 17 +-------
drivers/tty/serial/fsl_lpuart.c | 5 ++-
drivers/tty/serial/imx.c | 5 ++-
drivers/tty/serial/of.c | 45 ++++++++++++++++++++++
drivers/tty/serial/omap-serial.c | 12 +-----
include/linux/serial_core.h | 12 ++++++
15 files changed, 79 insertions(+), 31 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] 17+ messages in thread[parent not found: <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-21 10:21 ` Uwe Kleine-König [not found] ` <20170621102130.21024-2-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-21 10:21 ` [PATCH 2/9] ARM: dts/at91: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König ` (7 subsequent siblings) 8 siblings, 1 reply; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer 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> 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 | 45 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 12 ++++++++++++ 4 files changed, 63 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..660a8cb09b44 --- /dev/null +++ b/drivers/tty/serial/of.c @@ -0,0 +1,45 @@ +#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, or a + * negative error code. + */ +int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) +{ + u32 rs485_delay[2]; + int ret; + + ret = of_property_read_u32_array(np, "rs485-rts-delay" rs485_delay, 2); + if (ret == -EINVAL) /* property does not exist */ + return 1; + if (ret) /* property does not have a value or is smaller than two u32 */ + return ret; + + rs485conf->delay_rts_before_send = rs485_delay[0]; + rs485conf->delay_rts_after_send = rs485_delay[1]; + + /* + * 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..9a6055191d22 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -500,4 +500,16 @@ static inline int uart_handle_break(struct uart_port *port) (cflag) & CRTSCTS || \ !((cflag) & CLOCAL)) +/* + * Common device tree parsing helpers + */ +#ifdef CONFIG_OF_SERIAL +void of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf); +#else +static inline void of_get_rs485_mode(struct device_node *np, + struct serial_rs485 *rs485conf) +{ +} +#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] 17+ messages in thread
[parent not found: <20170621102130.21024-2-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170621102130.21024-2-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-22 6:10 ` Sascha Hauer [not found] ` <20170622061007.h76gk3hixp4ipyvr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-22 6:31 ` Sascha Hauer 1 sibling, 1 reply; 17+ messages in thread From: Sascha Hauer @ 2017-06-22 6:10 UTC (permalink / raw) To: Uwe Kleine-König Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA On Wed, Jun 21, 2017 at 12:21:22PM +0200, 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> > 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 | 45 +++++++++++++++++++++++++++++++++++++++++++++ > include/linux/serial_core.h | 12 ++++++++++++ > 4 files changed, 63 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 This probably also needs a dependency on some device tree option, CONFIG_OF maybe? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- 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] 17+ messages in thread
[parent not found: <20170622061007.h76gk3hixp4ipyvr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170622061007.h76gk3hixp4ipyvr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-22 8:01 ` Uwe Kleine-König 0 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-22 8:01 UTC (permalink / raw) To: Sascha Hauer Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA On Thu, Jun 22, 2017 at 08:10:07AM +0200, Sascha Hauer wrote: > On Wed, Jun 21, 2017 at 12:21:22PM +0200, 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> > > 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 | 45 +++++++++++++++++++++++++++++++++++++++++++++ > > include/linux/serial_core.h | 12 ++++++++++++ > > 4 files changed, 63 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 > > This probably also needs a dependency on some device tree option, > CONFIG_OF maybe? Without CONFIG_OF of_property_read_u32_array returns -ENOSYS and of_property_read_bool returns false. So I think (but didn't test) there is no problem not depending on more stuff. But maybe do: if (!np) return 1; in of_get_rs485_mode? 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] 17+ messages in thread
* Re: [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170621102130.21024-2-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-22 6:10 ` Sascha Hauer @ 2017-06-22 6:31 ` Sascha Hauer [not found] ` <20170622063157.qih2mriprczpj7zn-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 1 sibling, 1 reply; 17+ messages in thread From: Sascha Hauer @ 2017-06-22 6:31 UTC (permalink / raw) To: Uwe Kleine-König Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA On Wed, Jun 21, 2017 at 12:21:22PM +0200, 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> > 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 | 45 +++++++++++++++++++++++++++++++++++++++++++++ > include/linux/serial_core.h | 12 ++++++++++++ > 4 files changed, 63 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..660a8cb09b44 > --- /dev/null > +++ b/drivers/tty/serial/of.c > @@ -0,0 +1,45 @@ > +#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, or a > + * negative error code. > + */ > +int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) > +{ > + u32 rs485_delay[2]; > + int ret; > + > + ret = of_property_read_u32_array(np, "rs485-rts-delay" rs485_delay, 2); > + if (ret == -EINVAL) /* property does not exist */ > + return 1; As the de-facto standard for the drivers implementing the rs485 bindings is to make the properties optional, despite the documentation. Wouldn't it be better to make this property optional in the binding instead? This wouldn't unnecessarily break old device trees and 0/0 seems a sane default we can use when the property doesn't exist. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- 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] 17+ messages in thread
[parent not found: <20170622063157.qih2mriprczpj7zn-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170622063157.qih2mriprczpj7zn-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-22 8:22 ` Uwe Kleine-König [not found] ` <20170622082221.v4jf2u5bdw6oyjxw-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-22 8:22 UTC (permalink / raw) To: Sascha Hauer Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Nicolas Ferre, Arnd Bergmann, Grant Likely Hello Sascha, On Thu, Jun 22, 2017 at 08:31:57AM +0200, Sascha Hauer wrote: > On Wed, Jun 21, 2017 at 12:21:22PM +0200, Uwe Kleine-König wrote: > > +/** > > + * 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, or a > > + * negative error code. > > + */ > > +int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) > > +{ > > + u32 rs485_delay[2]; > > + int ret; > > + > > + ret = of_property_read_u32_array(np, "rs485-rts-delay" rs485_delay, 2); > > + if (ret == -EINVAL) /* property does not exist */ > > + return 1; > > As the de-facto standard for the drivers implementing the rs485 bindings > is to make the properties optional, despite the documentation. Wouldn't I must admit that I failed to mention in the commit log that being strict here was added by me even though I'm not the author. > it be better to make this property optional in the binding instead? This > wouldn't unnecessarily break old device trees and 0/0 seems a sane > default we can use when the property doesn't exist. Would be fine for me, too. It was Nicolas Ferre who specified this as being required in 0331bbf3c6fd9. Added people who discussed the patch back then (but without questioning rs485-rts-delay being mandatory). 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] 17+ messages in thread
[parent not found: <20170622082221.v4jf2u5bdw6oyjxw-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH 1/9] serial: Add common rs485 device tree parsing function [not found] ` <20170622082221.v4jf2u5bdw6oyjxw-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-22 9:56 ` Nicolas Ferre 0 siblings, 0 replies; 17+ messages in thread From: Nicolas Ferre @ 2017-06-22 9:56 UTC (permalink / raw) To: Uwe Kleine-König, Sascha Hauer Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann, Grant Likely On 22/06/2017 at 10:22, Uwe Kleine-König wrote: > Hello Sascha, > > On Thu, Jun 22, 2017 at 08:31:57AM +0200, Sascha Hauer wrote: >> On Wed, Jun 21, 2017 at 12:21:22PM +0200, Uwe Kleine-König wrote: >>> +/** >>> + * 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, or a >>> + * negative error code. >>> + */ >>> +int of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) >>> +{ >>> + u32 rs485_delay[2]; >>> + int ret; >>> + >>> + ret = of_property_read_u32_array(np, "rs485-rts-delay" rs485_delay, 2); >>> + if (ret == -EINVAL) /* property does not exist */ >>> + return 1; >> >> As the de-facto standard for the drivers implementing the rs485 bindings >> is to make the properties optional, despite the documentation. Wouldn't > > I must admit that I failed to mention in the commit log that being > strict here was added by me even though I'm not the author. > >> it be better to make this property optional in the binding instead? This >> wouldn't unnecessarily break old device trees and 0/0 seems a sane >> default we can use when the property doesn't exist. > > Would be fine for me, too. It was Nicolas Ferre who specified this as > being required in 0331bbf3c6fd9. Added people who discussed the patch > back then (but without questioning rs485-rts-delay being mandatory). Uwe, This would be find with me too. Indeed, the conversion to an optional option won't break the atmel driver. Thanks for your work on this topic. Best regards, -- 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] 17+ messages in thread
* [PATCH 2/9] ARM: dts/at91: ensure UARTs used for rs485 specify rs485-rts-delay [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-21 10:21 ` [PATCH 1/9] serial: Add " Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function Uwe Kleine-König ` (6 subsequent siblings) 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Nicolas Ferre, Alexandre Belloni According to Documentation/devicetree/bindings/serial/rs485.txt the rs485-rts-delay parameter is required. To prepare making use of of_get_rs485_mode which is strict here, add this property to all at91 compatible devices that make use of one of the optional properties. Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> --- Cc: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org> Cc: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> arch/arm/boot/dts/animeo_ip.dts | 2 ++ arch/arm/boot/dts/at91-vinco.dts | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts index 9cc372b9fb9b..26fea9d79f27 100644 --- a/arch/arm/boot/dts/animeo_ip.dts +++ b/arch/arm/boot/dts/animeo_ip.dts @@ -45,12 +45,14 @@ apb { usart0: serial@fffb0000 { pinctrl-0 = <&pinctrl_usart0 &pinctrl_usart0_rts>; + rs485-rts-delay = <0 0>; linux,rs485-enabled-at-boot-time; status = "okay"; }; usart1: serial@fffb4000 { pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts>; + rs485-rts-delay = <0 0>; linux,rs485-enabled-at-boot-time; status = "okay"; }; diff --git a/arch/arm/boot/dts/at91-vinco.dts b/arch/arm/boot/dts/at91-vinco.dts index e0c0b2897a49..7bf8391bc7b3 100644 --- a/arch/arm/boot/dts/at91-vinco.dts +++ b/arch/arm/boot/dts/at91-vinco.dts @@ -147,6 +147,7 @@ usart4: serial@fc010000 { /* LMN */ pinctrl-0 = <&pinctrl_usart4 &pinctrl_usart4_rts>; + rs485-rts-delay = <0 0>; linux,rs485-enabled-at-boot-time; status = "okay"; }; -- 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] 17+ messages in thread
* [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-21 10:21 ` [PATCH 1/9] serial: Add " Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 2/9] ARM: dts/at91: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König [not found] ` <20170621102130.21024-4-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2017-06-21 10:21 ` [PATCH 4/9] serial: fsl_lpuart: " Uwe Kleine-König ` (5 subsequent siblings) 8 siblings, 1 reply; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer, Richard Genoud 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 the common function is more strict, so some device trees needed fixing in the previous commit. 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> --- Cc: Richard Genoud <richard.genoud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 { -- 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] 17+ messages in thread
[parent not found: <20170621102130.21024-4-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function [not found] ` <20170621102130.21024-4-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-06-23 9:49 ` Richard Genoud 2017-06-23 11:13 ` Uwe Kleine-König 0 siblings, 1 reply; 17+ messages in thread From: Richard Genoud @ 2017-06-23 9:49 UTC (permalink / raw) To: Uwe Kleine-König, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer On 21/06/2017 12:21, 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 the common function is more strict, so some device trees > needed fixing in the previous commit. > > 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> > --- > Cc: Richard Genoud <richard.genoud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > 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. In fact, you could get rid of atmel_init_rs485() and just replace it with of_get_rs485_mode() :) Thanks ! Richard -- 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] 17+ messages in thread
* Re: [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function 2017-06-23 9:49 ` Richard Genoud @ 2017-06-23 11:13 ` Uwe Kleine-König 0 siblings, 0 replies; 17+ messages in thread 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 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 [flat|nested] 17+ messages in thread
* [PATCH 4/9] serial: fsl_lpuart: Use common rs485 device tree parsing function [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (2 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 5/9] serial: omap-serial: " Uwe Kleine-König ` (4 subsequent siblings) 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer 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/fsl_lpuart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 15df1ba78095..7988a8a981d1 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2054,8 +2054,9 @@ 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; + of_get_rs485_mode(np, &sport->port.rs485); + + if (sport->port.rs485.flags & SER_RS485_ENABLED) { sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM); } -- 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] 17+ messages in thread
* [PATCH 5/9] serial: omap-serial: Use common rs485 device tree parsing function [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (3 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 4/9] serial: fsl_lpuart: " Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 6/9] serial: imx: default to half duplex rs485 Uwe Kleine-König ` (3 subsequent siblings) 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer, Tony Lindgren, linux-omap-u79uwXL29TY76Z2rM5mHXA 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 the common helper is more strict and only evaluates the optional properties if the required rs485-rts-delay is present. 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> --- Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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 [flat|nested] 17+ messages in thread
* [PATCH 6/9] serial: imx: default to half duplex rs485 [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (4 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 5/9] serial: omap-serial: " Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 7/9] ARM: dts/imx: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König ` (2 subsequent siblings) 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer, Shawn Guo, Fabio Estevam 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> --- Cc: Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@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] 17+ messages in thread
* [PATCH 7/9] ARM: dts/imx: ensure UARTs used for rs485 specify rs485-rts-delay [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (5 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 6/9] serial: imx: default to half duplex rs485 Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 8/9] serial: imx: Use common rs485 device tree parsing function Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART Uwe Kleine-König 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Shawn Guo, Fabio Estevam According to Documentation/devicetree/bindings/serial/rs485.txt the rs485-rts-delay parameter is required. To prepare making use of of_get_rs485_mode which is strict here, add this property to all imx compatible devices that make use of one of the optional properties. Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> --- Cc: Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org> arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi index 5d94b5ee6aa0..669bb8446574 100644 --- a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi +++ b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi @@ -288,6 +288,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart3>; uart-has-rtscts; + rs485-rts-delay = <0 0>; linux,rs485-enabled-at-boot-time; status = "okay"; }; -- 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] 17+ messages in thread
* [PATCH 8/9] serial: imx: Use common rs485 device tree parsing function [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (6 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 7/9] ARM: dts/imx: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 2017-06-21 10:21 ` [PATCH 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART Uwe Kleine-König 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer, Shawn Guo, Fabio Estevam From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Make use of the new of_get_rs485_mode function to initialize rs485 specific settings. 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> --- Cc: Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@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] 17+ messages in thread
* [PATCH 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART [not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> ` (7 preceding siblings ...) 2017-06-21 10:21 ` [PATCH 8/9] serial: imx: Use common rs485 device tree parsing function Uwe Kleine-König @ 2017-06-21 10:21 ` Uwe Kleine-König 8 siblings, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2017-06-21 10:21 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-serial-u79uwXL29TY76Z2rM5mHXA Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA 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] 17+ messages in thread
end of thread, other threads:[~2017-06-23 11:13 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-21 10:21 [PATCH 0/9] Add and make use of a common rs485 device tree parsing function Uwe Kleine-König
[not found] ` <20170621102130.21024-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-21 10:21 ` [PATCH 1/9] serial: Add " Uwe Kleine-König
[not found] ` <20170621102130.21024-2-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-22 6:10 ` Sascha Hauer
[not found] ` <20170622061007.h76gk3hixp4ipyvr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-22 8:01 ` Uwe Kleine-König
2017-06-22 6:31 ` Sascha Hauer
[not found] ` <20170622063157.qih2mriprczpj7zn-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-22 8:22 ` Uwe Kleine-König
[not found] ` <20170622082221.v4jf2u5bdw6oyjxw-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-22 9:56 ` Nicolas Ferre
2017-06-21 10:21 ` [PATCH 2/9] ARM: dts/at91: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 3/9] serial: atmel: Use common rs485 device tree parsing function Uwe Kleine-König
[not found] ` <20170621102130.21024-4-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-06-23 9:49 ` Richard Genoud
2017-06-23 11:13 ` Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 4/9] serial: fsl_lpuart: " Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 5/9] serial: omap-serial: " Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 6/9] serial: imx: default to half duplex rs485 Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 7/9] ARM: dts/imx: ensure UARTs used for rs485 specify rs485-rts-delay Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 8/9] serial: imx: Use common rs485 device tree parsing function Uwe Kleine-König
2017-06-21 10:21 ` [PATCH 9/9] of: document rs485 bindings for Atmel USART, Freescale UARTs and OMAP UART Uwe Kleine-König
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).