From patchwork Fri Jul 26 18:52:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11061759 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 C8F241398 for ; Fri, 26 Jul 2019 18:53:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8D5F28B2D for ; Fri, 26 Jul 2019 18:53:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD37A28B38; Fri, 26 Jul 2019 18:53:42 +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 3CEB128B2D for ; Fri, 26 Jul 2019 18:53:42 +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=rLBfExz1TAXWXf j21o9zKpPVwgNob36KIE64xEkFGpon7LJyYEWx8XrqlnxchWUu+0Ur/qrNq4BOYeN4AYlHzo52SGe yRP7FbkKeqjNJ+FmOZNAq7jsWCDkbo8lYXC2dma1HHQT3ji5q1f6rcNGpSvyH6rgxSZ6V5o1PrQWb 0NL/w6jUHqJE+0BlewiqORTvmLL6rzeVgGqTRM8fouh2uLHw7xVY4hFYpr7Ws1ONT6DiHh07jd5pk YydkWaiDu/hHe9LmHp9w6CivigYriefl15hleksLLWBJCb8+wkWGdaOBGFEl3eSMiyrxKAsBUcQdW QctMkQsS/4wZ92DQumkQ==; 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 1hr5LT-0000XK-Mm; Fri, 26 Jul 2019 18:53:35 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hr5LE-0000MP-I8 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 18:53:21 +0000 Received: by mail-lf1-x144.google.com with SMTP id c19so37750943lfm.10 for ; Fri, 26 Jul 2019 11:53:20 -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=E11A35JTqUGpf4NcDswflSPTMqH1wKUo6F85Dt+BpKH7fAYIyjF8Sa4+YR0f7rv1K9 ib8/bOdc1Xc/Z7GtXBwOcd08XODaU2FiWa8pIx8sADZsDOvRQx6VX3sTTNK1EP1FkxUG LHZm73i0+b8QoCt0RtCOmpf2nVjViGLe23SwmpVgf5lsBpiz1VzjmMHCJPHg9FNZ/whY IzW8yLWqbBPJoAt/boN1JsfCOvSdBkdwVfo+UHmQvJjh/RvGrLnP6fO99NzFFs5ENPov gtU2IgZe2wgNGLPwDTl9uiVn+ZcFQh3gvuHegKWVxr35SxE1ullWi3tuqYQUNA0MaiR2 Q3kw== 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=VsERqXzga/VEp8ZO4VXswigl6DbX2BSrrr0Bs0hFXvtphsJmuBtWUST0VIBUHXJ2AT ftAzmcaak4maIf19uaCqJrSrwkUC72Q9d40qz8Ppbt6rM2kSvqpsSjFPM97hE+OIT/ID 2C3cUAT/L/mv2/Y5xwwtPzXRbJGfDqJJNVmr8oE1yeebptLW0G1w6CO2ujJBEJY9owXy maj0Pltu+CjL2DQm6eGPJOv4Snn2aDo0dSykEwUe5RPxjZoJ+JHtU/sjuRxpiZ2ytpTJ 8EmhX7yOM6bh83IladOi6oy4/iwv69pn8I0TKisH63D2h2J0Ld+HUPnzHHv1bG1z04Rg Bamg== X-Gm-Message-State: APjAAAVdSyCfRw2z+6Fd947YRn+GRkHoSMNDZPzh1wrSENW0kNg5wqRs HK8HOsqw9zAcryWf/bia2g0= X-Google-Smtp-Source: APXvYqylyhgwhQzIZbM8sF6YYj/UW0wfnrPMmm+VrH6WhYCCqZA9ezpHdKMq03NlQv0gUDOJ8STjXw== X-Received: by 2002:a19:c887:: with SMTP id y129mr45791747lff.73.1564167198917; Fri, 26 Jul 2019 11:53:18 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u15sm10254810lji.61.2019.07.26.11.53.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jul 2019 11:53:18 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v7 1/3] serial: imx: set_termios(): do not enable autoRTS if RTS is unset Date: Fri, 26 Jul 2019 21:52:39 +0300 Message-Id: <1564167161-3972-2-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1564167161-3972-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1564167161-3972-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-20190726_115320_599497_C06BA0D9 X-CRM114-Status: GOOD ( 12.15 ) 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 Fri Jul 26 18:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11061761 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 0C55D1398 for ; Fri, 26 Jul 2019 18:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF43F28B2D for ; Fri, 26 Jul 2019 18:53:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E379828B38; Fri, 26 Jul 2019 18:53:57 +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 881F228B2D for ; Fri, 26 Jul 2019 18:53:57 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=ZelUfE2u0eHeIDfg/5/2+5RbY9HgWtVJIEgczYPAPWI=; b=nSA8qgc8afKmzMj6f/fx6fAsSk KVYTIvtBDxmRHQynCFitLhc3XCEBSpkjlnnmt5nI6f4JIv9psj8WKwBUGXdjvsoi/r48w44iD/iZl jsVI8kz9FEjCB4v5UwXgeNib+bxJnkuTy6UzZR8uVh9W105lRLowiwk7Ht7GvPXDEnRvTd/JJsXYy 09kNrnRFt4UPiDgx4BZhkx8Lbrb8wmzgdEJF9eq25yJuUmWj9u27/51zZY+xyM2ncTvXSmLPTcXHB 5B6Bn9Xsh5Evko9gwORNXu1Dtutp8h1XRtiehaLX1lY0pWu0fSiMY4s9/0m8hPKta5pUcVRVSh9L7 hNJSGx2w==; 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 1hr5Lo-0000pc-OP; Fri, 26 Jul 2019 18:53:56 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hr5LF-0000Mb-8C for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 18:53:22 +0000 Received: by mail-lf1-x144.google.com with SMTP id u10so37735301lfm.12 for ; Fri, 26 Jul 2019 11:53:21 -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; bh=jZWmDj4ynzd3H3aeFWqnlP+/VckrZm4pXfnfA3698MQ=; b=t5TcUS9UG2i5BR3IcZr5CmtPv66vh9zRIHMqIt473cvspguf8CZe3XhCSnDOBGMWA6 eldCZ9MHwOB4FqX2NZ9kFZpblp41KqM86nHTzn+sDqjcpEMN9SVPfjbqah+X7cjKkxj4 UBkGk05DQBCAk/uvjG5M9ZopALgp/vk9DFqrR2LoN4zW2D93/gi36smZWEzb9HlNSIAA K/7v6gZ9G4RpQifGemYt1Gj9BO/W8h/HMVFX7tOywWxr/hON/wIs2L3VERCK7ZbeOcec owqpIWi5oNY4OblefEjU6W2VBwpQY/XxfgIzg93eACVx2iqMnKdX1blwnXuXxLkig3R7 b6YA== 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; bh=jZWmDj4ynzd3H3aeFWqnlP+/VckrZm4pXfnfA3698MQ=; b=Rrrd6RkSTvYagwRAbWgOStfEJoHDeOeNHri/Wg5KlRRvPODu/wJ73P4TSCKKgS7u0J lBn6p7jpDrnqxOnnXvBgJsrBqBir8uEHCLU8V7Bk5l48/L4hGhr03mkrUpQHR3kOTTQa R82kVUQMwPXFK1XZsjh08pwMp6XQ7qlEcYM9EzfL9TjP99/W8Wo78taffNwj8hZsZFyF PQKjsyyX36V6eQ1HDxSMLE9x5qgp+k0IYAOa9EKPShsiPHY3HS1QnKGXJ/60i2BWwi7T SI6/3R4s8O5U/RGMFULvyO0LxkgRiSNn9AV2WN4KkJ7CPLQ1668xHRAu09Oz9EA5w1OK Omyg== X-Gm-Message-State: APjAAAUCcFqFTrInrFCAIVuoFrC5xeFjEZlUB9qHkBIr3v36nJ/uZLbl UW+WddGWSKtYAXiFS20/fKw= X-Google-Smtp-Source: APXvYqyGHeBm5PjleeluML4AzpxpOJHQoGmOKRykfTe+PMMgtgbeCze1llNiRpIuXxA9yu4ft7G/bA== X-Received: by 2002:a19:5217:: with SMTP id m23mr44591619lfb.124.1564167199911; Fri, 26 Jul 2019 11:53:19 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u15sm10254810lji.61.2019.07.26.11.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jul 2019 11:53:19 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v7 2/3] serial: imx: set_mctrl(): correctly restore autoRTS state Date: Fri, 26 Jul 2019 21:52:40 +0300 Message-Id: <1564167161-3972-3-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1564167161-3972-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1564167161-3972-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190726_115321_291375_AD8E14C0 X-CRM114-Status: GOOD ( 13.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 MIME-Version: 1.0 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: 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 Fri Jul 26 18:52:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11061763 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 D3CBE746 for ; Fri, 26 Jul 2019 18:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C20B728B35 for ; Fri, 26 Jul 2019 18:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A242228B3E; Fri, 26 Jul 2019 18:54:17 +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 37EE528B2D for ; Fri, 26 Jul 2019 18:54:17 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=HWP/LCo/fr8GLKkJl8jWHr0yvfUoTdWURQkf9yy6GD4=; b=MDA1F7/F5e//9k/MJx3HBuUVHL P0Sn3yEDsTnOEda4FaA5/kTCDHxDyHVR3t1g1tK0Lv28NaHLDqPlBHsZr+48fIfHAmVug3+GNx+xf cAHnWiAHdZ14uh35Cp2ehPdRv07uK1nLQmS2eg+qd6Bq6j9H0aFYuwKSHtr/5vqRs+kEinFIuV2qi bl0w3PIULqIUWVbhA/NbM0juHtZWfbW2zKn8QWV86dFfsawSX0Hm9SegfkekyzEVBzusOLjGKHoL+ Fhg+/JtVLttVmWK1Hc61Nnf2lZmjdO6m2HHGN8LfWSjpaQZTITchByLK4cd5x2/d9I0Ys1Mnsib0t r18IQtbg==; 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 1hr5M3-00015e-5r; Fri, 26 Jul 2019 18:54:11 +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 1hr5LG-0000N4-DU for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 18:53:23 +0000 Received: by mail-lj1-x242.google.com with SMTP id i21so52464945ljj.3 for ; Fri, 26 Jul 2019 11:53: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; bh=sj8RVBs1fk0i3q8Mv8Hvbl0QmOyE222Bssz9akDFVOY=; b=sCGwZuU9pvjnkWWzIrVaU5Tt6VgiIQEXIJaeUOSYMNehQmShord01NCMJnfCC5ncrs 9CVWh72fv1sEcVNnZErHW9QUdHnUCH4b2ntzI3ZfB6SNqyAzJevcMb9OGgdkS5Rw/bfS AVWN8uIV3+u29U/zFqux27d/tRGdG7R5Wuj8qhshwZoV2Bha7AnWxUiDBSzlN/lhdk0z EtXtsAVq89cVegXtRVCXTwuHTlea8WRG2kj+eqRESGujdyeUSv6yDAf1Duyk4as31gFk 31JVUGPmqy/mjXVKjO4EpmoHCsR4tjQkdlpOA0X0xB2zihc7UwNLEQCDnNoyISaAe6eE EFeQ== 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; bh=sj8RVBs1fk0i3q8Mv8Hvbl0QmOyE222Bssz9akDFVOY=; b=b6abdXvbN8FQOb6nqGSOawKDfWlSv85gX2QA0oe/3VnfWMONQmi86VSqRpu1MlaS6q Qr4EfIbr45SbZuoqhIw8BUwSFM7iG8MM9u/U2i5q5gi4eBMbcXbpTkVirrGfoHsg4SOM fOW6Fgp/4PfXCxzf8ix4QbHghC0BsYrmnRiIQ9GeLZchKCj5cuR/ILOYnma9T5bu5Se9 3TAyjX/Wy57Ke9hFLDhqD38xiS6hRdYWYO2z68TOdggkeATU3BBv7M8HbwF3QXWoEGL9 dC5NzgL9wFzHm0etDHWIdueovMNxl9tvJs0nRFMr7W5Wq0R0/PXV9e3tl1Lhyykg5HUs PiSg== X-Gm-Message-State: APjAAAWc+yaQwXYA4FFVe1x4L1szKihk0Mv6GM24jdz5/+bY6ci16eqz dP/ahAd2Lu7TtWomLKcRBqI= X-Google-Smtp-Source: APXvYqzmB6/vZkocyFQqX9FSF/5ZmmXo9D8WgIVwA5Pw/VEahaXGRoJMOu09/LuIPHzg5UJ8hsucaw== X-Received: by 2002:a2e:8007:: with SMTP id j7mr50708763ljg.191.1564167201088; Fri, 26 Jul 2019 11:53:21 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u15sm10254810lji.61.2019.07.26.11.53.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jul 2019 11:53:20 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v7 3/3] serial: imx: get rid of imx_uart_rts_auto() Date: Fri, 26 Jul 2019 21:52:41 +0300 Message-Id: <1564167161-3972-4-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1564167161-3972-1-git-send-email-sorganov@gmail.com> References: <20190614072801.3187-1-s.hauer@pengutronix.de> <1564167161-3972-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190726_115322_453802_33D0401B X-CRM114-Status: GOOD ( 12.39 ) 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 MIME-Version: 1.0 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: 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;