Add and make use of a common rs485 device tree parsing function
Subsystems (5)
v4 cover Add and make use of a common rs485 device tree parsing function
Hello,
this is v4 of the series. Compared to v3 It fixes a compile error and is rebased to a newer kernel to apply fine on Greg's tree.
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
dt-bindings: serial: document rs485 bindings for various devices
.../devicetree/bindings/serial/atmel-usart.txt | 1 + .../devicetree/bindings/serial/fsl-imx-uart.txt | 1 + .../devicetree/bindings/serial/fsl-lpuart.txt | 1 + .../devicetree/bindings/serial/omap_serial.txt | 1 + Documentation/devicetree/bindings/serial/rs485.txt | 5 +-- drivers/tty/serial/Kconfig | 4 ++ drivers/tty/serial/Makefile | 2 + drivers/tty/serial/atmel_serial.c | 25 +----------- drivers/tty/serial/fsl_lpuart.c | 29 ++++++++++--- drivers/tty/serial/imx.c | 5 ++- drivers/tty/serial/of.c | 47 ++++++++++++++++++++++ drivers/tty/serial/omap-serial.c | 13 +----- include/linux/serial_core.h | 13 ++++++ 13 files changed, 100 insertions(+), 47 deletions(-) create mode 100644 drivers/tty/serial/of.c
Signature · 1 line
2.11.0
PATCH v4 1/9 serial: fsl_lpuart: clear unsupported options in .rs485_config()
The struct serial_rs485 parameter is both input and output and is supposed to hold the actually used configuration on return. So clear unsupported settings.
--- drivers/tty/serial/fsl_lpuart.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/fsl_lpuart.c +5 -0
@@ -1019,6 +1019,11 @@ static int lpuart_config_rs485(struct uart_port *port, ~(UARTMODEM_TXRTSPOL |UARTMODEM_TXRTSE );writeb (modem, sport->port.membase +UARTMODEM ); +/* clear unsupported configurations */ + rs485->delay_rts_before_send =0 ; + rs485->delay_rts_after_send =0 ; + rs485->flags &= ~SER_RS485_RX_DURING_TX ; +if (rs485->flags &SER_RS485_ENABLED ) {/* Enable auto RS-485 RTS mode */ modem |=UARTMODEM_TXRTSE ;
Signature · 1 line
2.11.0
PATCH v4 2/9 dt-bindings: serial/rs485: make rs485-rts-delay optional
In reply to Uwe Kleine-KönigThere are a few device trees that specify one of the already optional properties without also having the up to now required property rs485-rts-delay. Additionally there is no technical reason to require rs485-rts-delay and that's also what most drivers implement.
So give existing users and implementers a blessing and document rs485-rts-delay as optional.
--- Documentation/devicetree/bindings/serial/rs485.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/rs485.txt +2 -3
@@ -5,14 +5,13 @@ the built-in half-duplex mode. The properties described hereafter shall be given to a half-duplex capable UART node. -Required properties: +Optional properties: - rs485-rts-delay: prop-encoded-array <a b> where: * a is the delay between rts signal and beginning of data sent in milliseconds. it corresponds to the delay before sending data. * b is the delay between end of data sent and rts signal in milliseconds it corresponds to the delay after sending data and actual release of the line. - -Optional properties: + If this property is not specified, <0 0> is assumed. - linux,rs485-enabled-at-boot-time: empty property telling to enable the rs485 feature at boot time. It can be disabled later with proper ioctl. - rs485-rx-during-tx: empty property that enables the receiving of data even
Signature · 1 line
2.11.0
PATCH v4 3/9 serial: Add common rs485 device tree parsing function
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
Several drivers have the same device tree parsing code. Create a common helper function for it.
--- drivers/tty/serial/Kconfig | 4 ++++ drivers/tty/serial/Makefile | 2 ++ drivers/tty/serial/of.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 13 +++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 drivers/tty/serial/of.c
drivers/tty/serial/Kconfig +4 -0
@@ -14,6 +14,10 @@ config SERIAL_EARLYCON the console before standard serial driver is probed. The console is enabled when early_param is processed. +config OF_SERIAL + depends on SERIAL_CORE + def_bool y + source "drivers/tty/serial/8250/Kconfig" comment "Non-8250 serial port support"
drivers/tty/serial/Makefile +2 -0
@@ -7,6 +7,8 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o +obj-$(CONFIG_OF_SERIAL) += of.o + # These Sparc drivers have to appear before others such as 8250 # which share ttySx minor node space. Otherwise console device # names change and other unplesantries.
drivers/tty/serial/of.c new file +47 -0
47 lines not on this page · raw message
include/linux/serial_core.h +13 -0
@@ -501,4 +501,17 @@ static inline int uart_handle_break(struct uart_port *port) (cflag) & CRTSCTS || \ !((cflag) & CLOCAL)) +/* +* Common device tree parsing helpers +*/ +#ifdef CONFIG_OF_SERIAL +int of_get_rs485_mode (struct device_node *np,struct serial_rs485 *rs485conf); +#else +static inline int of_get_rs485_mode (struct device_node *np, +struct serial_rs485 *rs485conf) +{ +return 1 ; +} +#endif +#endif /* LINUX_SERIAL_CORE_H */
Signature · 1 line
2.11.0
PATCH v4 3/9 serial: Add common rs485 device tree parsing function
Quoted 5 lines · Uwe Kleine-K?nig
From: Sascha Hauer <[email protected]>
Several drivers have the same device tree parsing code. Create a common helper function for it.
Quoted 8 lines
Signed-off-by Sascha Hauer <[email protected]>[ukl: implement default <0 0> for rts-delay, unset unspecified flags]Acked-by Nicolas Ferre <[email protected]>Signed-off-by Uwe Kleine-K?nig <[email protected]>--- drivers/tty/serial/Kconfig | 4 ++++ drivers/tty/serial/Makefile | 2 ++ drivers/tty/serial/of.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
Why is this a separate file, with a Kconfig option that is always enabled? Why not just add the single function to the serial core?
Quoted 9 lines
+/**
+ *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.
1 is not an error code :(
Return a proper error please.
Quoted 41 lines
+ */
drivers/tty/serial/of.c new file +32
-0+int of_get_rs485_mode (struct device_node *np,struct serial_rs485 *rs485conf) +{ +u32 rs485_delay[2 ]; +int ret; + +if (!IS_ENABLED (CONFIG_OF ) || !np) +return 1 ; + + ret =of_property_read_u32_array (np,"rs485-rts-delay" , rs485_delay,2 ); +if (!ret) { + rs485conf->delay_rts_before_send = rs485_delay[0 ]; + rs485conf->delay_rts_after_send = rs485_delay[1 ]; + }else { + rs485conf->delay_rts_before_send =0 ; + rs485conf->delay_rts_after_send =0 ; + } + +/* +* clear full-duplex and enabled flags to get to a defined state with +* the two following properties. +*/ + rs485conf->flags &= ~(SER_RS485_RX_DURING_TX |SER_RS485_ENABLED ); + +if (of_property_read_bool (np,"rs485-rx-during-tx" )) + rs485conf->flags |=SER_RS485_RX_DURING_TX ; + +if (of_property_read_bool (np,"linux,rs485-enabled-at-boot-time" )) + rs485conf->flags |=SER_RS485_ENABLED ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (of_get_rs485_mode);include/linux/serial_core.h +0
-0@@ -501,4 +501,17 @@ static inline int uart_handle_break(struct uart_port *port) (cflag) &CRTSCTS || \ !((cflag) & CLOCAL))
include/linux/serial_core.h static inline int uart_handle_break(struct uart_port *port) · line 513
Quoted 10 lines
include/linux/serial_core.h +10
-0+/* +* 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 ;
Again, a real error.
And why not have a "generic" firmware function for this that defaults to the of_ for that platform type if present? What's the odds that acpi will need/want this soon anyway?
thanks,
greg k-h
PATCH v4 3/9 serial: Add common rs485 device tree parsing function
Quoted 15 lines · Greg KH
Quoted 5 lines · Uwe Kleine-K?nig
From: Sascha Hauer <[email protected]>
Several drivers have the same device tree parsing code. Create a common helper function for it.
Quoted 8 lines
Signed-off-by Sascha Hauer <[email protected]>[ukl: implement default <0 0> for rts-delay, unset unspecified flags]Acked-by Nicolas Ferre <[email protected]>Signed-off-by Uwe Kleine-K?nig <[email protected]>--- drivers/tty/serial/Kconfig | 4 ++++ drivers/tty/serial/Makefile | 2 ++ drivers/tty/serial/of.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
Quoted 2 lines
Why is this a separate file, with a
Kconfigoption that is always enabled? Why not just add the single function to the serial core?
Probably just a matter of taste. If you prefer I can put it into drivers/tty/serial/serial_core.c
Quoted 10 lines
Quoted 9 lines
+/**
+ *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.
Quoted 3 lines
1 is not an error code :(
Return a proper error please.
Well, it's not an error. These properties are optional and if I return (say) -ENOENT in this case, a caller looks as follows:
ret = of_get_rs485_mode(...);
if (ret == -ENOENT) {
/*
* hmm, does this mean there are no rs485 properties, or
* is this a different error that I should propagate
* because there is a problem with the device tree?
* I'm optimistic and assume the former.
* As of_get_rs485_mode already did everything
* necessary, there is no need to do anything else.
*/
} else if (ret < 0) {
return ret;
}With the semantic I chose it is just:
ret = of_get_rs485_mode(...); if (ret < 0) return ret;
without any guessing.
Quoted 41 lines
Quoted 41 lines
+ */
drivers/tty/serial/of.c new file +32
-0+int of_get_rs485_mode (struct device_node *np,struct serial_rs485 *rs485conf) +{ +u32 rs485_delay[2 ]; +int ret; + +if (!IS_ENABLED (CONFIG_OF ) || !np) +return 1 ; + + ret =of_property_read_u32_array (np,"rs485-rts-delay" , rs485_delay,2 ); +if (!ret) { + rs485conf->delay_rts_before_send = rs485_delay[0 ]; + rs485conf->delay_rts_after_send = rs485_delay[1 ]; + }else { + rs485conf->delay_rts_before_send =0 ; + rs485conf->delay_rts_after_send =0 ; + } + +/* +* clear full-duplex and enabled flags to get to a defined state with +* the two following properties. +*/ + rs485conf->flags &= ~(SER_RS485_RX_DURING_TX |SER_RS485_ENABLED ); + +if (of_property_read_bool (np,"rs485-rx-during-tx" )) + rs485conf->flags |=SER_RS485_RX_DURING_TX ; + +if (of_property_read_bool (np,"linux,rs485-enabled-at-boot-time" )) + rs485conf->flags |=SER_RS485_ENABLED ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (of_get_rs485_mode);include/linux/serial_core.h +0
-0@@ -501,4 +501,17 @@ static inline int uart_handle_break(struct uart_port *port) (cflag) &CRTSCTS || \ !((cflag) & CLOCAL))
Quoted 12 lines
include/linux/serial_core.h static inline int uart_handle_break(struct uart_port *port) · line 513
Quoted 10 lines
include/linux/serial_core.h +10
-0+/* +* 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 ;Again, a real error.
OK, I could agree to return -ENOSYS here. I predict I get complaints about this though and people will do:
ret = of_get_rs485_mode(...);
if (ret == -ENOSYS) {
/* ignore */
} else if (ret < 0) {
return ret;
}which one might consider troublesome or even wrong. (See the same discussions about 22c403676dbbb7c6f186099527af7f065498ef45 where I wanted to keep -ENOSYS.)
Quoted 3 lines
And why not have a "generic" firmware function for this that defaults to the
of_for that platform type if present? What's the odds that acpi will need/want this soon anyway?
I don't know about ACPI and all systems I care about are using dt. So I'd suggest we stick to dt and switch to "generic" if and when the need arises?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v4 4/9 serial: atmel: Use common rs485 device tree parsing function
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.
Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears SER_RS485_RX_DURING_TX and SER_RS485_ENABLED only but always which makes more sense.
--- drivers/tty/serial/atmel_serial.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/tty/serial/atmel_serial.c +1 -24
@@ -1667,29 +1667,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);
@@ -2373,7 +2350,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,atmel_init_property (atmel_port, pdev);atmel_set_ops (port); -atmel_init_rs485 (port, pdev); +of_get_rs485_mode (pdev->dev.of_node, &port->rs485); port->iotype =UPIO_MEM ; port->flags =UPF_BOOT_AUTOCONF |UPF_IOREMAP ;
Signature · 1 line
2.11.0
PATCH v4 4/9 serial: atmel: Use common rs485 device tree parsing function
Quoted 54 lines · Uwe Kleine-K?nig
From: Sascha Hauer <[email protected]>
We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.
Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears
SER_RS485_RX_DURING_TXandSER_RS485_ENABLEDonly but always which makes more sense.Signed-off-by Sascha Hauer <[email protected]>[ukleinek: point out semantic change in commit log]Acked-by Nicolas Ferre <[email protected]>Acked-by Richard Genoud <[email protected]>Signed-off-by Uwe Kleine-K?nig <[email protected]>--- drivers/tty/serial/atmel_serial.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)drivers/tty/serial/atmel_serial.c +0
-23@@ -1667,29 +1667,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);
drivers/tty/serial/atmel_serial.c static int atmel_init_port(struct atmel_uart_port *atmel_port, · line 2353
Quoted 5 lines
drivers/tty/serial/atmel_serial.c +1
-1@@ -2373,7 +2350,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);
No error checking?
PATCH v4 5/9 serial: fsl_lpuart: Use common rs485 device tree parsing function
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.
As a side effect this adds support for parsing rs485-rts-delay and rs485-rx-during-tx. As the driver doesn't support this though, probing fails if these are defined.
--- drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/tty/serial/fsl_lpuart.c +18 -6
@@ -2161,6 +2161,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, "
@@ -2171,12 +2189,6 @@ static int lpuart_probe(struct platform_device *pdev)dev_info (sport->port.dev,"DMA rx channel request failed, " "operating without rx DMA\n" ); -if (of_property_read_bool (np,"linux,rs485-enabled-at-boot-time" )) { - sport->port.rs485.flags |=SER_RS485_ENABLED ; - sport->port.rs485.flags |=SER_RS485_RTS_ON_SEND ; -writeb (UARTMODEM_TXRTSE , sport->port.membase +UARTMODEM ); - } -return 0 ; }
Signature · 1 line
2.11.0
PATCH v4 5/9 serial: fsl_lpuart: Use common rs485 device tree parsing function
Quoted 20 lines · Uwe Kleine-K?nig
From: Sascha Hauer <[email protected]>
We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.
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 <[email protected]>Signed-off-by Uwe Kleine-K?nig <[email protected]>--- drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)drivers/tty/serial/fsl_lpuart.c +0
-0
drivers/tty/serial/fsl_lpuart.c static int lpuart_probe(struct platform_device *pdev) · line 2164
Quoted 4 lines
drivers/tty/serial/fsl_lpuart.c +1
-0@@ -2161,6 +2161,24 @@ static int lpuart_probe(struct platform_device *pdev)return ret; } +of_get_rs485_mode (np, &sport->port.rs485);
error checking?
Elsewhere in this series as well.
Also, why did you not cc: me on this series so I am sure to see it?
thanks,
greg k-h
PATCH v4 6/9 serial: omap-serial: Use common rs485 device tree parsing function
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser.
--- drivers/tty/serial/omap-serial.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/tty/serial/omap-serial.c +1 -12
@@ -1607,7 +1607,6 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up, struct device_node *np) {struct serial_rs485 *rs485conf = &up->port.rs485; -u32 rs485_delay[2 ];enum of_gpio_flags flags;int ret;
@@ -1638,17 +1637,7 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up, up->rts_gpio = -EINVAL ; } -if (of_property_read_u32_array (np,"rs485-rts-delay" , - rs485_delay,2 ) ==0 ) { - rs485conf->delay_rts_before_send = rs485_delay[0 ]; - rs485conf->delay_rts_after_send = rs485_delay[1 ]; - } - -if (of_property_read_bool (np,"rs485-rx-during-tx" )) - rs485conf->flags |=SER_RS485_RX_DURING_TX ; - -if (of_property_read_bool (np,"linux,rs485-enabled-at-boot-time" )) - rs485conf->flags |=SER_RS485_ENABLED ; +of_get_rs485_mode (np, rs485conf);return 0 ; }
Signature · 1 line
2.11.0
PATCH v4 7/9 serial: imx: default to half duplex rs485
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
The i.MX driver defaulted to full duplex rs485 which is rather unusual and doesn't match the default implemented in other drivers.
So change the default to half duplex.
--- drivers/tty/serial/imx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/imx.c +1 -2
@@ -2120,8 +2120,7 @@ static int serial_imx_probe(struct platform_device *pdev) sport->port.fifosize =32 ; sport->port.ops = &imx_pops; sport->port.rs485_config = imx_rs485_config; - sport->port.rs485.flags = -SER_RS485_RTS_ON_SEND |SER_RS485_RX_DURING_TX ; + sport->port.rs485.flags =SER_RS485_RTS_ON_SEND ; sport->port.flags =UPF_BOOT_AUTOCONF ;init_timer (&sport->timer); sport->timer.function = imx_timeout;
Signature · 1 line
2.11.0
PATCH v4 8/9 serial: imx: Use common rs485 device tree parsing function
In reply to Uwe Kleine-KönigFrom: Sascha Hauer <[email protected]>
This adds support for the rs485 specific properties defined in Documentation/devicetree/bindings/serial/rs485.txt.
--- drivers/tty/serial/imx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/imx.c +2 -0
@@ -2059,6 +2059,8 @@ static int serial_imx_probe_dt(struct imx_port *sport,if (of_get_property (np,"rts-gpios" ,NULL )) sport->have_rtsgpio =1 ; +of_get_rs485_mode (np, &sport->port.rs485); + return 0; }#else
Signature · 1 line
2.11.0
PATCH v4 9/9 dt-bindings: serial: document rs485 bindings for various devices
In reply to Uwe Kleine-KönigAtmel USART, Freescale UARTs and OMAP UART all support the rs485 binding described in rs485.txt, this commit just makes that explicit.
--- Documentation/devicetree/bindings/serial/atmel-usart.txt | 1 + Documentation/devicetree/bindings/serial/fsl-imx-uart.txt | 1 + Documentation/devicetree/bindings/serial/fsl-lpuart.txt | 1 + Documentation/devicetree/bindings/serial/omap_serial.txt | 1 + 4 files changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/atmel-usart.txt +1 -0
@@ -24,6 +24,7 @@ Optional properties: - dma-names: "rx" for RX channel, "tx" for TX channel. - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO capable USARTs. +- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt <chip> compatible description: - at91rm9200: legacy USART support
Documentation/devicetree/bindings/serial/fsl-imx-uart.txt +1 -0
@@ -9,6 +9,7 @@ Optional properties: - fsl,irda-mode : Indicate the uart supports irda mode - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works in DCE mode by default. +- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt Please check Documentation/devicetree/bindings/serial/serial.txt for the complete list of generic properties.
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +1 -0
@@ -16,6 +16,7 @@ Required properties: Optional properties: - dmas: A list of two dma specifiers, one for each entry in dma-names. - dma-names: should contain "tx" and "rx". +- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt Note: Optional properties for DMA support. Write them both or both not.
Documentation/devicetree/bindings/serial/omap_serial.txt +1 -0
@@ -19,6 +19,7 @@ Optional properties: - dmas : DMA specifier, consisting of a phandle to the DMA controller node and a DMA channel number. - dma-names : "rx" for receive channel, "tx" for transmit channel. +- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt Example:
Signature · 1 line
2.11.0