From patchwork Fri Jan 13 18:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13101494 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 6498EC3DA78 for ; Fri, 13 Jan 2023 18:46:09 +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=Gl+gR9WdpZIjJvJzxW3PQU+cakYdOGk2UzjZTN0IaMk=; b=jSNUtK/9vJfPJy RijCpwZb+FkYDPtOwOFSNMdKJ91AyqO+KExN8wzDhw44mnGc5HblUq5opiEyDDksP8B3IQzgJSfqV C/zGDj8AxktwSwDs2c96ie85qkHUAm6CBkkSZiLPTYLzjOHER1nKiHDLoyWESBjOsN0lbNV4S4tyM 60lJui9BtZOQGgIzEpX808pQvGXykONoXE0qht4U1xDLSxg2vjjZi0Lh1bm1RdlhAROVLZMDdULwz REaGyh+HKQfLkLyJifmRSISi3LILeUW9OkJl9g8Z/5D0AtCySfHeH5SOJ1nEt9JEPF3Cut+S0KbBX E2T+O5iLxbH0hRZY5LSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP2s-0045fs-3I; Fri, 13 Jan 2023 18:44:54 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP1s-0045JI-0y for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 18:43:53 +0000 Received: by mail-lf1-x136.google.com with SMTP id x40so249417lfu.12 for ; Fri, 13 Jan 2023 10:43:50 -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=gEk4AFlxAF8T5iRhtAEH/nRNJxTDpq08gbezozP0K5c=; b=EST2u7+EY1BljGeUo+Jl+mIEA0GL3IUBwxEHYsN5Q+frpg+8rXwH/USoGKBXXuaaCq 4DNbVhaE1UxEjroEhkxeNYPTLsYfLK+yC4eH0+a3E2VRZQO287qJ1+vUifcABD7edciy ycSPaQLULmrLkqqGzc46TGE7VatG3iA9bXJE/PPeqthdFEiWQ0L0MDzDEWFRU56urgEK 47qq8OrIHpK00lgOiWmQJLNUc1ebiUV9rWtinefVmz43yYMhwycjYauOCvqVM4Z+8Toj uu7vwLvuTsKARCXTsFXHDttrpfuEgg4m2UyJGCEl9cn9qKPdI6WApM12xgUlj5CHqim9 9qQg== 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=gEk4AFlxAF8T5iRhtAEH/nRNJxTDpq08gbezozP0K5c=; b=4zqd7AQBm9e0lG3HRT5lYk/KdmbKIi22AMP8wpjZ8CP2Cma3YsgfvD6vzXklw7sC9K mk1nW32YIZ3jmYin5f0MeSv1JWb3so8haW8UIAAms4iy75SUYjJICXCP0cxMGzuayR0T 95kGpS3YisZsMG8uVNQtJ6Db8qF/jgSaWfHpp9GyrAABUbbitBDDHySHHTYsuOX28Ewv qohAVWdmJlHSGpWl8KSRGF5btNalfrPlilYbvYBiMSjHEx1St1E5fscG87i+097W7y8D cfSBDhD1INRRtFQzhM7DxC55iFyiElInmjzA0M40LbdwmxuUMbzChgPxluDhJUgF8TU3 EPRw== X-Gm-Message-State: AFqh2koscIZ6Ue4eFm1r7braetctG9advijA8NitTbOWW+egAoj+wSOY yTa8+OnbHXxFqMmWpdnPXBs= X-Google-Smtp-Source: AMrXdXsFRmXLBepa75IdA8upDEUsOGVX6bHbVT7iNgg7WPN7teH0vjcgcywcHXIQ6vaZhr2DUfGdZw== X-Received: by 2002:ac2:5234:0:b0:4a7:64ea:7855 with SMTP id i20-20020ac25234000000b004a764ea7855mr211232lfl.47.1673635429454; Fri, 13 Jan 2023 10:43:49 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id o11-20020ac2434b000000b004cc9ddce3adsm1261439lfl.82.2023.01.13.10.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 10:43:48 -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?= , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH 6/8] serial: imx: stop using USR2 in FIFO reading loop Date: Fri, 13 Jan 2023 21:43:32 +0300 Message-Id: <20230113184334.287130-7-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230113184334.287130-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230113184334.287130-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_104352_110766_6F10AEFA X-CRM114-Status: GOOD ( 13.11 ) 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 c44a7293c013..be00362b8b67 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)