Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4240139rdb; Thu, 28 Dec 2023 15:25:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvv08ZSHeTBXyinndUpfHz4v7rKeT5ML46tiwvZnrSAlPqXCZ3CLZFWZttiU52rW9Irgix X-Received: by 2002:a05:6808:1295:b0:3bb:6d50:b962 with SMTP id a21-20020a056808129500b003bb6d50b962mr14542697oiw.80.1703805938327; Thu, 28 Dec 2023 15:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703805938; cv=none; d=google.com; s=arc-20160816; b=Wik50TMGx51nvrSYlY9t3hctsKM4N0hZoRmBdnrH6FBHSixk+VI8SkiqxbqsMJHglc WiEa/ZzdAOsrvvg3kR5U2idgj3gg8kftXwRHBHwOfJxy6BHFuOw6BI1iwc6Wsr8XuMQ5 KSZLHO4lo66pCTuaz7dY9Ffkly9YmqgtpVTiNze/Z1Nzlo+3hsQYuzhMh4jz7tH6L5Q8 kYVHtWKVYWf/FMw04Amk9UkRFK4p3ltwp87BHFZppd0moqxs450vP3peeiJncgySVWjg 82KYqtQWTQ1vM0/2tano3Lrw9qQ2Mkf1P3iIbALcCONq5Uuc2xtG7Cbf5VKHN3CnCGN9 FCIA== 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=WRVZvo7nI1URArnF2qylEp+fmMfnuqO70yqjGz2JYIE=; fh=jgbIaZY0jy0WnLNoMoUdB4rU1LGSYDgHEWpcf+iNgPQ=; b=Lr01ypc1eY9Xign5/T8rgfqefm8aisjldM2WZGYlYkQxXl51B9qdZImaNjNQu7QwOO F5VdF0shbcAGbjA86RbhpRal/EFMCeUQKkYicIbrUA/UmcZdyoYbkduN0YWTjg6sEmQe 3reMQZAtDy4Dd+UAhGr/z9MD+IZtVcye/XKd9KWozAx5nZVbk68/XB+VmQ1IeU9SNIso Yl6XuOiRce2fnSQhajXSQKwhWnwtwOj4cvl+SRsQGGLnQBGXmrx+aColWWD4Om/doJk3 WY12cDpiFnip7cWGhLGXD7NbpdkYnetDhdFF0IOKkX83aC3K92YUzISEgRSGPkd346VC 2IPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12876-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i69-20020a636d48000000b005ce6a86685bsi529077pgc.847.2023.12.28.15.25.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 15:25:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12876-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7372CB23B79 for ; Thu, 28 Dec 2023 23:25:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1D8610A1A; Thu, 28 Dec 2023 23:25:24 +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 264DD1097C; Thu, 28 Dec 2023 23:25:20 +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 EECC2100D9410; Fri, 29 Dec 2023 00:25:11 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B66B4232130; Fri, 29 Dec 2023 00:25:11 +0100 (CET) Date: Fri, 29 Dec 2023 00:25:11 +0100 From: Lukas Wunner To: Lino Sanfilippo Cc: Christoph Niedermaier , Crescent CY Hsieh , Andy Shevchenko , 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: <20231228232511.GA19291@wunner.de> References: <3b8548b1-b8a9-0c9e-4040-5cfda06a85c6@gmx.de> <5c140498-69e3-4187-8703-db0c41e7ca89@gmx.de> <20231221155305.GA13673@wunner.de> <0ec4c423-3d18-4a29-b78e-938366ece117@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: <0ec4c423-3d18-4a29-b78e-938366ece117@gmx.de> User-Agent: Mutt/1.10.1 (2018-07-13) On Sat, Dec 23, 2023 at 02:40:58PM +0100, Lino Sanfilippo wrote: > On 23.12.23 13:49, Christoph Niedermaier wrote: > > From: Lukas Wunner [mailto:lukas@wunner.de] > > Sent: Thursday, December 21, 2023 4:53 PM > > > 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. > > > > Sounds not bad. The termination should only depend on whether the GPIO is > > given or not. > > > > Irrespective of this, I think the Linos idea of an RS-422 mode is not bad. > > This allows you to take care of special features that were previously > > overlooked. For example, hardware flow control can be switched off so that > > this does not cause any problems. > > Also note, that RS232 and RS422 may NOT always be the same from driver > perspective. > Take a look at 8250_excar.c for example. That driver has to configure > the hardware accordingly when switching from RS232 to RS422 > (see iot2040_rs485_config()). Actually it seems there are a bunch of GPIOs on the IOT2040 board (called MPIO instead of GPIO by the driver). See the documentation of the wiring at line 87 in drivers/tty/serial/8250/8250_exar.c. So "configure the hardware" seems to just boil down to toggling the right GPIO (aka MPIO) pins to mux the UART signals to the right (RS232/RS485/RS422) transceiver. IOT2040 is an ACPI-based platform, so no devicetree to describe the RS232/RS485/RS422 mux GPIOs, but the underlying concept is the same. Thanks, Lukas