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 */