* [PATCH v2 0/4] rs485 bus termination GPIO
@ 2020-05-12 12:40 Lukas Wunner
2020-05-12 12:40 ` [PATCH v2 3/4] dt-bindings: serial: Add binding for " Lukas Wunner
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2020-05-12 12:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring
Cc: Matwey V. Kornilov, Giulio Benetti, Heiko Stuebner,
Andy Shevchenko, Christoph Muellner, linux-serial, devicetree
Define a device tree binding for an rs485 bus termination GPIO
(patch [3/4]), amend the serial core to retrieve the GPIO from
the device tree and amend the default ->rs485_config() callback
for 8250 drivers to change the GPIO on request from user space
(patch [4/4]).
Retrieving the GPIO from the device tree may fail, so allow
uart_get_rs485_mode() to return an errno and change all callers
to check for failure (patch [2/4]).
Fix a bug in the 8250 core if retrieval of the GPIO initially
fails with -EPROBE_DEFER and is later retried (patch [1/4]).
Changes v1 -> v2:
Patch [1/4]:
* Drop unnecessary "else" after "if ... goto" statement. (Andy)
* Document applicability to older kernels in commit message. (Andy)
* Add Fixes tag. (Andy)
Patch [4/4]:
* Drop unnecessary devm_gpiod_put(). (Andy)
* Use GPIOD_OUT_LOW macro for brevity. (Andy)
* Document the rationale for disabling termination by default.
* Drop nonsensical read of GPIO after setting its direction to out.
Link to v1:
https://lore.kernel.org/linux-serial/cover.1588505407.git.lukas@wunner.de/
Lukas Wunner (4):
serial: 8250: Avoid error message on reprobe
serial: Allow uart_get_rs485_mode() to return errno
dt-bindings: serial: Add binding for rs485 bus termination GPIO
serial: 8250: Support rs485 bus termination GPIO
.../devicetree/bindings/serial/rs485.yaml | 4 ++++
drivers/tty/serial/8250/8250_core.c | 18 ++++++++++-----
drivers/tty/serial/8250/8250_port.c | 4 ++++
drivers/tty/serial/ar933x_uart.c | 6 +++--
drivers/tty/serial/atmel_serial.c | 6 +++--
drivers/tty/serial/fsl_lpuart.c | 5 ++++-
drivers/tty/serial/imx.c | 6 ++++-
drivers/tty/serial/omap-serial.c | 4 +++-
drivers/tty/serial/serial_core.c | 22 ++++++++++++++++++-
drivers/tty/serial/stm32-usart.c | 8 +++----
include/linux/serial_core.h | 4 +++-
11 files changed, 69 insertions(+), 18 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 3/4] dt-bindings: serial: Add binding for rs485 bus termination GPIO
2020-05-12 12:40 [PATCH v2 0/4] rs485 bus termination GPIO Lukas Wunner
@ 2020-05-12 12:40 ` Lukas Wunner
0 siblings, 0 replies; 2+ messages in thread
From: Lukas Wunner @ 2020-05-12 12:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring
Cc: Matwey V. Kornilov, Giulio Benetti, Heiko Stuebner,
Andy Shevchenko, Christoph Muellner, linux-serial, devicetree
Commit e8759ad17d41 ("serial: uapi: Add support for bus termination")
introduced the ability to enable rs485 bus termination from user space.
So far the feature is only used by a single driver, 8250_exar.c, using a
hardcoded GPIO pin specific to Siemens IOT2040 products.
Provide for a more generic solution by allowing specification of an
rs485 bus termination GPIO pin in the device tree. An upcoming commit
implements support for this pin for any 8250 driver. The binding is
used in device trees of the "Revolution Pi" PLCs offered by KUNBUS.
[Heiko Stuebner converted the binding to YAML, hence his Signed-off-by.]
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
---
Documentation/devicetree/bindings/serial/rs485.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/serial/rs485.yaml b/Documentation/devicetree/bindings/serial/rs485.yaml
index d4beaf11222d..a9ad17864889 100644
--- a/Documentation/devicetree/bindings/serial/rs485.yaml
+++ b/Documentation/devicetree/bindings/serial/rs485.yaml
@@ -43,3 +43,7 @@ properties:
rs485-rx-during-tx:
description: enables the receiving of data even while sending data.
$ref: /schemas/types.yaml#/definitions/flag
+
+ rs485-term-gpios:
+ description: GPIO pin to enable RS485 bus termination.
+ maxItems: 1
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-12 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-12 12:40 [PATCH v2 0/4] rs485 bus termination GPIO Lukas Wunner
2020-05-12 12:40 ` [PATCH v2 3/4] dt-bindings: serial: Add binding for " Lukas Wunner
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).