Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2879338ybk; Mon, 18 May 2020 10:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw66khwQvcyrx/FT4S7J40h1FJVeXmDlc/SY1uGK0zerZfvulWEKGOwfs0LM8NTIypA/XUO X-Received: by 2002:a17:906:33c9:: with SMTP id w9mr15460229eja.284.1589821661167; Mon, 18 May 2020 10:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589821661; cv=none; d=google.com; s=arc-20160816; b=jslNfXhF5h2sMmynGIvD7p0fuSe1qB3fYD9Wua0p+pSro0tTGHO69yPa2xtKg8ccmv kbzPysuzI1xTFG6VNA/c8yLOy6t13UU0kRF80eHHhCO1xG+nu8zVQRwK6TYznIDnqRjn QGa/W4HAATenG+MxZiX+SLTYPxZRJKZM18ZsKX9316difSMPo1CKhBq5xo9iiZV9brSO +caKPsrQlFTjqijvY88wXaiaRejNIaLACT/9VC2OZKu9wbtXab/VdZD6PuHJEbWz2h8m gJyPDMvG3Znd6hogwxRQFVSlGMTEezQN0runzNXuFsd6sZqUYjsSW7sk2fQadkQC3RI6 jC+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=PjrQO0AknlBbDve45M+K4Rj9+GglCMsKywwAGiQ7dnE=; b=VD83s/x93S4kvx/N6YDFZ6el4FohlCw6CyEHKtUj1+OvlOHOnAXgahMeLpx3OZ1ZXO /5gaCFUPrJClKHAgF0OoXxq0WW7MIFoERLulDlUuMCGcgxRK72Jn4dvdhIO1D3EHN9eu UCpaLvUoKdQJb//WDmglOMcC5jZzUx1ncSA0PNscj/miVC396DdqYSA8zUzaX3xfZyeZ HhEi95yVs+swk+JwjMp+mjP0HE4MOWSa6SYXWq8tmWABup7gQ7NeizrKhR02trc/2OEs Tn1rxyvOR1VVDI4wTJgRbIEs2ALWpfSVOOHaIjhPvlMnMpv/pxAUJPO8M5K0+OLSFJiK 2EVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s28si1934536edc.202.2020.05.18.10.07.16; Mon, 18 May 2020 10:07:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbgERRFj (ORCPT + 99 others); Mon, 18 May 2020 13:05:39 -0400 Received: from fieber.vanmierlo.com ([84.243.197.177]:48456 "EHLO kerio9.vanmierlo.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726958AbgERRFi (ORCPT ); Mon, 18 May 2020 13:05:38 -0400 X-Footer: dmFubWllcmxvLmNvbQ== Received: from roundcube.vanmierlo.com ([192.168.37.37]) (authenticated user m.brock@vanmierlo.com) by kerio9.vanmierlo.com (Kerio Connect 9.2.12 patch 1) with ESMTPA; Mon, 18 May 2020 19:05:11 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 18 May 2020 19:05:11 +0200 From: Maarten Brock To: Andy Shevchenko Cc: Lukas Wunner , Heiko Stuebner , gregkh@linuxfoundation.org, jslaby@suse.com, matwey.kornilov@gmail.com, giulio.benetti@micronovasrl.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, christoph.muellner@theobroma-systems.com, Heiko Stuebner , linux-serial-owner@vger.kernel.org Subject: Re: [PATCH v3 3/5] serial: 8250: Support separate rs485 rx-enable GPIO In-Reply-To: <20200518163522.GK1634618@smile.fi.intel.com> References: <20200517215610.2131618-1-heiko@sntech.de> <20200517215610.2131618-4-heiko@sntech.de> <20200518151241.GG1634618@smile.fi.intel.com> <20200518152247.slenjeiiplps7mcd@wunner.de> <33547f6a596df2ca2ee8e647111e5fa1@vanmierlo.com> <20200518163522.GK1634618@smile.fi.intel.com> Message-ID: X-Sender: m.brock@vanmierlo.com User-Agent: Roundcube Webmail/1.3.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-18 18:35, Andy Shevchenko wrote: > On Mon, May 18, 2020 at 06:13:16PM +0200, Maarten Brock wrote: >> On 2020-05-18 17:22, Lukas Wunner wrote: >> > On Mon, May 18, 2020 at 06:12:41PM +0300, Andy Shevchenko wrote: >> > > On Sun, May 17, 2020 at 11:56:08PM +0200, Heiko Stuebner wrote: >> > > > From: Heiko Stuebner >> > > > >> > > > The RE signal is used to control the duplex mode of transmissions, >> > > > aka receiving data while sending in full duplex mode, while stopping >> > > > receiving data in half-duplex mode. >> > > > >> > > > On a number of boards the !RE signal is tied to ground so reception >> > > > is always enabled except if the UART allows disabling the receiver. >> > > > This can be taken advantage of to implement half-duplex mode - like >> > > > done on 8250_bcm2835aux. >> > > > >> > > > Another solution is to tie !RE to RTS always forcing half-duplex mode. >> > > > >> > > > And finally there is the option to control the RE signal separately, >> > > > like done here by introducing a new rs485-specific gpio that can be >> > > > set depending on the RX_DURING_TX setting in the common em485 callbacks. >> > > >> > > ... >> > > >> > > > + port->rs485_re_gpio = devm_gpiod_get_optional(dev, "rs485-rx-enable", >> > > > + GPIOD_OUT_HIGH); >> > > >> > > While reviewing some other patch I realized that people are missing >> > > the >> > > point of these GPIO flags when pin is declared to be output. >> > > >> > > HIGH here means "asserted" (consider active-high vs. active-low in >> > > general). Is that the intention here? >> > > >> > > Lukas, same question to your patch. >> > >> > Yes. "High", i.e. asserted, means "termination enabled" in the case of >> > my patch and "receiver enabled" in the case of Heiko's patch. >> >> But "High" on a gpio would disable the receiver when connected to !RE. > > No, that's exactly the point of the terminology (asserted means active > whatever > polarity it is). You need to define active-low in GPIO description. Is there anything wrong with defining GPIOD_OUT_ACTIVE or GPIOD_OUT_ASSERTED for this very purpose? May I suggest to deprecate GPIOD_OUT_HIGH and replace it? Maarten