Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp546083imm; Fri, 1 Jun 2018 05:42:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIkqf3kyYlsfK2HbJ9WEVD3GOpJHUMcWS/VsMwya7V4+QkbQlf6SxbG/oDyRxEe8IugWtqE X-Received: by 2002:a17:902:26a:: with SMTP id 97-v6mr11160861plc.367.1527856951081; Fri, 01 Jun 2018 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527856951; cv=none; d=google.com; s=arc-20160816; b=gEtXaSx1QDFnww2fqEDymjYrI+o1UF5+tYG5OfPhJF/JdugjfFPDD8WYVe8jIen6qD +4fuq2WvUElQaRZAgJ55A/czL5Xn9H5u/gFs2rXidfmhhyxG9665E9FZcriKixaeB1Sc gBjs1RN33gUu7c7Uy8DWhWPkMmzRV6YAvEyEmUc2A1RjNxn3OcqbaI8GAfyPcFL6nzEk 1j1T4yAm7Oyqu0x4yYI/tkTv577N15VQ6/JKjWpwUQPcbQU9Ct4kne4gMDMR/ECL/NEp B+6zFdik4VGZl6IfWvJnrM/AeIIgUU5QQcSq0WcPWenWLfQiDVVCh6xiEc4b2Rl+Q1Ol kTHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=wVJWSeMWnGZNvgoR3bBVQ6DCRmllGORBik+KE34gTIU=; b=i2eXvFlgz5Pqr47q4ipJygjnZpxmKinc2T0L2Ux+cyseORpzeH/PlBblz0Va4PNVa1 6qUtaSYzFA29d0UAu24TfTJMln9tHoxThtSpJ6RzlsZh/TrWo1PDrLo9+kMjwbxkDdpa Bj3Drm553vZwlrgfDSOI7bOVIr5UlrnP0xhSJlsk1RwMm2bBbVzZeY/jeBGWAM+FCR+J lW8qvUi31ag9i5b2Zhx0xILUcsnunfhelWfLxLehysQ+JfGi365OEU2gu0mcSrLs2Uat btLpa9bY6kUt7pQZ0zSVAjf/95OkYZPN9UCfcl5ROEpJjFmE4jV4gwYMVQltOPBet72q 0FLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=Dg1Rtu/m; 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 f9-v6si37283238plo.568.2018.06.01.05.42.16; Fri, 01 Jun 2018 05:42:31 -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; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=Dg1Rtu/m; 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 S1752509AbeFAMlT (ORCPT + 99 others); Fri, 1 Jun 2018 08:41:19 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:39368 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbeFAMkv (ORCPT ); Fri, 1 Jun 2018 08:40:51 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id CD8A9B009B7 for ; Fri, 1 Jun 2018 14:40:49 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1527856849; x=1528720850; bh=Nc rSqhjPIXQRlmRxtzOCQ/eR+21bRSelikZYCyjFYIA=; b=Dg1Rtu/mrXb2ThrxKd oSqaieWXSHgtG3C+xZPrVpaKkwISBZ/pWZCSE+nlVJbfqjGrGzHwSjlU90Umo1k2 f06mJj3PrlcoDPkhJCNYnjMn+V12dY7jMEIkB2uqvCnjMpZ1ZuHazHxgW8sG2G66 1MhtAq1Dr17ED2v9O8IETAgzI= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AkrqSGRApYf2 for ; Fri, 1 Jun 2018 14:40:49 +0200 (CEST) Received: from localhost.localdomain (unknown [87.18.119.93]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 7844DB0076B; Fri, 1 Jun 2018 14:40:37 +0200 (CEST) From: Giulio Benetti To: Greg Kroah-Hartman Cc: Jiri Slaby , Andy Shevchenko , Kees Cook , Matthias Brugger , Allen Pais , Sean Young , Ed Blake , Stefan Potyra , Philipp Zabel , Joshua Scott , Vignesh R , Rolf Evers-Fischer , Aaron Sierra , Rafael Gago , Joel Stanley , Sean Wang , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Giulio Benetti Subject: [PATCH 7/8] serial: 8250: Make em485_rts_after_send() set mctrl according to rts state. Date: Fri, 1 Jun 2018 14:40:20 +0200 Message-Id: <20180601124021.102970-8-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601124021.102970-1-giulio.benetti@micronovasrl.com> References: <20180601124021.102970-1-giulio.benetti@micronovasrl.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 e14badbbf181..8432445c80e5 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); } -- 2.17.0