Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp719442imm; Wed, 6 Jun 2018 05:05:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKc/O23i99EokTa1cAkz9w/fLzJITYaQAhRySFAgsTDOFS6+mSWg0FXQDtk6ibTPZp2+mnJ X-Received: by 2002:a62:1411:: with SMTP id 17-v6mr2197417pfu.3.1528286710044; Wed, 06 Jun 2018 05:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528286710; cv=none; d=google.com; s=arc-20160816; b=EkLVHllYGgejrdhTnT7GE2Lx/tiD4Umq8pMeA1imDlPq925FxSB6Z/PVr6nizHaKdc rbcC7LsvthApBcHdJXorA7WVMYRkjEZJYC26VuiMhdwrtdtCCxqam0+HIiDmU2MkNcUT AbjQ5m52wML58T3hELEfTLKvlPapkPMsPOlmXeFOdxm+5z7jrHre9qUqFb4DxnST4KRP 6Z48kPbiuNS9cALF11gxwQw9CK9PiOj2uiiEM3/vUGTQwbtSZ56ReQ7zRmzZGNYz9YTj eo4amtZ95DTo5RkUWwwFXt1GZYO+B6NOa0o3/XOA9ZSJAm2EjGQjOAa8BDivKICs7Ut2 mrlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=6ZyWr+HbfOXE8bROK8zwQg2vRi+ExTlUAdiJKMZ/3yw=; b=Ff1+DZxNk5pG0Q8urGQqQT1vfUDRdqFo3t42xPa0wL6J/1IdLZBzWZBKcOMy5MNr1c /JBO042RFa7AIcoszJW7lXHGDcXYo9aYxRg8G76Szt6AUzBqlousJS2lGbZGuZw/dXQB 7jiX7DSHkPfCgAnVWmy2/ofJFsEjX+Q30cVRWGVynXX2pyELQ8osyc2VG3CcG+wNmHuH 3l8LjIdI13yJbXo8jUgMsmuY2sCHIvj/ApcfY25L6tqHlopIofYRADRdwwt0YCsAzqdZ 6icuhE8vzWVjl6b2yA4RQjAmIajxE6mT9iuJU8qBwFEFxb8I8yYf70Ig6kUPA9ktmNoQ V4Tg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g63-v6si22425755pfk.74.2018.06.06.05.04.53; Wed, 06 Jun 2018 05:05:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752006AbeFFMCs (ORCPT + 99 others); Wed, 6 Jun 2018 08:02:48 -0400 Received: from mga09.intel.com ([134.134.136.24]:7585 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeFFMCr (ORCPT ); Wed, 6 Jun 2018 08:02:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2018 05:02:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,483,1520924400"; d="scan'208";a="230368535" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga005.jf.intel.com with ESMTP; 06 Jun 2018 05:02:43 -0700 Message-ID: Subject: Re: [PATCH 3/4] serial: 8250: Make em485_rts_after_send() set mctrl according to rts state. From: Andy Shevchenko To: Giulio Benetti Cc: matwey.kornilov@gmail.com, Greg Kroah-Hartman , Jiri Slaby , Matthias Brugger , Kees Cook , Sean Young , Aaron Sierra , Tomas Melin , Sean Wang , Rafael Gago , Joel Stanley , "open list:SERIAL DRIVERS" , open list Date: Wed, 06 Jun 2018 15:02:42 +0300 In-Reply-To: <20180606094942.71190-2-giulio.benetti@micronovasrl.com> References: <20180606094942.71190-1-giulio.benetti@micronovasrl.com> <20180606094942.71190-2-giulio.benetti@micronovasrl.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-06-06 at 11:49 +0200, Giulio Benetti wrote: > When rs485 enabled and RTS_AFTER_SEND set on startup, need to preserve > mctrl status, because later functions will call set_mctrl passing > port->mctrl=0 overriding rts status, resulting in rts pin in > transmission when idle. > > Make mctrl reflect rts pin state. > This might make sense, I leave it to Matwey to Ack / NAK / etc. But it also feels that patch 2/4 should be part of this change. > Signed-off-by: Giulio Benetti > --- > drivers/tty/serial/8250/8250_port.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_port.c > b/drivers/tty/serial/8250/8250_port.c > index 95833cbc4338..c8c10b5ec6d6 100644 > --- a/drivers/tty/serial/8250/8250_port.c > +++ b/drivers/tty/serial/8250/8250_port.c > @@ -562,10 +562,13 @@ static inline void > serial8250_em485_rts_after_send(struct uart_8250_port *p) > { > unsigned char mcr = serial8250_in_MCR(p); > > - if (p->port.rs485.flags & SER_RS485_RTS_AFTER_SEND) > + if (p->port.rs485.flags & SER_RS485_RTS_AFTER_SEND) { > mcr |= UART_MCR_RTS; > - else > + p->port.mctrl |= TIOCM_RTS; > + } else { > mcr &= ~UART_MCR_RTS; > + p->port.mctrl &= ~TIOCM_RTS; > + } > serial8250_out_MCR(p, mcr); > } > -- Andy Shevchenko Intel Finland Oy