From patchwork Wed Oct 26 16:50:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Niedermaier X-Patchwork-Id: 13020892 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 7828BC433FE for ; Wed, 26 Oct 2022 16:54:13 +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=OWEBzTsgnoDHodMRaUMhQYSdB009layLwxWucMs1WIM=; b=O//FKhccINHBEQ jjzpH2cCbJlWz5gi4IyIopvfbTpIZ3fvbwJDaj9Fn2/s1fUCYYKuOmUEXg5o7IxSoC3zyksCQNmqw kk8vMdKpMbL5Lg2pNvTlmN++vsnADqPNQAIJ6UTz9fvdnqxcLjX74e7hSOAq5Xr41ST481CYvATO6 5SWG2eySd22rmqaVa+YS7zZQfYLkP38kaL3o07bsnl6VXHxFaDWXGSCiM4JdArHLd0Cq0IFGpax4f +kpCX3bKntNUQV+OJb/1e6GK6wEjFEguZzVgfLVqQcIHFAKgwjv4o0zlp4Um4adJ5Qp22Kdej/qiL fIjljO7JI9xXoq7SBHgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onjeM-00AEGx-UC; Wed, 26 Oct 2022 16:53:07 +0000 Received: from mx4.securetransport.de ([178.254.6.145]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onjeJ-00AEEj-RZ for linux-arm-kernel@lists.infradead.org; Wed, 26 Oct 2022 16:53:05 +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 mx4.securetransport.de (Postfix) with ESMTPSA id 5C201720507; Wed, 26 Oct 2022 18:52:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dh-electronics.com; s=dhelectronicscom; t=1666803149; bh=QUKg28pcVKM/t0EP9hfe9G7J4P8dcYN9ZQdbQEccXVE=; h=From:To:CC:Subject:Date:From; b=LJdNBr1eCN0rB1bBz0MRlJNhW4LJYGu/auwVTHc05ZPemjyS6Et3vHDZUXbNSXXfP f41hTUTg1Vu93BRldtnsyJIJ46hp3bqa8maSsx+2QmjcbzhNTGQUA61W5kd9EWfuP/ +visV24XQHhnHT9/7qRx5Ai59XutQ9bhEe18s9ZBoiFDnSULG/a2qYvE74vUFe7zog l/NVLdxakrQKFJCzMbfQNhNzBXh0DhPqx5QG8sDntxzDhOyxY+SbPwXgaE5tkN3/1a 3aI6Euf7eBBS3x2wtENdj2GF2X25Nm7I6JgT3DibX2CaZ86WlduswF9fKh/qkaUcMK fnlXOWR/+BVjg== 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.15; Wed, 26 Oct 2022 18:52:18 +0200 Received: from localhost.localdomain (172.16.51.8) 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.15 via Frontend Transport; Wed, 26 Oct 2022 18:52:17 +0200 From: Christoph Niedermaier To: , CC: , , , Christoph Niedermaier Subject: [PATCH 0/4] tty: serial: Add ability to control rs485 RX_DURING_TX via a GPIO Date: Wed, 26 Oct 2022 18:50:45 +0200 Message-ID: <20221026165049.9541-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-20221026_095304_244909_DDBF2A2A X-CRM114-Status: GOOD ( 15.02 ) 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 This patch series add the ability to control the RS485 feature RX_DURING_TX via a GPIO. Currently it is handled by the low level serial driver and it depends on the ability of the serial hardware. In case of that RX_DURING_TX is disabled the serial hardware must be capable to turn off the receiver during sending. The idea is to have an electrical circuit that connects/disconnects the Rx by using the RX_DURING_TX GPIO. On one hand by using this GPIO the use of RS485 RX_DURING_TX becomes independent of the capability of the serial hardware, and on the other hand possible software-caused switch-off and switch-on times of the receiver in case of RX_DURING_TX is disabled (default state) can also be avoided. The core patch adds a generic GPIO variable for the use of this RS485 feature controlled by a GPIO. The GPIO is defined by the devicetree property "rs485-rx-during-tx-gpios". The low-level implementation is done for the STM32 and the i.MX serial driver. Other platforms are not covered in this series, but can easily be added. I tested it with a DHCOM i.MX6DL and DHCOM STM32MP1 on a PicoITX board. In this series the devicetree bindings description is also included. Christoph Niedermaier (4): dt_bindings: rs485: Add binding for GPIO that controls Rx enable during Tx serial: core: Add option to control rs485 RX_DURING_TX by a GPIO serial: imx: Add support for rs485 RX_DURING_TX GPIO serial: stm32: Add support for rs485 RX_DURING_TX GPIO Documentation/devicetree/bindings/serial/rs485.yaml | 4 ++++ drivers/tty/serial/imx.c | 13 +++++++++++-- drivers/tty/serial/serial_core.c | 12 ++++++++++++ drivers/tty/serial/stm32-usart.c | 9 ++++++++- include/linux/serial_core.h | 1 + 5 files changed, 36 insertions(+), 3 deletions(-)