All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: <linux-serial@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <krzysztof.kozlowski+dt@linaro.org>, <marex@denx.de>,
	<jirislaby@kernel.org>,
	Christoph Niedermaier <cniedermaier@dh-electronics.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	"Alexander Dahl" <ada@thorsis.com>, <kernel@dh-electronics.com>,
	<devicetree@vger.kernel.org>
Subject: [PATCH V3 1/4] dt-bindings: serial: rs485: Add GPIO controlling RX enable during TX
Date: Thu, 1 Dec 2022 12:02:34 +0100	[thread overview]
Message-ID: <20221201110237.7917-1-cniedermaier@dh-electronics.com> (raw)

Add a binding for a generic definition of an output GPIO that sets the
state of rs485-rx-during-tx. The idea is that the hardware already controls
the option receiving during sending before it gets to the signal receiving
hardware. The standard RS485 is a half-duplex bus that in most cases is
driven by an UART controller. The advantage of using this GPIO is that it
is independent of the capabilities of the UART core and the UART driver.
On the hardware side the interface to the bus is controlled by a transceiver,
that has a pin called RE (RX Enable) or similar, which connects the bus to
the RX signal of the UART controller. The GPIO can switch between two states
to control the RE pin via an electrical circuit:
- Active:
  The RE pin is always active. The UART RX see everything on the bus and
  therefore also what happens with the TX signal on the bus.
- Inactive:
  The RE pin is always active, but during sending on the bus the pin RE is
  inactive. So basically the receiving during sending is suppressed.

A possible circuit diagram could look like this:
                                  ┌──────────────────┐
                                  │       RS485      │
                TX ───────────────┤D                 │
                                  │    Transceiver   │
               RTS ────┬──────────┤DE                │
                       │          │                  │
                       │ ┌─────┐  │                  │
                       └─┤&    │  │                  │
                         │     ├──┤!RE               │
!rx_during_tx_gpio ──────┤     │  │                  │
                         └─────┘  │                  │
                                  │                  │
                RX ───────────────┤R                 │
                                  │                  │
                                  └──────────────────┘

Here the RTS pin of the UART core is used to control TX via the transceiver
pin DE (Drive Enable). RE and rx_during_tx_gpio are active low.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Alexander Dahl <ada@thorsis.com>
Cc: Marek Vasut <marex@denx.de>
Cc: kernel@dh-electronics.com
Cc: devicetree@vger.kernel.org
To: linux-serial@vger.kernel.org
To: linux-arm-kernel@lists.infradead.org
---
V2: - Rework of the commit message
    - Rework GPIO property comment
V3: - Rework the binding description
    - Rework message title
    - Rework of the commit message
---
 Documentation/devicetree/bindings/serial/rs485.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/rs485.yaml b/Documentation/devicetree/bindings/serial/rs485.yaml
index 90a1bab40f05..a973ab7d7e46 100644
--- a/Documentation/devicetree/bindings/serial/rs485.yaml
+++ b/Documentation/devicetree/bindings/serial/rs485.yaml
@@ -51,6 +51,12 @@ properties:
     description: GPIO pin to enable RS485 bus termination.
     maxItems: 1
 
+  rs485-rx-during-tx-gpios:
+    description: Output GPIO pin that sets the state of rs485-rx-during-tx. This
+      signal can be used to control the RX part of an RS485 transceiver. Thereby
+      the active state enables RX during TX.
+    maxItems: 1
+
 additionalProperties: true
 
 ...
-- 
2.11.0


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

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: <linux-serial@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <krzysztof.kozlowski+dt@linaro.org>, <marex@denx.de>,
	<jirislaby@kernel.org>,
	Christoph Niedermaier <cniedermaier@dh-electronics.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	"Alexander Dahl" <ada@thorsis.com>, <kernel@dh-electronics.com>,
	<devicetree@vger.kernel.org>
Subject: [PATCH V3 1/4] dt-bindings: serial: rs485: Add GPIO controlling RX enable during TX
Date: Thu, 1 Dec 2022 12:02:34 +0100	[thread overview]
Message-ID: <20221201110237.7917-1-cniedermaier@dh-electronics.com> (raw)

Add a binding for a generic definition of an output GPIO that sets the
state of rs485-rx-during-tx. The idea is that the hardware already controls
the option receiving during sending before it gets to the signal receiving
hardware. The standard RS485 is a half-duplex bus that in most cases is
driven by an UART controller. The advantage of using this GPIO is that it
is independent of the capabilities of the UART core and the UART driver.
On the hardware side the interface to the bus is controlled by a transceiver,
that has a pin called RE (RX Enable) or similar, which connects the bus to
the RX signal of the UART controller. The GPIO can switch between two states
to control the RE pin via an electrical circuit:
- Active:
  The RE pin is always active. The UART RX see everything on the bus and
  therefore also what happens with the TX signal on the bus.
- Inactive:
  The RE pin is always active, but during sending on the bus the pin RE is
  inactive. So basically the receiving during sending is suppressed.

A possible circuit diagram could look like this:
                                  ┌──────────────────┐
                                  │       RS485      │
                TX ───────────────┤D                 │
                                  │    Transceiver   │
               RTS ────┬──────────┤DE                │
                       │          │                  │
                       │ ┌─────┐  │                  │
                       └─┤&    │  │                  │
                         │     ├──┤!RE               │
!rx_during_tx_gpio ──────┤     │  │                  │
                         └─────┘  │                  │
                                  │                  │
                RX ───────────────┤R                 │
                                  │                  │
                                  └──────────────────┘

Here the RTS pin of the UART core is used to control TX via the transceiver
pin DE (Drive Enable). RE and rx_during_tx_gpio are active low.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Alexander Dahl <ada@thorsis.com>
Cc: Marek Vasut <marex@denx.de>
Cc: kernel@dh-electronics.com
Cc: devicetree@vger.kernel.org
To: linux-serial@vger.kernel.org
To: linux-arm-kernel@lists.infradead.org
---
V2: - Rework of the commit message
    - Rework GPIO property comment
V3: - Rework the binding description
    - Rework message title
    - Rework of the commit message
---
 Documentation/devicetree/bindings/serial/rs485.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/rs485.yaml b/Documentation/devicetree/bindings/serial/rs485.yaml
index 90a1bab40f05..a973ab7d7e46 100644
--- a/Documentation/devicetree/bindings/serial/rs485.yaml
+++ b/Documentation/devicetree/bindings/serial/rs485.yaml
@@ -51,6 +51,12 @@ properties:
     description: GPIO pin to enable RS485 bus termination.
     maxItems: 1
 
+  rs485-rx-during-tx-gpios:
+    description: Output GPIO pin that sets the state of rs485-rx-during-tx. This
+      signal can be used to control the RX part of an RS485 transceiver. Thereby
+      the active state enables RX during TX.
+    maxItems: 1
+
 additionalProperties: true
 
 ...
-- 
2.11.0


             reply	other threads:[~2022-12-01 11:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 11:02 Christoph Niedermaier [this message]
2022-12-01 11:02 ` [PATCH V3 1/4] dt-bindings: serial: rs485: Add GPIO controlling RX enable during TX Christoph Niedermaier
2022-12-01 11:02 ` [PATCH V3 2/4] serial: core: Add option to output RS485 RX_DURING_TX state via GPIO Christoph Niedermaier
2022-12-01 11:02   ` Christoph Niedermaier
2022-12-01 11:02 ` [PATCH V3 3/4] serial: imx: Add support for RS485 RX_DURING_TX output GPIO Christoph Niedermaier
2022-12-01 11:02   ` Christoph Niedermaier
2022-12-01 11:02 ` [PATCH V3 4/4] serial: stm32: Add support for rs485 " Christoph Niedermaier
2022-12-01 11:02   ` Christoph Niedermaier
2022-12-01 12:09   ` Ilpo Järvinen
2022-12-01 12:09     ` Ilpo Järvinen
2022-12-01 23:56 ` [PATCH V3 1/4] dt-bindings: serial: rs485: Add GPIO controlling RX enable during TX Rob Herring
2022-12-01 23:56   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221201110237.7917-1-cniedermaier@dh-electronics.com \
    --to=cniedermaier@dh-electronics.com \
    --cc=ada@thorsis.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@dh-electronics.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.