From patchwork Fri Dec 2 10:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Niedermaier X-Patchwork-Id: 13062612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73E3BC4167B for ; Fri, 2 Dec 2022 10:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Luu6a8o79fdF8UxpaLvrwqWQ/KV7fIL3KutzHZdcarU=; b=C9cSHTu0A3ZnlS /8IRFk61fsinTTJq0KitxoWgCcIEeW9twD2h5Gv+N8A4lmYXalCjDNH/77W+COckAun1ovFGvJ0qX kUAPmly8/QJeTH8QXg/63WD+kTF7eMrJysxydeyjLHNTHC3s999UAFZbrZaZv38uL2Vz2p2YFIK// 7UhZo+awAey1gTCiKPBrqUkZ0kJiZbD2rf3HKvbmrFj8zkrbVJn7Gv3YjkRSAxnVWP5UOpPYEoOvx V+dbNVMPRagb9c7DB4jmJ/KrVKSUVn7WzrQtVbMKFq8foJh/KOKRUU/tADsbBV6V9VA4WVJEHe/Ck sbl9HE/2y80P9bA9ZEaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p13WQ-00FfrR-1I; Fri, 02 Dec 2022 10:43:58 +0000 Received: from mx2.securetransport.de ([2a03:4000:13:6c7::1]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p13Vs-00FfW7-KT for linux-arm-kernel@lists.infradead.org; Fri, 02 Dec 2022 10:43:26 +0000 Received: from mail.dh-electronics.com (unknown [77.24.89.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.securetransport.de (Postfix) with ESMTPSA id A1B3D5E99E; Fri, 2 Dec 2022 11:42:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dh-electronics.com; s=dhelectronicscom; t=1669977770; bh=jqDVLZ1Ing9hJRDRxYi7bntuyllmW9Hd+BSl+I1NndE=; h=From:To:CC:Subject:Date:From; b=HU/pXZLZmRcF1uN0PFqfGG/og/EYzT8EzGJ7udmm9gEpOOkX9JCFzVSANYXIlfuMI tE5SmtRUfP/v6+Bo4GbkqEQy3Jdcrsftl2L0ti4lb+ozTgZiOyoU748gTKrc3/WkS5 c3DyGZkTyI3BuyAO78hB00QVcMV0cplew+2Ar/OSF89/zBxwVVYSqIWPl3WXXS4ZZd Buc65mtcnhfd5ppZd8xKIUXBqITPq02n/mRxeW3p+8zHWzCNJ3Tft/V9Ggru1dNMe2 00mBpEK48B3VsIy9V6vAbz/40sE1t3WpK5bN/0RbJT8+yDg5g/9UNFL2i0LOZ1PLJL nUDC4J9yaw8Vw== Received: from DHPWEX01.DH-ELECTRONICS.ORG (10.64.2.30) by DHPWEX01.DH-ELECTRONICS.ORG (10.64.2.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.20; Fri, 2 Dec 2022 11:42:37 +0100 Received: from localhost.localdomain (172.16.51.2) by DHPWEX01.DH-ELECTRONICS.ORG (10.64.2.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.20 via Frontend Transport; Fri, 2 Dec 2022 11:42:36 +0100 From: Christoph Niedermaier To: , CC: , , , Christoph Niedermaier , Greg Kroah-Hartman , Rob Herring , "Alexander Dahl" , , Subject: [PATCH V4 1/4] dt-bindings: serial: rs485: Add GPIO controlling RX enable during TX Date: Fri, 2 Dec 2022 11:41:24 +0100 Message-ID: <20221202104127.122761-1-cniedermaier@dh-electronics.com> X-Mailer: git-send-email 2.11.0 X-klartext: yes MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221202_024324_966096_D300FD74 X-CRM114-Status: GOOD ( 16.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Rob Herring --- Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Alexander Dahl Cc: Marek Vasut 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 V4: - Add Reviewed-by tag --- 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 ...