From patchwork Sat Jan 21 15:36:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13111161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2006AC004D4 for ; Sat, 21 Jan 2023 15:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7V4wtxB86JijfW0vTmgc8vyeECFTkyBO92tUw/sdAKE=; b=iduRWDGU/sHvwL 3RbNsMwdZtLLkxLclz6wxajEnOYb81c65tyxuJLvWlh1L0eGpYwb5Q6G5/4FlpS9NBr4UxahUarYg 7/rKWp8wE3H/IUScnrvNpwIb4yneYU4WHQdCM06mw3zlccZmfNo2GiOoSsWPLXmflQH9Ky6IBzVDD p3c4SaKpePK8KF/fco2ECK9mhB25gEXSbEPU2wyf1gQGKjEBpSQ20EvVUOYuk/YiPTVi0XXFz0e0X QpgfYyCjMMa/0U9dy3IJOY+/QgcKKSNxI1dSJtdeFKLWEI58mZzoTnxh7CmQrON9cAjP5NoHhwLXg r1O3WYvSDJtiSrZEQfCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJFx3-00E4fY-J4; Sat, 21 Jan 2023 15:38:41 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJFva-00E43E-Hu for linux-arm-kernel@lists.infradead.org; Sat, 21 Jan 2023 15:37:11 +0000 Received: by mail-ej1-x62f.google.com with SMTP id v6so20850011ejg.6 for ; Sat, 21 Jan 2023 07:37:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L5v/xKpmgx3IRd85qrBv3zwjvdUmTrkcJb9ZlFLMDeA=; b=VHBApdFOPZlOveIj1sbYZ2BXz/eudd82xyd28Uk6eQ3ZM9AMJ7E1Hmy0JsbMflSpAa wcaWe+Xta+zgbBmhWusTulf46g/Nf6EOxW1pE4lA4PFZ44e3d3+1f0Kj1U7GN7+CytlR ywwnyseDKSetNt7P8XnsQP/qd+lf3By1EDIaZ2D26fjlPGOk/mqXNLOiMpgKHQwO4V2a imf8X4tZpBwVumCswjMlZMPXCHThQZvcuy2i3qFb6V00wpZ8lMntAleJKUu1JdaKaIhQ xi0noeO22vZXEQ5ZocSXAIUUsMJWK9lRaF7Vk07hg+83PxnGjW8Na7PkJWrrWnYugja+ pPpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L5v/xKpmgx3IRd85qrBv3zwjvdUmTrkcJb9ZlFLMDeA=; b=2nPcT+UosrTul9vKqobBraXHwle7FEwfL+MuFlTmkuDwQlDmLfriCMlALODBPmzT+U 8sWYbiM4Wf9EadkeqgAcsUTj3xouOTYaBm40+zqPmG8qElNz+qZKv0gkM8UsHua2up95 +lfN4Y3QS2n7uT24U9GFpUTKe7Tcu9uuhkpzGOSNUZ4x+7YZ49FduWhwuFuM6iFKzBFJ g5/5A/AtQ3UpmSBO5CggFmVMSiNQmCY+1LgzD667gcXMZvBSUAZjSyJDgvhJw/cjHtVg vNWASni/40KE1X7TYKMfGTXbtjcxw5EmGt8D9EOyPivrusf4LDLZbRE7RMls9BH/rmdA aqEA== X-Gm-Message-State: AFqh2koBFttU4iBf6/tV/ZvUPVItDfmGn+0pYdZe3isjcI4qDE9zhtwv o1cYpFfYGWFD5kBXXFKd9Ik= X-Google-Smtp-Source: AMrXdXuSrQSmLVE+LDC1ygBKS7TGV/TZreUIwxcgMvbeTLF5GCi5bkAkPQJ55dKBfGfvBmRu3dUFcw== X-Received: by 2002:a17:906:fad4:b0:7c1:2529:b25e with SMTP id lu20-20020a170906fad400b007c12529b25emr19869516ejb.43.1674315420658; Sat, 21 Jan 2023 07:37:00 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id vc10-20020a170907d08a00b008717a377125sm8187030ejc.85.2023.01.21.07.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 07:37:00 -0800 (PST) From: Sergey Organov To: linux-serial@vger.kernel.org Cc: Fabio Estevam , Greg Kroah-Hartman , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?utf-8?q?Tomasz_Mo=C5=84?= , =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= , Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sherry Sun , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH v1 6/7] serial: imx: stop using USR2 in FIFO reading loop Date: Sat, 21 Jan 2023 18:36:38 +0300 Message-Id: <20230121153639.15402-7-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230121153639.15402-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230121153639.15402-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230121_073710_636712_D79CF74E X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The chip provides all the needed bits in the URXD0 register that we read anyway for data, so get rid of reading USR2 and use only URXD0 bits instead. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index af4349fe6970..488d8119562e 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -892,27 +892,21 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) struct tty_port *port = &sport->port.state->port; u32 usr2; - usr2 = imx_uart_readl(sport, USR2); - /* If we received something, check for 0xff flood */ + usr2 = imx_uart_readl(sport, USR2); if (usr2 & USR2_RDR) imx_uart_check_flood(sport, usr2); - for ( ; usr2 & USR2_RDR; usr2 = imx_uart_readl(sport, USR2)) { + while ((rx = imx_uart_readl(sport, URXD0)) & URXD_CHARRDY) { flg = TTY_NORMAL; sport->port.icount.rx++; - rx = imx_uart_readl(sport, URXD0); - - if (usr2 & USR2_BRCD) { - imx_uart_writel(sport, USR2_BRCD, USR2); - if (uart_handle_break(&sport->port)) - continue; - } - if (unlikely(rx & URXD_ERR)) { - if (rx & URXD_BRK) + if (rx & URXD_BRK) { sport->port.icount.brk++; + if (uart_handle_break(&sport->port)) + continue; + } else if (rx & URXD_PRERR) sport->port.icount.parity++; else if (rx & URXD_FRMERR)