Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp692561ybh; Wed, 18 Mar 2020 07:28:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs7xzUP16yMkyCTT55HPLnwJEw2PnZj+Dzacp+tOH/JmfUW8wqMh98OODdQm+ZUjkQNrNHn X-Received: by 2002:a9d:7607:: with SMTP id k7mr4002703otl.205.1584541686225; Wed, 18 Mar 2020 07:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584541686; cv=none; d=google.com; s=arc-20160816; b=lgOll8EJB8C3YuFpkXDNZuU3jwXo++I6JQYcRDJ2w7H8DutkoHA6zAY3CQ3nQ7tS7Z mjB6cKo0N0KXrzLa/dRl37gYyK7uDRCPCf6/NJcDDGsNpTWapgG9//4wi8wQNtN9EAcU cYcD4uIYDSWHHi7vtSOWtvXuhzABaj4zWu9XvPG8XUzZt98axYGPFGW0hC/zseJRZwCC /Kw6WGmCsS1OW33JSGkLf1tFuEyh3mAiVpP8RlQUC0W+k2E+vMFC0CWU8uMOyKlKtWtm oHB1MGxubvec3xaux3BHmYVrZdDxZEo3ibyObdKRoUTLveKTxWpJFsTl0ffa03MvGOMi YbMw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=z8nDzoUvxT6jKQFLwsXnpMiQoq92XB1r7VAzN4bpuco=; b=lIb+JPqllVWFbnIRsBHXnOdDchJ1arRgquWEysMqi/DdnRZdvKrcCnn4kQfqROug2M oefHBbyPdpicKc6UpTsAdkqx3y0uoImWeFqY+a9woSu1tVXspHQ5Wyl6/HjztBjs/pHf afHX9FsR0wSL+ulhl8yDDwHqRc1+gJIyv8Gl9//91DdgD9za9CGi4Ak05P0KgDqaIuAH sX3ODd4kSv4I1KQ8rp3mzGuDmpsEJpMnZek5EuL7xt1wtETOXPO9Qj/lI1tMz0eqJaYA Roz1zO5Za+clgveb/41coHn0Q/305bCe+CFwV8rVjsQ0noNvudYoVO3fnRST0f/b1U4a bFAA== 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 v1si3726111otn.249.2020.03.18.07.27.54; Wed, 18 Mar 2020 07:28:06 -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 S1727102AbgCRO1B (ORCPT + 99 others); Wed, 18 Mar 2020 10:27:01 -0400 Received: from gloria.sntech.de ([185.11.138.130]:37356 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbgCRO1A (ORCPT ); Wed, 18 Mar 2020 10:27:00 -0400 Received: from [94.134.91.63] (helo=phil.fritz.box) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jEZen-0004YX-Ay; Wed, 18 Mar 2020 15:26:53 +0100 From: Heiko Stuebner To: gregkh@linuxfoundation.org Cc: jslaby@suse.com, andriy.shevchenko@linux.intel.com, matwey.kornilov@gmail.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, heiko@sntech.de, Giulio Benetti , Heiko Stuebner Subject: [PATCH 1/7] serial: 8250: Make em485_rts_after_send() set mctrl according to rts state. Date: Wed, 18 Mar 2020 15:26:34 +0100 Message-Id: <20200318142640.982763-2-heiko@sntech.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200318142640.982763-1-heiko@sntech.de> References: <20200318142640.982763-1-heiko@sntech.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Giulio Benetti 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. Signed-off-by: Giulio Benetti Signed-off-by: Heiko Stuebner --- 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 8407166610ce..67aa3a2a9afa 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -565,10 +565,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); } -- 2.24.1