Received: by 10.192.165.156 with SMTP id m28csp1323054imm; Wed, 18 Apr 2018 07:56:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx49SrnK0kXWpHzt1LW1PkreXdZ6RnZzTefEDOENe1c3rkC+ex//4pf6nyn8Ci3VvowGEJQj5 X-Received: by 10.98.8.133 with SMTP id 5mr2314437pfi.154.1524063389758; Wed, 18 Apr 2018 07:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524063389; cv=none; d=google.com; s=arc-20160816; b=EC7q//ZXTaKzRWkbCyroMmNBcBnsPo2pyw0dcxDB3jBM1pf8PdxpcCBvna9kzRhPC7 nRbC1MLN5VEApyjeL4H1WfsHndV3ReSgCOClq/YYtAqGDU59oPnprLEvyWLcO6u069ro kFvVb89lSA0TUqYnDMFzjYipTuxbn6NNLfzajgPhcKEVEdqnIKVwPHyoLpAXu8LKLM8I 7Ugv3GjMQYyQf1+dvGsBEw0ZX9EwTPEd1UzKbWEjGF7kHDE6bWRDvs3DWqSRleTw0Kw1 BhiJnxhYmWaiilcMyu0vicr6FvOmSze+UpZt65NaS6hvRzhOHHkIJU6fKdle0TfhdAQK 59Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=TvQn2Xg24oAAS1GAcl0BL2EmNoAeiVJGRyoubjA3i1c=; b=mvGTAW8xfdyprgdeP25qqLWjnQo9IVQLhPhmDNxhUbgsTqpfl9+CqehnAqeGIG6zlR mxY5W7Nlqjww89EUjpmUgRG6cP3VPaahRWyXEIF5gzpX/9qwuxjhlsMTdWtQ1UfWC/bw cX4pM84kvwyUNYjWcMt0CFqKdwz6IUhB8QP6J5H7FKvD/HhUKE7EuYvBioaRB9ZCzRfi LKwMVilKBPxDVlNItbr5DvIL+9JXPXtPmTOZYvLac/ulgIe4dLz1NsF/TBoNBLyt1w7I mjg2Vi6QLWUTjMGpjOowRfpBZ9mAyA7z2g+dtBF8N/aTke+1kkclA3KmsFbx6Q3+eC04 l/7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si1173268pgo.96.2018.04.18.07.56.15; Wed, 18 Apr 2018 07:56:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753211AbeDROxt (ORCPT + 99 others); Wed, 18 Apr 2018 10:53:49 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:58795 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbeDROxr (ORCPT ); Wed, 18 Apr 2018 10:53:47 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8oSt-00081c-SZ; Wed, 18 Apr 2018 16:53:43 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1f8oSs-0001Ha-0S; Wed, 18 Apr 2018 16:53:42 +0200 Date: Wed, 18 Apr 2018 16:53:41 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Stefan Agner Cc: gregkh@linuxfoundation.org, lukas@wunner.de, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] serial: imx: warn user when using unsupported configuration Message-ID: <20180418145341.xwsah7spyfazcb63@pengutronix.de> References: <20180418140638.19331-1-stefan@agner.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180418140638.19331-1-stefan@agner.ch> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 04:06:38PM +0200, Stefan Agner wrote: > When using half-duplex mode (which disables receiver during txing) > the RTS signal cannot be driven low during transmission. This seems > to be a limitation of the i.MX UART IP: The RTS (CTS_B) signal is > controlled by the receiver. When the receiver is disabled, the > signal stays in UART logic idle state which is high... > > If SER_RS485_RTS_ON_SEND is used, RTS needs to be high active during > transmission. Since this is the default state of the RTS (CTS_B) > signal when the receiver is off, half-duplex mode in this > configuration works fine. > > However, a low-active RTS signal (flag SER_RS485_RTS_ON_SEND not set) > cannot be generated when the receiver is turned off. > > Print an error if the user selects this unsupported configuration > (both SER_RS485_RTS_ON_SEND and SER_RS485_RX_DURING_TX unset) and > configure the closest working configuration (set the > SER_RS485_RX_DURING_TX flag). > > Signed-off-by: Stefan Agner > --- > Changes since v1: > - Consistently check for sport->have_rtscts && !(rs485conf->flags & > SER_RS485_RTS_ON_SEND) > - Don't break printed message > > drivers/tty/serial/imx.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 91f3a1a5cb7f..1c1080fc8084 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1833,6 +1833,11 @@ static int imx_uart_rs485_config(struct uart_port *port, > rs485conf->flags &= ~SER_RS485_ENABLED; > > if (rs485conf->flags & SER_RS485_ENABLED) { > + /* Enable receiver if low-active RTS signal is requested */ > + if (sport->have_rtscts && > + !(rs485conf->flags & SER_RS485_RTS_ON_SEND)) > + rs485conf->flags |= SER_RS485_RX_DURING_TX; > + I wonder what should happen, if the device tree has both uart-has-rtscts; rts-gpios = <...>; . I think the right thing would be to check for sport->have_rtscts && !sport->have_rtsgpio . Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |