From patchwork Mon Jul 22 09:22:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11051859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E25E86C5 for ; Mon, 22 Jul 2019 09:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0C982847B for ; Mon, 22 Jul 2019 09:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C44D228514; Mon, 22 Jul 2019 09:22:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 793BD2847B for ; Mon, 22 Jul 2019 09:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e5XhvBnw41vUtMTfGIbHGWuMocEBQYfkWmb7uRCkh3Q=; b=laZij/27swJ6Rh QpVQdizKwtBbGxBJBHUGxyxuY9FAb9vdDLajx0mfS1Tx02AeC2m/mLWd+op8Avi898M74j9C9OhG5 wUg92skigEAJuFxsh4i9gUrVcAjGFFuaRNJZUoPPw7ZG7KS1nZ2MXebxbpJPYhODLGzmPfLvicB23 JT0CgdLFD6tMm31UBrfExplVm84TcReq3+5qpl3FwzEQsIl3VIEuSvn/DreLdI+E0WRlGxmv8ZbxX zJOWAUM8QN72cin16ro1XDTv9szEqAATSOf2JTN4Q0vrDjQNFb4ZHACEBcXjC00aTXNd03AW1wFOJ AqIG+qH/il4s77WpAPtA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpUWq-0006BB-NE; Mon, 22 Jul 2019 09:22:44 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpUWU-0005Vg-NB for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 09:22:23 +0000 Received: by mail-lf1-x143.google.com with SMTP id v85so26060376lfa.6 for ; Mon, 22 Jul 2019 02:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3RZDKKssLiiM+ZqD6fvBMB3Dv9xagAFFHDgU43w8ol0=; b=aGw/F/VEZpVAJBDXyA75DL9/4pmrXg1U0JBqRqa3ALjH/myv8cOn4ugMqpL7e/ZPXs ZiY1/gZeGfa9UsTNPTKIzZ3yaTKiz3r9eDMJeT6GHtiKdFQ7AkUleGJvItnxkUlEMuD0 PfbV4HfStoCpoIo1U860aONjccYvVTdwpKMuzOpuELuzlK3Xh7rgJwDUWEALsPdzw2CO 6czjWGE8ZaoYOoVrOIJASFfsE0BSnzQUbfS6LeIFIp2CEFMH22b5sq0zI9NCCrqCoueL Rwz9rJbLnpBuFdxmGjw6V+NOq6qNV0UIjG0IK1dwcmZLbaZ9qrHmM2ZcUV6PaRrG5Hoz WkzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3RZDKKssLiiM+ZqD6fvBMB3Dv9xagAFFHDgU43w8ol0=; b=LqWcKq+52RHCfgEPk/3cGHkfC0PJrjMN7uOW6aZyOXF+MU3Cxe/Cn4JzyL8Lezrvkj T0EptV2uTB/9cFVXq8kvRY8ieDhZpMTPogRMr3969tBYscQWSdbi+cALr2FH9YFSNOWe 6oUOsyKju4JIh0Fo//FT8VH1GQ99Gpy3QDTliXqjyUtTmGovBRXYj2mEIzipRPUYbdnh EsaSEsp+KKqoS0qFuiZ2NEaGZZBHZw6PEexu56KAibUpir4QiIKUdkWRAIU1OhiinhKx jwT1siYomfrFVitIFMQA2u7ETfF7PvZwodLQXRqHvbHiR8WWwOCJt0nomjjrHz+SYt/5 fkXQ== X-Gm-Message-State: APjAAAXItjrhqjsIy6ZA1BI37GGqaOn2O/bjM51Bn6s7HyJQgEArac4l oz2ArOG26CoahDSYBYmi2qI= X-Google-Smtp-Source: APXvYqzmUDHMeFgXh0O8Zqk1fIKHJ+x0b+A0DiTtGNBtTJNdwDOGg12otmwhbua1bXOTSDzyum6ZbQ== X-Received: by 2002:ac2:514f:: with SMTP id q15mr31871139lfd.145.1563787341071; Mon, 22 Jul 2019 02:22:21 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id b68sm8425088ljb.0.2019.07.22.02.22.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 02:22:20 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v5 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Date: Mon, 22 Jul 2019 12:22:08 +0300 Message-Id: <1563787330-1394-2-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563787330-1394-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563787330-1394-1-git-send-email-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_022222_756608_DECD3A35 X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Sascha Hauer , Sergey Organov , NXP Linux Team , Pengutronix Kernel Team , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Don't let receiver hardware automatically control RTS output if it was requested to be inactive. To ensure this, set_termios() shouldn't set UCR2_CTSC bit if UCR2_CTS (=TIOCM_RTS) is cleared. Added corresponding check in imx_uart_rts_auto() to fix this. Reviewed-by: Uwe Kleine-König Reviewed-by: Sascha Hauer Tested-by: Sascha Hauer Signed-off-by: Sergey Organov Acked-by: without the other person being able to actually see the --- drivers/tty/serial/imx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 57d6e6b..32f36d8 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -405,7 +405,12 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2) /* called with port.lock taken and irqs caller dependent */ static void imx_uart_rts_auto(struct imx_port *sport, u32 *ucr2) { - *ucr2 |= UCR2_CTSC; + /* + * Only let receiver control RTS output if we were not requested to have + * RTS inactive (which then should take precedence). + */ + if (*ucr2 & UCR2_CTS) + *ucr2 |= UCR2_CTSC; } /* called with port.lock taken and irqs off */ From patchwork Mon Jul 22 09:22:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11051861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B19286C5 for ; Mon, 22 Jul 2019 09:23:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A00F82847B for ; Mon, 22 Jul 2019 09:23:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9387428595; Mon, 22 Jul 2019 09:23:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 288352847B for ; Mon, 22 Jul 2019 09:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mQQJrY3As+NeBsrD0/S6kY7ui++8QCsGA8daaxGustw=; b=j8aDTyW/y+V4gd ZI33PihY3waLcbBoGtR9xy9YF3GWroXeo9HVwkPgOy1QdWw3g36RUGMRHaitlEnUdu2YMXmx4qo6i 0lMQhGH9DtGc2dJicTQNjF85/UYPUntdU/XS7qYJ9CHtYlW6Q7KzpDzuo5fpK8QSprhgtXmSYxSNQ Yrn1Q2a86SS0+kpME9jjcvk7YkJXXTbM9E9wdSj6G3tXWv91RA8M6SKF+tPV01ryvJjf5zTvFlc/B NCQRHafACkPAX5uVG3OZ/f4OlHBFv6/tg/OTDsYGzqDT/LCD/pR+8FyWz82db8vsqI3OA+Wlp+a6s 5ZpfmXIwxXwlJbi9KlkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpUXI-0006yM-8j; Mon, 22 Jul 2019 09:23:12 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpUWV-0005Z0-M6 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 09:22:25 +0000 Received: by mail-lj1-x241.google.com with SMTP id v18so36837390ljh.6 for ; Mon, 22 Jul 2019 02:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HA2f/ifCDrGNgMEk+3HGOD0y69BKIfJxvyiY4pBfCgE=; b=rkiUfHF7VO9LHPZzsQsdyww5l9RzJLCGBPEXFixUlamFHpcZviC1GyG+PGFCV1kfV5 2pw/X06gPcEtd2xBNg4sYqs6Galcx91JalyNsJXvnA0cyf2tmcWAy+OaHTEnTrHKAp81 UQmhlLZ03gKxTuSeE0Sg7s3/Wd9ugLfkJfc+MXWEo+d9e7s+h5872OBuSF57/+BjrXVt QYdVjb67iC0uqfvACfS/8hHNPJou1yuRG3SoM6UOSqqyG3EKll/rUuGa2YOEKyGoUAyv XVE+cTY7SdA2AkRVY+1O22dRjkAcB21FJ8OfqjiR1bQ1ofYDvag8nYU3hy5gRLYOgKKg yZxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HA2f/ifCDrGNgMEk+3HGOD0y69BKIfJxvyiY4pBfCgE=; b=V8ntcaF2IwZesdSPT7p23m1XgF41MrIh/4ShhYtBqsGIqsRaIAkphzeDaFSH6L3z/h 2D5TjgCAhnNAycAXv4v/1lMgFUtf0Iqwv4DHbZwF6a3+HYIYoCB+k65nTM+3oUP+6J+D O0MABZ6X1woT+V/2Ouw1B2f7jKItXB/2BT25IElLjO8oGbUEU54WFjZGDd7yfJYp7dIa Z06AUSvzXiEfrwFPa9/tdvKI1Z4O3O379TCy92r7/6wadOirQNOkuwY/oXIZCfxr/xNl bYa/BQsMSx4Lp3eeHTxxoL0fFJMCoEEDFDYpgKqPQrp7M1SAVYNsLnoDtmKf3dKB/3Pk I4zw== X-Gm-Message-State: APjAAAU2jKXQlWDckB78XipMwsrq9Y7QIlqPtEUgmyqIbG4VTyOVma0/ vDogs4tTh80TlwTvkxg+Rd4= X-Google-Smtp-Source: APXvYqwHAC3dvb2De+mxHlgp8DFhqzN74V36dBGcVrQ3LpNHmBSOnGLfnvFLH5JXbGLQHaiAKsyRTQ== X-Received: by 2002:a2e:8007:: with SMTP id j7mr35899636ljg.191.1563787341958; Mon, 22 Jul 2019 02:22:21 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id b68sm8425088ljb.0.2019.07.22.02.22.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 02:22:21 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v5 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Date: Mon, 22 Jul 2019 12:22:09 +0300 Message-Id: <1563787330-1394-3-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563787330-1394-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563787330-1394-1-git-send-email-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_022223_723833_1C771588 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Sascha Hauer , Sergey Organov , NXP Linux Team , Pengutronix Kernel Team , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP imx_uart_set_mctrl() happened to set UCR2_CTSC bit whenever TIOCM_RTS was set, no matter if RTS/CTS handshake is enabled or not. Now fixed by turning handshake on only when CRTSCTS bit for the port is set. Reviewed-by: Uwe Kleine-König Reviewed-by: Sascha Hauer Tested-by: Sascha Hauer Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 32f36d8..059ba35 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -974,10 +974,22 @@ static void imx_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) if (!(port->rs485.flags & SER_RS485_ENABLED)) { u32 ucr2; + /* + * Turn off autoRTS if RTS is lowered and restore autoRTS + * setting if RTS is raised. + */ ucr2 = imx_uart_readl(sport, UCR2); ucr2 &= ~(UCR2_CTS | UCR2_CTSC); - if (mctrl & TIOCM_RTS) - ucr2 |= UCR2_CTS | UCR2_CTSC; + if (mctrl & TIOCM_RTS) { + ucr2 |= UCR2_CTS; + /* + * UCR2_IRTS is unset if and only if the port is + * configured for CRTSCTS, so we use inverted UCR2_IRTS + * to get the state to restore to. + */ + if (!(ucr2 & UCR2_IRTS)) + ucr2 |= UCR2_CTSC; + } imx_uart_writel(sport, ucr2, UCR2); } From patchwork Mon Jul 22 09:22:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11051863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 919C5138D for ; Mon, 22 Jul 2019 09:23:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D2F92847B for ; Mon, 22 Jul 2019 09:23:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DAA228595; Mon, 22 Jul 2019 09:23:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 114682847B for ; Mon, 22 Jul 2019 09:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=miiA8R59lprX7/ohCvUsF+h8TkvFiPXnx7/k8W3wWXM=; b=egbgzWqH6zeOLE mpAfN7O+1ulxYTetIDWp7jgC4Lh7dYSej72Vqt1tbidboObXrtP+aD42EmB+vCOTTLAh5qIjhPCsx V0/TTt5uSATBlr/io6CKhWFymzWYNnryDAZaoJM+94AU1B2JOZ7n35qRPophcAhMKnHQ3qadsotHK ZiNJxcMR7zstFZEn3tSrq8n/Za/8svfSYlPflCCl5hr0Sc1dHShKX3VrW0bmHQ+z8PQl6Gqigb+zk n26WruhfQDmLZaNjEqAySagfi33nZmimG5hnky40IR6cZOyt8yOgJ0nEFF5816cwQNz+9n9HwtxHu JM0jRpQYSe7TMm5iBMRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpUXZ-0007jB-R4; Mon, 22 Jul 2019 09:23:29 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpUWW-0005bE-1g for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 09:22:25 +0000 Received: by mail-lj1-x241.google.com with SMTP id h10so36893940ljg.0 for ; Mon, 22 Jul 2019 02:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AB9Uhy9tvuGFyl7GXO1etpCNViYG1ibv00O/NXtQ8qI=; b=sfVmdXLMToo060hTaOQKGSekZo/nQgI+rUVXwxbsl1zWdeT8Ou8wZ2DSd0Toat2wvE OY1ig9BZzEetVuVQGSORIFmmHnPUwFm7cQFl1YXb3YIvN3sfr25StiCPz4e0OpVN4UhN AIPqCCFbyocLbejYqn4Dmhxpd8r9m+llxm+qMTYzq++NXuTisw6SfkSNDajoA1gsKMK9 vkU9B5j3VTR04W7+JApSihLVrQc4YUwovUGv7R5RlXmhR3qsaxEVGlp7kCQu1vJ6KyR7 /dBYolSHWgX619+nxe0XGcpy6BOilJ54y/PPKBuB1LSWcJQQOPB0vmnEQbemPsAIihf4 LIdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AB9Uhy9tvuGFyl7GXO1etpCNViYG1ibv00O/NXtQ8qI=; b=WMkEj6Ap8+l0le6ZLj2Uol7THiAv/UtjFf7OT0/Vuf2cp14VpYCsNCHSiMnM2u8ViE cBKkz1B9Xttuj8szFRDkNhP886BKhlCJJ4kZiYd+F+Gni5pT1jhIcey9XMv3W45zNUOR dE5m1F8pgHOFFjTuYxOa8WO0eG3oqmwDo7m3pLiCKoP6RfnrzytVwrr+gCjwgBaieRTU wx96jkLD9+zba83AH1Zgtc+LrdU/qNlqvsaUPxrfuf/tNpYUaXWvfTcggi/0X5T6HQZa yQzmhU+slsvfiuyQ0KDFg3ASpOfC+p3bP5Z0MOct37tYlbC58I9WEahdR81A3PTZtjst AREQ== X-Gm-Message-State: APjAAAVgSt0FoGnmRVGxCYzpnq7CVjVW1xyFVjq1FojNPYjI88ZtCOkV ypNLGNK7zGWSrZYOnXqqYHg= X-Google-Smtp-Source: APXvYqxWQrMDT2vKFWjVmiipEuXJG5cCZHpd/xcTl4RwYawjhu07ztS2G7AVcrSV4iEL+yeypBPnlQ== X-Received: by 2002:a2e:9a19:: with SMTP id o25mr35933375lji.63.1563787342756; Mon, 22 Jul 2019 02:22:22 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id b68sm8425088ljb.0.2019.07.22.02.22.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 02:22:22 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v5 3/3] serial: imx: get rid of imx_uart_rts_auto() Date: Mon, 22 Jul 2019 12:22:10 +0300 Message-Id: <1563787330-1394-4-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563787330-1394-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563787330-1394-1-git-send-email-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_022224_115919_0F65F10A X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Sascha Hauer , Sergey Organov , NXP Linux Team , Pengutronix Kernel Team , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Called in only one place, for RS232, it only obscures things, as it doesn't go well with 2 similar named functions, imx_uart_rts_inactive() and imx_uart_rts_active(), that both are RS485-specific. Reviewed-by: Uwe Kleine-König Reviewed-by: Sascha Hauer Tested-by: Sascha Hauer Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 059ba35..d9a73c7 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -402,17 +402,6 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2) mctrl_gpio_set(sport->gpios, sport->port.mctrl); } -/* called with port.lock taken and irqs caller dependent */ -static void imx_uart_rts_auto(struct imx_port *sport, u32 *ucr2) -{ - /* - * Only let receiver control RTS output if we were not requested to have - * RTS inactive (which then should take precedence). - */ - if (*ucr2 & UCR2_CTS) - *ucr2 |= UCR2_CTSC; -} - /* called with port.lock taken and irqs off */ static void imx_uart_start_rx(struct uart_port *port) { @@ -1604,8 +1593,14 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, else imx_uart_rts_inactive(sport, &ucr2); - } else if (termios->c_cflag & CRTSCTS) - imx_uart_rts_auto(sport, &ucr2); + } else if (termios->c_cflag & CRTSCTS) { + /* + * Only let receiver control RTS output if we were not requested + * to have RTS inactive (which then should take precedence). + */ + if (ucr2 & UCR2_CTS) + ucr2 |= UCR2_CTSC; + } if (termios->c_cflag & CRTSCTS) ucr2 &= ~UCR2_IRTS;