From patchwork Mon Jul 22 19: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: 11053339 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 E6F21112C for ; Mon, 22 Jul 2019 19:23:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5ACA2837D for ; Mon, 22 Jul 2019 19:23:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C684D28508; Mon, 22 Jul 2019 19:23:40 +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 6C85E2837D for ; Mon, 22 Jul 2019 19:23:40 +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=gX1Yyum/i/Qducu09C1+bgn3Kwq/3qskhs6eOZh4erQ=; b=ebbQFJHvoK+j0U hSUkmv0QvSkrlySp7+yJt1Hf/VWOamzVXkIMFyJoWIyMqD8WK54UFxlD2xJWPLvhA7IJKgpZqZ4TI vyOFJEogELy+5NraGVrbIXoz7Ok7VetUQHEpk12MBQIfqnEeLIKIX2eRlKclsGqmI7yfP5d1zFpq+ kQ4N2BjZj9aVLnZnVEBBDnGJETwMF3obI8tZWRtCGlVs64LB92iYfARZf6RWv89LItTIeqAXTJ78Y XfX09yXuSIDQ0RpBmMK3Eq0bysSRun+i0jCJNKBchM4l0HlEXH5q3SVt4t46WmdLkk3/OpSZMy/PU dUe6NFjcjJRyyTj58kNQ==; 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 1hpduG-0000ge-Pg; Mon, 22 Jul 2019 19:23:32 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpdt9-00009K-JJ for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 19:22:25 +0000 Received: by mail-lf1-x141.google.com with SMTP id c19so27480134lfm.10 for ; Mon, 22 Jul 2019 12: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=hlO4j1hJuCOJd1h1Hw9Dr7/Fw6jxqbEeyEo5OnuF750=; b=OBZ5VenYegly2ZmgB5apxAfAcbm+r7LzHEHc5zO9xF3ZIT2Nt/9Drpvjh6u0DKhL4X pgioTplB7ujqb0Sh+fw20i11enadUzceNFnS2VbQqnfBKZR0jyba/W7o/dXFSCrD4IXl ZSBK9kkwfBd8DYxsSQvOa8OGd70F+Afe+uPCwHniJDr7Nrqxc72SuJ1E6yZ6da0W807V VuXWRFqzgl6qQZI7iOVtLeHgxdsKSeWU2EhmF3VsYjqS2T3PT5RDVLGUFsKjkcQ/83I9 oEMaYD+ZYZZcUB1bXJy1O4q/9i7UCZhZlvwCS4P6P+O9mivIu3ffWTgbCnSsE7x6/YM0 N7mg== 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=hlO4j1hJuCOJd1h1Hw9Dr7/Fw6jxqbEeyEo5OnuF750=; b=lbDuvzkH+I8PB8B+COnOTqDZIugFBNLu4CNjESsQrwvan0jnaponSsRPfCKA9Yokj5 wviqZ8mgLdCsSDGfBHDt4lb0QoVY14tFBUOZeKKTBhowEb9r8S/Wl6U03YqLIangh/e7 D/NfdeH0FWetYr68+uFDBaNzwnvKg1109BxstWRG2lXrehmMaiOYmcBKr4E3JuLd01kq iW5QPfQLTyDG+FlLKYVgLtmCTeHRTYYDdoXfDMBCV3pnoqFM34RR+EXany+HDDxl3f08 HtgyVAubasj/geiZwb6eOKd2cYq4pO4vgyWo1cH4gx4/EqRLo0im68/4LbjmHT3SvTW3 ATbQ== X-Gm-Message-State: APjAAAV5+bF0sRvkVZ/XWC1OV4LCR8h7y6Sh6UYWsLh2axLqeIjGkOZB jBdD3WvPgO2+B/yx9xvPFSU= X-Google-Smtp-Source: APXvYqwboXpIQejpdye+ead8X3EBEYoeyGI8KGKUyL2A6myeizX0W9lQ5Z68gTdkgvQR+MzbQJ3AiA== X-Received: by 2002:ac2:4644:: with SMTP id s4mr32318959lfo.158.1563823341083; Mon, 22 Jul 2019 12:22:21 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id n124sm6129307lfd.46.2019.07.22.12.22.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 12:22:20 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v6 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Date: Mon, 22 Jul 2019 22:22:09 +0300 Message-Id: <1563823331-5629-2-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563823331-5629-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563823331-5629-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_122223_635977_F4089A7E X-CRM114-Status: GOOD ( 12.42 ) 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. Acked-by: Uwe Kleine-König Reviewed-by: Sascha Hauer Tested-by: Sascha Hauer Signed-off-by: Sergey Organov --- 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 19: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: 11053337 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 F2B96112C for ; Mon, 22 Jul 2019 19:23:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5C5F2837D for ; Mon, 22 Jul 2019 19:23:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9A8228508; Mon, 22 Jul 2019 19:23:00 +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 8A7932837D for ; Mon, 22 Jul 2019 19:23:00 +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=s8X9OpMLQDlHWYn39tJVt26AoFhfwjKZ5a9pPAf5qkU=; b=pIGkF8sIMRhEP0 +b3IEe8aft36m5YIWlskDl3CRrgcfVpY2Sj8m2EXMdbsDmuIXB5sHFbh6DGmh6nI/bmkNlvTbeTlj iNlsXA4l1cZ0SKH4HlpaCVEurs5CY0W3BqgK7suRKw+TB8WIPGFSSbSjINMfC7GHjHsvBQKu7BZS8 PqMNoV4pxseKb8iXt6xhEcc4y9cReESlNQPffOOstNXIC/StOd7/kRd1JH/k/S+dKq6dpbdIrVA5O tGPodDjujdZby+B38Ujf7k0iE5shd6TR3BZL4dd3woYMftetBUMkPyeDCj9QY2T6lNhztTDG/PWDY TL9P+ids6u5L6alFgkuA==; 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 1hpdtj-0000LW-0L; Mon, 22 Jul 2019 19:22:59 +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 1hpdt9-00009M-9f for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 19:22:24 +0000 Received: by mail-lf1-x143.google.com with SMTP id p197so27461966lfa.2 for ; Mon, 22 Jul 2019 12: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=wnit4p85ORmgfnZn4hAkBjNauy9f4K7ibUxB6LLunYI=; b=OUXCvoenllByUjPJujE3BRthxEaq55rjTdMdDKZp1dI1QYrJTD2K8yttKXVEoegkQL S5TEfmkT0MGc9WDr6KJrdjXGkCsrYMQDp9Z4/n8X7I4PNIdtNP0IW1v1q5HLSytSq/ME c7+Hz9PGlgCvXv/XMZyoXv5XTIx0Z99iD9yGwJIQvDQ+Rh6DAf/9Kgn+jo/c0rLjhOFC 3ifUNZTT9BKarFYuliptX8RhH1F3Oz2hSge3fxjwKJIyANBBy2z1VHE/NRJ9d/td9H7w +CdL0YySrgG8y3EXrz4n8d9JArm9kQ5VizLJXDawq1AbcZYduiTn0+avPqmNuhh/ZSZU XmZw== 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=wnit4p85ORmgfnZn4hAkBjNauy9f4K7ibUxB6LLunYI=; b=j6mDTO/sKDSOYl/sfqCJadShJ5EmPZoJkRT5ScyM+5CJ8O1jztkakld1vlAhclOloO FdjXNZFO0LGFBQBVfcxvQkuwfDOiklW+oMxr3FrEyxhvOIb3d/IP8CbjYAsV27L2yyZG Hpk0NsAJc7TkCG22xJgDXq86nAtsMrq/oGdABF3I7CIf96E6G45c+aNtzfOLzpEjjagN gHg7ssS2dq9VP8p2Wck2K8S4qfJRw14KctoHTzMYwOHqgL0YpH4vZFNKQY49RhkOyLnN AdwFEWQRfgtR1B1MF78hKDLHQ8PuMFpeXbQC57XTHNWDySQDoPkp5NICJld8zkSGjTlb TYQw== X-Gm-Message-State: APjAAAWu/xRCslCv+X6sMHMZgHDoxFPt4cejwFTnXR4dqbY6vXphB52t 5aL+iawFKkbX1XpbYF14Gx8= X-Google-Smtp-Source: APXvYqzMcAxtvEzeZaLbMfwbcBn9qKi7e4zuAuT1RxXDnSo2B3PtPcOpAQp3OSoAIKssKwyHOq2Ljg== X-Received: by 2002:ac2:563c:: with SMTP id b28mr20156125lff.93.1563823342006; Mon, 22 Jul 2019 12:22:22 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id n124sm6129307lfd.46.2019.07.22.12.22.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 12:22:21 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v6 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Date: Mon, 22 Jul 2019 22:22:10 +0300 Message-Id: <1563823331-5629-3-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563823331-5629-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563823331-5629-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_122223_344722_56474302 X-CRM114-Status: GOOD ( 13.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 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. Acked-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 19:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11053341 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 E5BA2112C for ; Mon, 22 Jul 2019 19:23:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D75B92837D for ; Mon, 22 Jul 2019 19:23:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAD7028508; Mon, 22 Jul 2019 19:23:59 +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 6A0D02837D for ; Mon, 22 Jul 2019 19:23:59 +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=MfLNGfBL4x4ynp69hT8Gaa/kvY2JCkmYS0j3EEF7d9Q=; b=A+yDOAF/nK8P5T uNmELilFY69duUUAv7KorMgaAd5FjP0WBFNPf/eSAei218up4Xx4esWcSb7efnCD97wxDHQarXGMP Rap0dNY3NrzI/8elg1XGcz1Sik9960ms2O1AZPR9PMwDS7l/AX5A9XQgFw3JK1awndtMF6yMRxKPn KALphPJmL52XYBMjYoZj4T5uro4RM6dTOk6X/EbURIvjHVpxZ2m0qU9B0rWFNZOPLdB0Fw1n9OnjD HkXrG7IE0VGqi+5F7YN+csOrvDMPKVUpyNNeW5Ku7bcjONOHlnYGqbQQamDqLUHR25QlnZpQLrfv8 1o1n97uM6Ql/u1clCEFA==; 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 1hpduf-0000vt-JQ; Mon, 22 Jul 2019 19:23:57 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpdtA-00009u-KE for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 19:22:26 +0000 Received: by mail-lj1-x242.google.com with SMTP id r9so38694906ljg.5 for ; Mon, 22 Jul 2019 12:22:24 -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=dMFpXLyuKl/ARSHo20Q9Hq9vNpRSPEtnIGWgcelt85w=; b=in21JgjdGrZF9LtT8nCi8uhPjZ0unyb6VwBZ3uDKYSva7WjusxgOq7TA6502tKUufi 3I42F0w//h3VKKzlNRU8t+ewOCpb+f1Y+PONiycPofWqJP4XK+QLRsFTe2NRY6h6sTe9 /TK22wxi6RF9r1mFRezHTjbxUGxUXGyVjo5FAS3Qibu71WQ9EGl92qjrCIXoPodtfTRB l1dyzM+/iqCEYB/zGo96vv8JXxqxthAFmCApqbKSa16X9JAzOH/ZPz8mkBbarAJZ66+H bbw9bMCuQJjtuOgmTqygOrraskmfqZ7kuWuxxzb6PzjaoVnlhLbM1Mpkfy3Yfx0kuzZt rdiw== 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=dMFpXLyuKl/ARSHo20Q9Hq9vNpRSPEtnIGWgcelt85w=; b=VtRMgkkeq6lrwdLImxvpN+2dq2E2l/qe+SYdq95uOxvyrVOkydgb79Ndnxo4wcguaG f/cGkeREaww9WiNrpn1N6beJTAgYajQM2OQGMTD3Wq0h9b3j1HQ8oeIhAZScLG7h+jJz 2vNNBUPVd+2ZkTCiyyrffr9qNhtvN2BEOnNna6R/nIx2gLjAkobIfmi05TC1nsMQBqcf ie4rTkwybm/+a+t9v5DRqZ6DQrIl7q5ssQTjsTaNT6mG6PipZRnqrPqMpznSYqq1vPr9 5YBBew6RaZA2FTC55AAWAR2UEnBjaCzFFrkFfEtVuRUiBykCVWWxMFy6CSBHld+yfroO l3fA== X-Gm-Message-State: APjAAAVrsoOFAGO02c+BG0B7g+Jhh4saY3YHrhs+/MRf137ZNGvjVseL oXUC9YFlTIKR75+vAZHmRMs= X-Google-Smtp-Source: APXvYqwZG9xAwevycV1eqLHdjNT7UInKyPe6n8YOGoJQBBJFUwfNpUWf3hvH8YyXA1xFOeQeDX4TBw== X-Received: by 2002:a2e:894a:: with SMTP id b10mr32119358ljk.99.1563823343029; Mon, 22 Jul 2019 12:22:23 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id n124sm6129307lfd.46.2019.07.22.12.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jul 2019 12:22:22 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v6 3/3] serial: imx: get rid of imx_uart_rts_auto() Date: Mon, 22 Jul 2019 22:22:11 +0300 Message-Id: <1563823331-5629-4-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563823331-5629-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1563823331-5629-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_122224_765311_4B6FF900 X-CRM114-Status: GOOD ( 12.54 ) 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. Acked-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;