From patchwork Wed Aug 28 18:37:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11119627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 001D1112C for ; Wed, 28 Aug 2019 18:38:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D15E42080F for ; Wed, 28 Aug 2019 18:38:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="F7iOVBAA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="peXiicX+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D15E42080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=fB7HJhy7RKxo0FXFeRmqlhuXrJ42xtY0gQAhIANFJwo=; b=F7iOVBAAXfVA9myDD2vMlSbzOz pAaYH5PyrEyg9riUPaVg7XCITok9TVKc+5VwL6/ZN4bUNXuYH6uJsWARjgFhKjL/zZTRAzuJZwopZ TvtTPv6VK2NLuifaIDPv1Mg6xQRYhS/OojtewVhCtB8aHtjWi/bXf5tVbfEpwZe5sKK1UL/l54L5S Rj6Eq0vBMbPUXoKjr10hZp8hgfr15oT9GRAp6Jb2Xt7riBKLnUHUu8HI+mrmdgjHjr/a3Jp3xEcE3 lHJf9TzTrK/ru/Eb0JQL/hjt1WZZ45Dq+3c94foIQDlxjo8otpg588X7yijZDm/ZDlCKR4owDwkTh jWf917pA==; 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 1i32po-0007QU-Ht; Wed, 28 Aug 2019 18:38:20 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i32pb-0007FF-Op for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2019 18:38:09 +0000 Received: by mail-lf1-x142.google.com with SMTP id w67so395993lff.4 for ; Wed, 28 Aug 2019 11:38:06 -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=GgBnhbAyK5YL0Icz4CgluyDZjeVZCXJztYJPnsKKGn4=; b=peXiicX+gbp0gfJEQW0rAdumG70hYVWtX2sB3zUaizeySHSrbSjCh9cuBpkSgfBE+8 32AQ3ZwoCfMmUfH85tVdO7Nf5ezMoMrfsM33x337+fetRAJKuyl/otI6Yta6uRTyhOUB oVFsYYQcHwFu/ZSAfuZdlZQFxMO908wZy3SK3yn610nTz74sBDKcfz4WBYn0VFG6cxuA MVJhz2MGBUfULr2IO7m79d4SgelXxATIUuBdtwRjm1YORc6WcuUojU7LOB2NszwiMOrQ NpyVOgaxH8aWKkJwBcMJkE/OGU6XQuJtVMsMOtDlAYc+mmx5JUXM8V2VRACqd6+N1+je dx5Q== 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=GgBnhbAyK5YL0Icz4CgluyDZjeVZCXJztYJPnsKKGn4=; b=DuX9paYSDCoX1jI5NGFBQjA7bjR3xKEaGRnIK+BGktJvspIO39NGGL1tJkzk0CFG6J BbBddRwnIH13P7fu1SoppgT1cVfalNuwmbzJO//3DxWfzLr6Xm096IZ5A/jmtW4Y+Tqk GRxbqMlnIJCu6/hBQtk7FDHdMhg5xz0t8H9Ztbnv2cyU3xEPH9dI4ZBXg7P+/hpARuS+ msUA7yAP61IYVcTOixHyF99w4fTyLFbhINBffj45VTwTdRUvRKLz1LJyZ3LR7dLm/8mf 316MkiqzaCY7ysjk9BYjysGVMuVJJ95GyWjMC+I2MpyU+7w6VIQkN/priTSHNoQKHruz Mwgw== X-Gm-Message-State: APjAAAUo4aIAvlbcNk37RJPjHmz1RqxC8KxWNyniQy4RfRs9gEZQkoWV L7D7W7URNohzo7z+lr1o4YQezM2T X-Google-Smtp-Source: APXvYqygR2+YIzVn2R25wf1NRFFId1aPu8cFdWI6PPLfj8Qr4trmPS0fkLaTqtfpJzj/8OF5T6+xGA== X-Received: by 2002:a19:c6d5:: with SMTP id w204mr3369494lff.53.1567017485322; Wed, 28 Aug 2019 11:38:05 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id f6sm9226lja.16.2019.08.28.11.38.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Aug 2019 11:38:04 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v2 1/5] serial: imx: get rid of unbounded busy-waiting loop Date: Wed, 28 Aug 2019 21:37:51 +0300 Message-Id: <1567017475-11919-2-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1567017475-11919-1-git-send-email-sorganov@gmail.com> References: <20190530152950.25377-1-sorganov@gmail.com> <1567017475-11919-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190828_113807_826492_C3F25C40 X-CRM114-Status: GOOD ( 10.99 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sorganov[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 imx_set_termios(): remove busy-waiting "drain Tx FIFO" loop. Worse yet, it was potentially unbounded wait due to RTS/CTS (hardware) handshake. Let user space ensure draining is done before termios change, if draining is needed in the first place. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index d9a73c7..47b6156 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1644,7 +1644,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, uart_update_timeout(port, termios->c_cflag, baud); /* - * disable interrupts and drain transmitter + * disable interrupts */ old_ucr1 = imx_uart_readl(sport, UCR1); imx_uart_writel(sport, @@ -1652,9 +1652,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, UCR1); imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); - while (!(imx_uart_readl(sport, USR2) & USR2_TXDC)) - barrier(); - /* then, disable everything */ imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2); From patchwork Wed Aug 28 18:37:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11119629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A5C3112C for ; Wed, 28 Aug 2019 18:38:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CD39208C2 for ; Wed, 28 Aug 2019 18:38:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RpwuMRgG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X0C9DQD/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CD39208C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=SJBi8Q3b5RR3EeTFPEyPC0QtZt1e4ro0J5BLww+sNcY=; b=RpwuMRgG2gRth/sC1lipi6jgBR SlgMMc1yW56k5SXOBnYLv6f6nIDpb+M1GTXt3Xj5l/7Wib4XILyl0wlbEmCTuwOkbLAzGCtXUk6vD m+0G23alCaGDLXGM9O5bRkk7NU5wlZmZvIbJ2w/0KcepC5WuBgOtU0eFae6Nd1DZ1t3x0xx8ojiBo ie03rrT9p7ZbiziBjTZIIjE7vCtyVW3QEFaviAULUqYIKMunyKOi6BuBqhTruwLoHh62AI+sMm84R 8LiVRFdj3xk07nNN+Dylo281OzgD586vHc0VIrkEkVwBPO1hQDY9jq4QuU+owD6Es2WDfsJ/mRXl5 VSvRjg9Q==; 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 1i32q6-0007ez-G1; Wed, 28 Aug 2019 18:38:38 +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 1i32pb-0007FG-VB for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2019 18:38:09 +0000 Received: by mail-lf1-x143.google.com with SMTP id r5so400419lfc.3 for ; Wed, 28 Aug 2019 11:38:07 -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=6lzh98sOLMsqCvm7qUrUZzyJz2eukzPb0EvBk7FuqQE=; b=X0C9DQD/F/4toZ9Ly2/MM/ayvInotEuMQXKtTOfRx+OCPoUp8QZQfWcgVGgk5jDrZP Fw+2pQH2a8mDCu4c+p5NgT7EFJ5l3e3C9saGeEJP7T6FthKMcH9AjMUWJlG2A+/eimI+ 13hORnBzMB6waEpE4pgNEpXlO67sebfnGGDZiNV6BUsxUMeEwKF9kfh2A8j8jBAxJA0f RzU+87tPgFnGBylNOJWXysz4cRlAP1ECj+feaxBSAFV+jYqLlHzI93xdALKC5eScsoCc frnMCJ7l/uxOpISObceHip0rOspVKVVPbjmZQTtpfncaYnXbhMmAwy/CPRLKvfJRlZS+ eaZA== 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=6lzh98sOLMsqCvm7qUrUZzyJz2eukzPb0EvBk7FuqQE=; b=LyKfn9ivrXhAPq5gWf694H+Z5C1MpYzQikq3npuE8ta3ml4wCzvSPtHMVOTFEoXo0G 5Og9D0CP2JjjUGssB8VrFtlgCW71R8JqAR1yI7T/eVjAJK9057P1I8pXBNMjaigYHSBG K2B0Mgbnh0ZzQLfc7dTj9fSLcw+o7Y30stAuHq+4i1e4saibLal53Yge4roS1UKSqXbT HrnA/bUgSlmGzIGfdRM+YDS+ZAEAkLI/lmXJs2FPeTkSTm0C9h+ntnuiFK9fk4P7CKfQ KrKS3c69KslRFJSe38pa9NJm2trcfShZTH5itPhIRUB/vEXMdWGQJXw6l2+nnJLjJno+ XfbQ== X-Gm-Message-State: APjAAAV6r3KVxicdxHVY92vYgiuemqlCJHtSSdgSrDEwgKw8GWehfwB7 MC5sYKklEWTf0AT0r1vQPmY= X-Google-Smtp-Source: APXvYqw2zr4JIw+BlcLX/SZK6QBLtrz+EkMw0hfRzkY43lErmZkJZCN2xiOLA+EbTE3XsRyPE4VkIA== X-Received: by 2002:a19:5d53:: with SMTP id p19mr3376568lfj.109.1567017486320; Wed, 28 Aug 2019 11:38:06 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id f6sm9226lja.16.2019.08.28.11.38.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Aug 2019 11:38:05 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v2 2/5] serial: imx: do not stop Rx/Tx on termios change Date: Wed, 28 Aug 2019 21:37:52 +0300 Message-Id: <1567017475-11919-3-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1567017475-11919-1-git-send-email-sorganov@gmail.com> References: <20190530152950.25377-1-sorganov@gmail.com> <1567017475-11919-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190828_113808_009242_8ACC5052 X-CRM114-Status: GOOD ( 10.16 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sorganov[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 imx_set_termios(): stopping receiver and transmitter does harm when something that doesn't touch transmission format/rate changes, such as RTS/CTS handshake. OTOH, it does no good on baud rate or format change, as synchronization on upper-level protocols is still required to do it right. Therefore, just stop doing it. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 47b6156..fa723a9a 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1652,9 +1652,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, UCR1); imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); - /* then, disable everything */ - imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2); - /* custom-baudrate handling */ div = sport->port.uartclk / (baud * 16); if (baud == 38400 && quot != div) From patchwork Wed Aug 28 18:37:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11119631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 263A8112C for ; Wed, 28 Aug 2019 18:38:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 042B62080F for ; Wed, 28 Aug 2019 18:38:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NNscW5K2"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ozl9b2ts" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 042B62080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=7bcDXZwYfjQNlz4OT14CEDvxRbOI/FyUoCGp6ZbEMAU=; b=NNscW5K2/fqDfu95o8vMKsGLOZ FzTyaIspvcSMZJJdGxcVKW2KkASmEhCFt+2TmFXdBynsPL51Z38fQVJDjdBBWY4S5LubIAlRJmQ0m MbL3ZPPVLRryAymwq8l5ujhbf5+iXws467ZAqw7AfAZeJkAdTa8J6ndduBDJlrM+//Ore0qUNfNGr VydPgIhsgDFjsTcpWupeEj0/NEYboy9vQZXmK7DD6jIxDwKPAvCfnHVIHlFBsxDAq16naa2kJu0k5 KlVuSw+P9EEUWd22QJox7R8UFpORYZ8A/CQ26/PeEphDN6OtIuvgVFVMS3PN+NFiInUWzP0YKBTG1 FgXsR6xw==; 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 1i32qM-0007sp-Ef; Wed, 28 Aug 2019 18:38:54 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i32pc-0007FY-Mz for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2019 18:38:10 +0000 Received: by mail-lf1-x142.google.com with SMTP id u13so370025lfm.9 for ; Wed, 28 Aug 2019 11:38:08 -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=ZlfktRIZDpnYsYdM+ski1fwXXj3g4icgLqulIn6LmQg=; b=ozl9b2tshIIEjFQSKd5HpAMSMfC09bFrBg2q0TIodiWyA964QMW+SLvNkfPRowlKak OhGljELCQ/dBpeGSZcQbkJRlHkTTLF5K+71qq1iWvxQ3Tal2FgLUw7wDo0Sc/aCoO4DT VSOlJEjtXV2mF1Z89uxC6kmyQ1OYmyNlfnlZqS5gXG5RTkxsMnHJJy7amAz96KEq6gCV K4OIzICmSNepb9H71lSuFxuabPkphHWQbWAzFJXWJwwu0xq9e3c8bXucWHPi48yxgiTE NAmaxsj4+UVIyoyU8vktBwFVWEQ8gLWZuSn/gKQVQid07KTmPzh5pmy0xQnbg/yj6bWI GTvw== 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=ZlfktRIZDpnYsYdM+ski1fwXXj3g4icgLqulIn6LmQg=; b=i0VWaCaxRNaxQ7lI0xkteuiUJiKjttdCh1+OlK07qTcLDtqZe6PtGIfCO1WNmI3703 7Ocvy2f9ZiFs0Db4QQwp7+vhvd0N1krqghFDX4jhKzf7aEX2UE7gv11glJ0fVghoqD/G 0DnTyHWWUckQiyN2Xe4jCnuw+hefEQZpDUesntUyU4FpxsuCiraVlOTPy+U5HJe/SC0K XRWiCzcJx7K9IPSKJJABOGAgcIwDTNcSJjGB9iNM7sJgQY/Rx3uczBV2aVEkp2XEcqO9 DEPy1ncXcnRR2GzBLZ7XarVnKrIZMTNytBAfMufRkehOoKfyZYFuE0bxSKVphK5+6cr3 2cCQ== X-Gm-Message-State: APjAAAXV8W0bqVDSL5c3t07Fq6rAcqQX0Fz9WiJg82NjJlCm6OhhR1em HCIxD6vcoqme66XBg49rv0kmDCUz X-Google-Smtp-Source: APXvYqzRlpHejliRwLqVBKetlj8ffbEuoEWGT621+mRDCl1GOVUaOp5L/xAyIW4hXhkGTo762OHy0Q== X-Received: by 2002:a19:6d17:: with SMTP id i23mr3473594lfc.44.1567017487415; Wed, 28 Aug 2019 11:38:07 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id f6sm9226lja.16.2019.08.28.11.38.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Aug 2019 11:38:06 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v2 3/5] serial: imx: do not disable individual irqs during termios change Date: Wed, 28 Aug 2019 21:37:53 +0300 Message-Id: <1567017475-11919-4-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1567017475-11919-1-git-send-email-sorganov@gmail.com> References: <20190530152950.25377-1-sorganov@gmail.com> <1567017475-11919-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190828_113808_753343_49354900 X-CRM114-Status: GOOD ( 10.71 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sorganov[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 imx_set_termios(): disabling individual interrupt requests in UART for duration of the routine is pointless. Get rid of it. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index fa723a9a..cc3783c 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1541,7 +1541,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, { struct imx_port *sport = (struct imx_port *)port; unsigned long flags; - u32 ucr2, old_ucr1, old_ucr2, ufcr; + u32 ucr2, old_ucr2, ufcr; unsigned int baud, quot; unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; unsigned long div; @@ -1643,15 +1643,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, */ uart_update_timeout(port, termios->c_cflag, baud); - /* - * disable interrupts - */ - old_ucr1 = imx_uart_readl(sport, UCR1); - imx_uart_writel(sport, - old_ucr1 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN), - UCR1); - imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); - /* custom-baudrate handling */ div = sport->port.uartclk / (baud * 16); if (baud == 38400 && quot != div) @@ -1686,8 +1677,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, imx_uart_writel(sport, sport->port.uartclk / div / 1000, IMX21_ONEMS); - imx_uart_writel(sport, old_ucr1, UCR1); - imx_uart_writel(sport, ucr2, UCR2); if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) From patchwork Wed Aug 28 18:37:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11119633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2902C1398 for ; Wed, 28 Aug 2019 18:39:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 073042080F for ; Wed, 28 Aug 2019 18:39:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h58qe+NU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o6bem+9D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 073042080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=VAB5BpovYOVdr0GKWqsQrwF0n480plqrbkwpKQV495w=; b=h58qe+NUV+nQUkfSVCIpmRPNO0 uiLSWT6rk6gNnad1o4A7J5uqSaEw4Zllv2VIZ3GNTy93YfCaf5CbUp0yeGhFW+MnQtImuAvcTIqKl 6Gv78ObOVKTjKIcD5j2NB0piZTjajBfG0d0/tAB/HS26hffwpitoSb87KhQqp169XWRLZUUZ3Utqe 2mdRf5GxhAP84G8IrA4lPUzHzfejaxY7GXOahn48Ly98iVVXTqZNfzmnNGEqLGhso9eGWeJkDfqQ2 TWyDyi4Nbf27Fl2ADfIOh6MxDWj6XPhUvqkxJgAR91yiU40Hy+fXeO8aXS0wrES7RDGwS9Bz1Ydcg 0SUqzOwg==; 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 1i32qa-00086F-L6; Wed, 28 Aug 2019 18:39:08 +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 1i32pd-0007GZ-Pg for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2019 18:38:11 +0000 Received: by mail-lf1-x143.google.com with SMTP id l11so386538lfk.6 for ; Wed, 28 Aug 2019 11:38:09 -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=Hq8Irfar0eMF52VRL6jb7YZsMYuqVZje40ByVMTx8hM=; b=o6bem+9DKTPq730Ec0kUZztFBO3dsRWGsyCHCE4SR9ms4N+8jDj1sogyLkdpYT2f/n Gjdexj8F8AsOVDyqby440XFGGxJlUFNKftogR33ix1Xk/uzcsOvIeh+oeVWsLSmOOoqa lVzTsklURj7AD9kIhCE9p0m5bh8yljLaVaN7TPAC/idftsP0yyMkzYEXbr0T5ZiSsfVB 4BpR5Onq5bDDP/n37prrjjMRzK9nq4XvH+a/0GNUL3zWNsu3dAfvE9wFlWupNgBhTdhY IT/WXOmkjhp0k+XPWHPVrrFLKcw5SGhNi/qimdbGTtwpCOWNfd4YXljFKjChg5X9wj7V d5iA== 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=Hq8Irfar0eMF52VRL6jb7YZsMYuqVZje40ByVMTx8hM=; b=QE6aucUAwuHtwla2hztpEBDkYlrUzF1qLTusqTy+08clYB+fwqzcbX8UN06ZqeVjGg IuHrxA4iRIQ1ijrWlXFyu2l3FCiodXSyV/mNuUs9goVTm3EqOHiMRTh1E5vFzygVIrTw EtYkP85AtNDYZasAI/xQ1yAPlB9YEeMuT/KIA+R0IF3B+5qShhDhBmFhE6N4T754EiNs 59H8egGdHvqyKKofBxmvf6dr8M2c2/Z3LST44bHFZgZ+BtGorjch/VZDNSoXc4nzs1/k AZcaTuYwbEFgDdnIKng8mjiJ1rRs2/+HsKXwHAx2DbCaUiJ5yvB1djvCsJmbLYHk9DLG MhOw== X-Gm-Message-State: APjAAAVL+OA1cS4Rv13KTTzp1Uh5yz5t23+6X46c4YhSITeS3TdBzPYd blcisiYz1FmKYUlZ2cxcFrQ= X-Google-Smtp-Source: APXvYqwysdFTCEKB9GdYyg8ZVRVcrqhCYFgN8D9pq/JihCpiNfIceCXGHSpStlzWIMAdbETWLONv7Q== X-Received: by 2002:ac2:447c:: with SMTP id y28mr3345252lfl.177.1567017488497; Wed, 28 Aug 2019 11:38:08 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id f6sm9226lja.16.2019.08.28.11.38.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Aug 2019 11:38:07 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v2 4/5] serial: imx: fix data breakage on termios change Date: Wed, 28 Aug 2019 21:37:54 +0300 Message-Id: <1567017475-11919-5-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1567017475-11919-1-git-send-email-sorganov@gmail.com> References: <20190530152950.25377-1-sorganov@gmail.com> <1567017475-11919-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190828_113809_832965_308E1D16 X-CRM114-Status: GOOD ( 14.55 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sorganov[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 imx_set_termios(): avoid writing baud rate divider registers when the values to be written are the same as current. Any writing seems to restart transmission/receiving logic in the hardware, that leads to data breakage even when rate doesn't in fact change. E.g., user switches RTS/CTS handshake and suddenly gets broken bytes. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index cc3783c..e89045a 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1545,7 +1545,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, unsigned int baud, quot; unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; unsigned long div; - unsigned long num, denom; + unsigned long num, denom, old_ubir, old_ubmr; uint64_t tdiv64; /* @@ -1670,8 +1670,21 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, ufcr = (ufcr & (~UFCR_RFDIV)) | UFCR_RFDIV_REG(div); imx_uart_writel(sport, ufcr, UFCR); - imx_uart_writel(sport, num, UBIR); - imx_uart_writel(sport, denom, UBMR); + /* + * Two registers below should always be written both and in this + * particular order. One consequence is that we need to check if any of + * them changes and then update both. We do need the check for change + * as even writing the same values seem to "restart" + * transmission/receiving logic in the hardware, that leads to data + * breakage even when rate doesn't in fact change. E.g., user switches + * RTS/CTS handshake and suddenly gets broken bytes. + */ + old_ubir = imx_uart_readl(sport, UBIR); + old_ubmr = imx_uart_readl(sport, UBMR); + if (old_ubir != num || old_ubmr != denom) { + imx_uart_writel(sport, num, UBIR); + imx_uart_writel(sport, denom, UBMR); + } if (!imx_uart_is_imx1(sport)) imx_uart_writel(sport, sport->port.uartclk / div / 1000, From patchwork Wed Aug 28 18:37:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 11119635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55FCA112C for ; Wed, 28 Aug 2019 18:39:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33853208C2 for ; Wed, 28 Aug 2019 18:39:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ptN3rghh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sjx0JPFQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33853208C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=xVsam8d72Rt2zAfZx8NaICpeabAZOxDpfOsIQoK+5aI=; b=ptN3rghhRUvHn/+mqUdsppKqai N2TrZm2pnb8EtxE1k69rTDd6etrxglkPAoeyF/XAD34JTyRlhHfMhsHcbSRN6RfLaIx/AHwGXO2zk sKE7SHOl7rDaj2xehh/qdYRvKtdCQ5OrcIFa27Fk5O5y5vW7//MbxdR7JQ/VxatG9tU5/D2WrFrlT X1qR3Q4RHRbaTOcSQXe4LQrfEUsG70z5OfUYT6wEL84I5eCN8sK4FmIxNaComzfB7beZJqTRHSkTK Fof7xX6BbpTTkwiW3Dhf6RivG8psIC3nKrnXi2ai22yieVzRZAxplKjyp+WGUE5Bih0DIoPxeUZWK JXz82SaQ==; 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 1i32qn-0008JW-05; Wed, 28 Aug 2019 18:39:21 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i32pe-0007H3-Tq for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2019 18:38:12 +0000 Received: by mail-lf1-x142.google.com with SMTP id z21so410648lfe.1 for ; Wed, 28 Aug 2019 11:38:10 -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=94QLFZILjt+R9uSIMn5NXhRdv4CTLDwWL1ZhIXmN8/k=; b=Sjx0JPFQ/5mQv31+zaAUpoNMO8NFVJxuk3E3z5By6c7YxoY2DLLWAsyuK8VBvNjW4k to/np/EkNWr8OlyM+Gj48cM08KgfJGu+TNYK3vu4/CpUfaowY1K/F0AnjH5zOsm5xxkq P1lw53K1cjGIap8kNep75ayFBzuZSmMEtq3IIhPLPUYPfBD8m85ToiTLREDNFZtCiydR e4/dRUBW7Bklflimdx1lY1EGwjNtMd30I5nMbzYxVrjuA7X1LlP8ixJ5oaHHuXkFDJ81 Qufo+R/MZ+2lm/JqaAURsKeo4AZ/6Xd1X5pWwRvEjZq/7OC/Aj40yIkTYAmeTA6htl1i rATQ== 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=94QLFZILjt+R9uSIMn5NXhRdv4CTLDwWL1ZhIXmN8/k=; b=eSn24zKbSe4Dz4NQkYiChXSmC46ERyaplVsJvGjcaWepHUtHhes0yUGjYZDbLGbDHF 4XTow7cIW+TZMWsD3sSSzrWZl9GTuRMUSRPYyH7Wq7eFbq9NlWZksNNXm3/6b/dDC/KU GSwtKvkynlEb/yFBaTOkfPcNbl5r9oUWM4PvAw3MnRMmFg4z0nIfZTCb2h/aTs2DnPli neMOIP+vxr8vhIzc0a9ES2CtFciyoxZmXSfusGmlXM5vK9LtzzCpV1VS+zRDYq3jj8m3 k248rW8T+Nud/YO2AlE/7xAKf97R4l+2gQOpkb9FceWXpRXBrpPykmYFgAXZI9ALe5Af taFA== X-Gm-Message-State: APjAAAWGAZPGGV5hqYS6M34ZcnpytCir2C1FDl8gtY10CkX8G8i5e98S MCpKSBkGzLUq2E7C45yigTY= X-Google-Smtp-Source: APXvYqyA2PnTA5e5wDo86A8QDyQ/uPkRhx8VsUeKRQC0LY4ZwQ5XaUQrYcQbrYeVaWZkr9A/n1G7vQ== X-Received: by 2002:ac2:4289:: with SMTP id m9mr3747085lfh.49.1567017489554; Wed, 28 Aug 2019 11:38:09 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id f6sm9226lja.16.2019.08.28.11.38.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Aug 2019 11:38:09 -0700 (PDT) From: Sergey Organov To: linux-serial@vger.kernel.org Subject: [PATCH v2 5/5] serial: imx: use Tx ready rather than Tx empty irq Date: Wed, 28 Aug 2019 21:37:55 +0300 Message-Id: <1567017475-11919-6-git-send-email-sorganov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1567017475-11919-1-git-send-email-sorganov@gmail.com> References: <20190530152950.25377-1-sorganov@gmail.com> <1567017475-11919-1-git-send-email-sorganov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190828_113810_991939_AE232A4F X-CRM114-Status: GOOD ( 12.48 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sorganov[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 This should help to avoid unnecessary gaps in transmission while adding little overhead due to low default Tx threshold level (2 bytes). Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e89045a..87c58f9 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -439,7 +439,7 @@ static void imx_uart_stop_tx(struct uart_port *port) return; ucr1 = imx_uart_readl(sport, UCR1); - imx_uart_writel(sport, ucr1 & ~UCR1_TXMPTYEN, UCR1); + imx_uart_writel(sport, ucr1 & ~UCR1_TRDYEN, UCR1); /* in rs485 mode disable transmitter if shifter is empty */ if (port->rs485.flags & SER_RS485_ENABLED && @@ -517,7 +517,7 @@ static inline void imx_uart_transmit_buffer(struct imx_port *sport) * and the TX IRQ is disabled. **/ ucr1 = imx_uart_readl(sport, UCR1); - ucr1 &= ~UCR1_TXMPTYEN; + ucr1 &= ~UCR1_TRDYEN; if (sport->dma_is_txing) { ucr1 |= UCR1_TXDMAEN; imx_uart_writel(sport, ucr1, UCR1); @@ -679,7 +679,7 @@ static void imx_uart_start_tx(struct uart_port *port) if (!sport->dma_is_enabled) { ucr1 = imx_uart_readl(sport, UCR1); - imx_uart_writel(sport, ucr1 | UCR1_TXMPTYEN, UCR1); + imx_uart_writel(sport, ucr1 | UCR1_TRDYEN, UCR1); } if (sport->dma_is_enabled) { @@ -688,7 +688,7 @@ static void imx_uart_start_tx(struct uart_port *port) * disable TX DMA to let TX interrupt to send X-char */ ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~UCR1_TXDMAEN; - ucr1 |= UCR1_TXMPTYEN; + ucr1 |= UCR1_TRDYEN; imx_uart_writel(sport, ucr1, UCR1); return; } @@ -874,7 +874,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) usr1 &= ~USR1_RRDY; if ((ucr2 & UCR2_ATEN) == 0) usr1 &= ~USR1_AGTIM; - if ((ucr1 & UCR1_TXMPTYEN) == 0) + if ((ucr1 & UCR1_TRDYEN) == 0) usr1 &= ~USR1_TRDY; if ((ucr4 & UCR4_TCEN) == 0) usr2 &= ~USR2_TXDC; @@ -1474,7 +1474,7 @@ static void imx_uart_shutdown(struct uart_port *port) spin_lock_irqsave(&sport->port.lock, flags); ucr1 = imx_uart_readl(sport, UCR1); - ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN | UCR1_RXDMAEN | UCR1_ATDMAEN); + ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN | UCR1_RXDMAEN | UCR1_ATDMAEN); imx_uart_writel(sport, ucr1, UCR1); spin_unlock_irqrestore(&sport->port.lock, flags); @@ -1778,7 +1778,7 @@ static int imx_uart_poll_init(struct uart_port *port) ucr1 |= IMX1_UCR1_UARTCLKEN; ucr1 |= UCR1_UARTEN; - ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RTSDEN | UCR1_RRDYEN); + ucr1 &= ~(UCR1_TRDYEN | UCR1_RTSDEN | UCR1_RRDYEN); ucr2 |= UCR2_RXEN; ucr2 &= ~UCR2_ATEN; @@ -1938,7 +1938,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) if (imx_uart_is_imx1(sport)) ucr1 |= IMX1_UCR1_UARTCLKEN; ucr1 |= UCR1_UARTEN; - ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); + ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN); imx_uart_writel(sport, ucr1, UCR1); @@ -2294,7 +2294,7 @@ static int imx_uart_probe(struct platform_device *pdev) /* Disable interrupts before requesting them */ ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN | - UCR1_TXMPTYEN | UCR1_RTSDEN); + UCR1_TRDYEN | UCR1_RTSDEN); imx_uart_writel(sport, ucr1, UCR1); if (!imx_uart_is_imx1(sport) && sport->dte_mode) {