Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp237842rdb; Thu, 21 Dec 2023 07:53:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTO22tzAgygqwI/KOOaJ9XilyH967b5YIA+kWVX8l27JPNqSl0Kpv9NBWOcb5SYrbtXYO2 X-Received: by 2002:a50:d65a:0:b0:553:7f36:b90c with SMTP id c26-20020a50d65a000000b005537f36b90cmr3479484edj.1.1703174000567; Thu, 21 Dec 2023 07:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703174000; cv=none; d=google.com; s=arc-20160816; b=KT1cd8njbVZrNcYEd0QTSvQcnRDkFZHVjPp3aTTpHJigTl0ULasCfNV4cAxqqoduqE lVrTwF6IXtahW/3WxweFSalminrTwmRt+OfWrv+3H3aMSx0dmedb83MWx9pwZ0BhwAhg 6T4yNiLTSN0fEfapJGNY8R9r5sH+JSC/79/zKMHIGpdWdwHQu1i4HIzEmD/1ZYAUWCoF KCFQj+5Ibif4dpSSLYlO6Kt8qG158w9j0rWbIv6kxFk7TIYMSDbIbp6EWn46FgBmh80s XQMhnwW5O+3wmJvt0qvp9DjwBBWrwXj2m0rUtA1ETszAvmN9V4ZH8Y4z9xQXp3UdX3hd ISTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=A28u3frb8rjWP28xLNJCgmgA3kYRv6+HTV3+0yk6Fts=; fh=5ufJoMRcsTxUNEzKhChonE6fj/1NqmMtqndSf8pLeaE=; b=NgKbE57ogDQavSWBTqkdTSVOKIZTtH3n3iyQIhmwLkjlGOxjjVf21lVV9wh82U0MwV cE2WysnbJIEKu9PI43ZsUrhYg+k1LON0OEbmrrqOoelK+c1gG84QZVZmSzlfWX8KVBtN RmQQ+U+q9OsWb2dpSuEPLrtKjT93B4xO8SzjM6fYitCioYxFUt9BhIw6HZhiYHrXhAGE 0ZGN4CDxVx0hIooRnPRCmQSk9yUDFeAkx+BLwtkFrJyT1o+uYv3L++rwyAZqlROcuj6q dRc0NFECTb/F1K4cUD8YVnJ9LjH6W+Elnztvr9SJAnBVrl1vMZNVGX17Wbydb+CyvX2Y WzpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8711-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h6-20020a05640250c600b0055293148185si978788edb.369.2023.12.21.07.53.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:53:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8711-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 48E201F21D45 for ; Thu, 21 Dec 2023 15:53:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AA3E55E43; Thu, 21 Dec 2023 15:53:11 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A0BA539FD; Thu, 21 Dec 2023 15:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 2F054100B08FA; Thu, 21 Dec 2023 16:53:06 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 009392AE38; Thu, 21 Dec 2023 16:53:05 +0100 (CET) Date: Thu, 21 Dec 2023 16:53:05 +0100 From: Lukas Wunner To: Christoph Niedermaier Cc: Crescent CY Hsieh , Andy Shevchenko , Lino Sanfilippo , Rasmus Villemoes , Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-serial@vger.kernel.org" , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , "brenda.streiff@ni.com" , Tomas Paukrt Subject: Re: [PATCH 1/2] dt-bindings: serial: rs485: add rs485-mux-gpios binding Message-ID: <20231221155305.GA13673@wunner.de> References: <20231120151056.148450-1-linux@rasmusvillemoes.dk> <20231120151056.148450-2-linux@rasmusvillemoes.dk> <20231122145344.GA18949@wunner.de> <3b8548b1-b8a9-0c9e-4040-5cfda06a85c6@gmx.de> <5c140498-69e3-4187-8703-db0c41e7ca89@gmx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Dec 14, 2023 at 01:41:47PM +0000, Christoph Niedermaier wrote: > I will summarize the current situation from my point of view, maybe it helps: > > RS-232: > - Full Duplex Point-to-Point connection > - No transceiver control with RTS > - No termination > - No extra struct in use > > RS-422: > - Full Duplex Point-to-Point connection > - No transceiver control with RTS needed > - Termination possible > - Extra struct serial_rs485 needed if termination is used > => RS-422 can be used in RS-232 operation, but if a termination should be > switchable the RS485 flag has to be enabled. But then also transceiver > control will be enabled. Not a very satisfying situation. Well why don't we just allow enabling or disabling RS-485 termination independently from the SER_RS485_ENABLED bit in struct serial_rs485? Just let the user issue a TIOCSRS485 ioctl to toggle termination even if in RS-232 mode and use that mode for RS-422. Looks like the simplest solution to me. > RS-485 (2-wire) very common: > - Half Duplex RS-485 bus > - Transceiver control with RTS is needed > - Termination possible > - Extra struct serial_rs485 is needed > => RS-485 has to be enabled and configured: > - Set SER_RS485_ENABLED > - Set SER_RS485_RTS_ON_SEND or SER_RS485_RTS_AFTER_SEND > - Set/clear SER_RS485_RX_DURING_TX depending on whether > the receiver path should be on or off during sending. > If it's set it allows to monitor the sending on the bus > and detect whether another bus device is transmitting > at the same time. > - Set/clear SER_RS485_TERMINATE_BUS for bus termination. > > RS-485 (4-wire) little used: > - Full Duplex RS-485 bus > - Transceiver control with RTS is needed > - Termination possible > - Extra struct serial_rs485 is needed > => RS-485 has to be enabled and configured: > - Set SER_RS485_ENABLED > - Set SER_RS485_RTS_ON_SEND or SER_RS485_RTS_AFTER_SEND > - Set SER_RS485_RX_DURING_TX, as the receiver should always > be enabled independently of TX, because TX and RX are > separated from each other by their own wires. > - Set/clear SER_RS485_TERMINATE_BUS for bus termination. Thanks for that overview, I found it very helpful. One small addendum: Hardware flow control. Only possible with RS-232. Doesn't work in any of the other modes, right? Thanks, Lukas