From patchwork Mon Jul 10 01:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 701800 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C532C0015E for ; Mon, 10 Jul 2023 01:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230238AbjGJBkM (ORCPT ); Sun, 9 Jul 2023 21:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbjGJBkL (ORCPT ); Sun, 9 Jul 2023 21:40:11 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2051.outbound.protection.outlook.com [40.107.15.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C551EC; Sun, 9 Jul 2023 18:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nz9GfDwk+aE3ti3eJQ6QKgRf+C01vVf6IjeSQfpKqWgkUR74oW2KfcJuTYCeOCar/bLKjj0WyA/l7UQzf24I83VKdrkVIBj0A92IlQ43mfuRyNEpxstewjM/X76ZUEuBiTiVnXh5Q7scHfk+wuje2WgaXVtvmvpL0SYMhffeeTUe6VKdw9yvc/8wEXziMzOqC6S8pUlP0lDE5dF6GrU3E0doMlq2YfFDdG0AJ9mB3qz0bHNSbfC+0yZduHvLkT5kpU843C13UlwHaQCVhlqgFbLnhpiHD5CGbs0jpsnb0uxihSjHkLie/1SjKfywxnsLkbnVGMz2MINmrEPX50HpkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vABC8cqGISiJArF5df4UPRDI+ZOYYfgz93iDnE6pdS0=; b=b7eK2Lz9KDMIYvT/6rcd9/iV3yBpppuEwqKsd8konOh0RKY6Vm2H4EBJHtGs3sNgwJidn+fLJChx3Ft3HEbZcqbMSw7B/3F/dKGedz4GtP21thYVKaTrRz1QKFqG65JVFLN+muteJCQpXP+Dqyjz3zg9f3NOYnljz7Px9ifdjjtMfO+1mWPef6s4adIL6OfNLlHTLzhO8viiBvCXx51THjUHgUxRetxA664Q4fHwqJiAkQ6ZggFlo+/YS2w3wIeGdfk1SjLgah2goiVNX3L2olIZ1aGefXZw1WGpzAn8JeEhEHvCdviQ0WigFJD1JDVHkZwV4MIAelmOsNVbME8RPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vABC8cqGISiJArF5df4UPRDI+ZOYYfgz93iDnE6pdS0=; b=R1P8Xf4DtgaixIb1N5/M96cbZCLsmxTll7rPHLbN9WFBaTdjpNEG2Dw0pd4PRrN7npAhqO0oVX0bKCQokVP3dQ3Ldg/g4g8HX/6BfMQzjqB1CLLdqxk8bVHJZ8x/X74xtNmZFEASZVGni2+tJkMUdAJA+9xqmelNC/hVLK+OM/s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) by AS8PR04MB8117.eurprd04.prod.outlook.com (2603:10a6:20b:3fc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 01:40:07 +0000 Received: from AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::1e0a:1ed2:2e4c:6b6b]) by AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::1e0a:1ed2:2e4c:6b6b%4]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 01:40:07 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 1/2] tty: serial: fsl_lpuart: move the lpuart32_int() below Date: Mon, 10 Jul 2023 09:38:56 +0800 Message-Id: <20230710013857.7396-2-sherry.sun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230710013857.7396-1-sherry.sun@nxp.com> References: <20230710013857.7396-1-sherry.sun@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8404:EE_|AS8PR04MB8117:EE_ X-MS-Office365-Filtering-Correlation-Id: 12a92f9b-958a-413e-0170-08db80e69752 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNqhOZBpZadwTiASsOXxzilMxldLsPDHoaQhM3JiD491M1RBr2K5w2QD95/e7zIIcOgaSNscHZiUYpL63ogCAB7BO15G/ayf2EPHuxuQxxBlk6ThC/uk27VkJ1WDzaYeF8769wWYkQNtGm2m/iy3w+hFmGNJpt5DJScCxxHAQ2vcQPdCLrd5wmwL5T3tuW6gjhM/5CKiE7+AiH1Qx29hCUhV85K7iQ5WKAHpqx2dG+vtlDYENHo4sOGfwBWIj/qZihjWcxpJbdZJuUeVJ1p+lHTpr3XMUpk7SiUiH/268G028SctuALNfePr0gmU7EL6kgCbXmKyz3vVJFpl3WVL1Aze93SaFOTBf/O7Jf4unjxStgV2TEhTHVjALPYG8Fu7/9K0qetBcpGRyCE8gaWiISdR51FWOvhQPaCVkOLBB0jMMSMdHDzft8d7HHKvBrYOR5mhjN0GpPqp2MmUCXpnOUOB4ilCveixVs1Sdyrzcm0AlaXhxY20o7eifB4C7xRlCr5uK61oECX3rczIR3Ap8wORRTtakTrCwH8AXapw5nxYRoDQ5+bCeJnlAITctP8k3mrdnWxXVjnfvoQ3Z60VQrwHNnA7NRUXBF9sh4i1CJeIliK+29zdMbYHqhhilE7x X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8404.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(396003)(366004)(346002)(376002)(451199021)(52116002)(6486002)(478600001)(6666004)(2616005)(83380400001)(36756003)(86362001)(2906002)(66946007)(186003)(6506007)(1076003)(26005)(6512007)(38350700002)(38100700002)(66556008)(66476007)(4326008)(41300700001)(316002)(8676002)(8936002)(5660300002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ajnihslwGnE1Rn7Hf+ARUcwq8dUXmUDg8C3qeG3lXmE7Js6wlX0Dn5dg4kwQHU7pY/fS7MJDSsZh50YN+JVEXmdD0mlyst/kFkH+ym4uPWkBcoydkUYewwnZBZkW9YbpWSRBOaDd3nIPJr1thgbosk2R4VS66bDgdWr1qALn2iFuySd8unGnqDEassW/ahoFwW0jYABrFODMTlT4pxcEUbBoxG1kdQJj9QLPcEgQfASROcmJa0iOkDbu2qBCIANxSLNvleVBJaKVHqk0Bv/RK5kKTc0PolRDrFY6bDZgZph0nq8aHDSqvffb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/KxgpBJFJajUOAPPDFeELy3ElKz8z2tOlRsj0YXO+eQDRvJuPUOl3kHR8t38TfASD4asZuGU9hbMrpo71OQscpWdLdtZ3dNHt1Ouv8pdfvYAd5xti9LJhfHpI1hR48pofdB+CMftikS2kIXTa+/DkZTICgISS69hqSL9YqvNEFwa2li0ek7tUrlUeePygiKmIwXS2fzuC2JuQ1XPoq8BRApdm+A5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12a92f9b-958a-413e-0170-08db80e69752 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8404.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 01:40:07.4210 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0iI0PQyAM/VMToV2EGFNkIOQI0netzL7CUC2k/yIjeAk6ZvWNbHs2JbTIebh3Qe9ikUIZMLDemaUX0W9An+xOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8117 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Move the lpuart32_int() below lpuart_copy_rx_to_tty(), this is a preparation patch for the next patch to avoid the function declaration, no actual functional changes. Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 39 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 6c652d77f566..653cf8eb5a72 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1066,26 +1066,6 @@ static irqreturn_t lpuart_int(int irq, void *dev_id) return IRQ_HANDLED; } -static irqreturn_t lpuart32_int(int irq, void *dev_id) -{ - struct lpuart_port *sport = dev_id; - unsigned long sts, rxcount; - - sts = lpuart32_read(&sport->port, UARTSTAT); - rxcount = lpuart32_read(&sport->port, UARTWATER); - rxcount = rxcount >> UARTWATER_RXCNT_OFF; - - if ((sts & UARTSTAT_RDRF || rxcount > 0) && !sport->lpuart_dma_rx_use) - lpuart32_rxint(sport); - - if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use) - lpuart32_txint(sport); - - lpuart32_write(&sport->port, sts, UARTSTAT); - return IRQ_HANDLED; -} - - static inline void lpuart_handle_sysrq_chars(struct uart_port *port, unsigned char *p, int count) { @@ -1278,6 +1258,25 @@ static void lpuart_dma_rx_complete(void *arg) lpuart_copy_rx_to_tty(sport); } +static irqreturn_t lpuart32_int(int irq, void *dev_id) +{ + struct lpuart_port *sport = dev_id; + unsigned long sts, rxcount; + + sts = lpuart32_read(&sport->port, UARTSTAT); + rxcount = lpuart32_read(&sport->port, UARTWATER); + rxcount = rxcount >> UARTWATER_RXCNT_OFF; + + if ((sts & UARTSTAT_RDRF || rxcount > 0) && !sport->lpuart_dma_rx_use) + lpuart32_rxint(sport); + + if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use) + lpuart32_txint(sport); + + lpuart32_write(&sport->port, sts, UARTSTAT); + return IRQ_HANDLED; +} + /* * Timer function to simulate the hardware EOP (End Of Package) event. * The timer callback is to check for new RX data and copy to TTY buffer. From patchwork Mon Jul 10 01:38:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 701441 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19D3FEB64DC for ; Mon, 10 Jul 2023 01:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbjGJBkX (ORCPT ); Sun, 9 Jul 2023 21:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbjGJBkV (ORCPT ); Sun, 9 Jul 2023 21:40:21 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2049.outbound.protection.outlook.com [40.107.15.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE68C185; Sun, 9 Jul 2023 18:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WiE2LBcQbAWkeizQ4qT7wEoCmT9hzZLG0vREVWKmHR2N0Y/rFVFwqQkuaGhhaCYvA1ctqAZspAmyq9KUv/gfOn5usYNV03wTJeXDialDxpdUjM4KM1LQztRQ10C9Z2IGH+gqSlWaYSc2HOxtfYT8nofi7+ghMi6URiNMBJ0BxxVktoafzAPeJQgyNnGh+OS/E4xT7SrTOvDsCRYqU5IagxpvivEy10+Ns3r6pOPu6raLoaUB0cc3sZWGilRgW6Ycs7/O+CyaarRA0UXO81CBNv1Yv+XP/DxF/a0N7hmdr2+UY6Wyy11+mdBzKDvkk1SyhAozS4VTmx/FPXcMh4cvkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1qtVdq462+DW7zoeYYTpfwUwlGrEzSaHf9fJowXWRko=; b=RqF5LiB8ZzX+2kGzBelsdveHiM4HvbDUDdpUCmKSi0IYCj+LL2A00UxvYEkJ1hd52l6pZ1Qp3JW2WjMUsjc4mIOIHZT60UwI7UdwwffTp/ryzwnFtlEtnFtHdQ1BMBr1YhclAwyNWpo6AeG4HYUtrm7fzGpZFAFJBRziYIdBEOhrpRpaD9yVPLgL3w7Zyg0JTI2vreC622WudAJmpzwuXA0u/F+4zwtAj+rhSA2vAc+1NJYte6WIDjcSqcTEeonPdUBtk79axXOdz69akdoHo0pk5mj6aIx8NA/QfjE5ITGs0eVKKFTf5IUv1IWC3m6q2UOxjvSe/tU8EEyrFb/gFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1qtVdq462+DW7zoeYYTpfwUwlGrEzSaHf9fJowXWRko=; b=W8u/qdyWbpkLSlbgL9FWcOtUa6A0aeItZg9VgkfibZWBoFxRRNQ5RzUQp7NA5sJx7+Td42lsd/hYnoX3uqTYseBdKzEuRks8gFFYdcFhfBsVLTqQKqeP1sKFMw2N/iSO2t9mjpvo8ZcIPGyEG+dELNS8l9GM+hOASqoCl82XztU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) by AS8PR04MB8117.eurprd04.prod.outlook.com (2603:10a6:20b:3fc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 01:40:11 +0000 Received: from AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::1e0a:1ed2:2e4c:6b6b]) by AS8PR04MB8404.eurprd04.prod.outlook.com ([fe80::1e0a:1ed2:2e4c:6b6b%4]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 01:40:11 +0000 From: Sherry Sun To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 2/2] tty: serial: fsl_lpuart: add IDLE interrupt support for rx_dma on imx7ulp/imx8ulp/imx8qxp Date: Mon, 10 Jul 2023 09:38:57 +0800 Message-Id: <20230710013857.7396-3-sherry.sun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230710013857.7396-1-sherry.sun@nxp.com> References: <20230710013857.7396-1-sherry.sun@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8404:EE_|AS8PR04MB8117:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b0cfab2-6d7e-46f3-8bd0-08db80e699e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xl+nYG4frOtY8lMZuRJSsXgEwF/+3TmDODrxVyJ7peVNdAEkKEI0dfv6ULPr9loDqQwqTTaqhywEmpJ69QEgfomLu9mOg5eKuxaHPlvcNvApoWPSkOivsj8iKFtBHU1wi+D7t22cfy5CFslMYerrZaMyxKkWmQaQdHobpj893hHMf3jB007y8MRgsXoKqtDatOfLwv50j7DsKh3+EEXbSf8R7b7ymtqdcquzyDPTaA+0a8/bTq+LzCM0A3A2jQzmo+le7y/fz9v5N5Fd5CuijaGqFkYoXcg9zMFOgxGKMNMoeayfyMpEjoQr988WTCMzJbHjW5NqJj9nA+M/ZTot08a/IXObuH/iIsVODt8KVlJS2K4V98E18JHp/WUyCucRzNAt9UdknNlSjF0bGScvgrayhOFHrnsz1lEsiCV3dWis5lMd7sG3vQu39Rqm7DvEHmqZq7F60F4/rSDd84yQzOXiYvCf+cdeQngEYcoZHP9BiB0N1/eKYbVF2NEf9Xdlah4H1TYCS4FEIIMfV/d3qo4ZecrNFWfVHL1y/KSot/gCa1vs0+FJOTZWmTid19RnAOaP1rVDtvGAtfQCc4Wzo822L/vPC7N9kzNqkz+K1G9+uVNio3vOByxVybImjRlH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8404.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(396003)(366004)(346002)(376002)(451199021)(52116002)(6486002)(478600001)(6666004)(2616005)(83380400001)(36756003)(86362001)(2906002)(66946007)(186003)(6506007)(1076003)(26005)(6512007)(38350700002)(38100700002)(66556008)(66476007)(4326008)(41300700001)(316002)(8676002)(8936002)(5660300002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VmP545nnoSAUwmVUh3E7t6SmWnvCZeUSYj7Kd616xBRNA1Cj51o5lDfyvRubPeku5i985UOzkqIC3yM8zTH1IO63VE2HH83gmer1HfDGCRwrbK4cUjPI3yxfdfPgn81MDhubqxQ0fNu2+M+YuE7XCwi/ek2ICqzW5eF8cOWXInNLNBQz/UJ2AYhZD1BP19b56cAFJZQbsqTTl3NpNPZqcjFaH9FUy32EjsgFza9ThybEQuAcrE8XPh19oA6geJkXXqyVso6ORi+quqc6Nxw5xY1uWuPCkO/68GBLTgRNEZ2KSyNxhLAA5W27DPfhe5/tijvPGGKk4pWHxMMR18RVa+Gs1C6GH7ZGHUzaCHJAAfPdmA78ji/JtaRlgixCiRkVy5N1zURoCQk+jC3QCmtYaLSqCV4BMGnidf2XSyM2xecwGcIEtuI+GCwQvMsCCxRW/EAfkYpGXTmz3JeaigPyULqHnZlTh75f1LPeSo2GMNW6hSzAinlD8viAWLlzKm12ldbDoSltSSxi6+N5bI6SuVIkeEtOd0ELloWVJUJcniXfU3xEpQRZQE82hV8iHe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3b0cfab2-6d7e-46f3-8bd0-08db80e699e1 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8404.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 01:40:11.8048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4d8LoVGWJn1saPWeiDcTihhSN18YjQGLH8q2KiyY0M9RGRyIJvP776F0fEJ3dqKkxCFaFthRi3mwemEyfmmv9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8117 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Add IDLE interrupt support for receive dma on imx7ulp/imx8ulp/imx8qxp platforms to replace the receive dma timer function, because the receive dma timer has bigger latency than idle interrupt triggering, which may cause the Bluetooth Firmware download timeout on Android platform(it has a limited FW download time window). Signed-off-by: Sherry Sun --- drivers/tty/serial/fsl_lpuart.c | 44 +++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 653cf8eb5a72..c1980ea52666 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -290,6 +290,7 @@ struct lpuart_port { wait_queue_head_t dma_wait; bool is_cs7; /* Set to true when character size is 7 */ /* and the parity is enabled */ + bool dma_idle_int; }; struct lpuart_soc_data { @@ -1248,7 +1249,8 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport) spin_unlock_irqrestore(&sport->port.lock, flags); tty_flip_buffer_push(port); - mod_timer(&sport->lpuart_timer, jiffies + sport->dma_rx_timeout); + if (!sport->dma_idle_int) + mod_timer(&sport->lpuart_timer, jiffies + sport->dma_rx_timeout); } static void lpuart_dma_rx_complete(void *arg) @@ -1258,6 +1260,28 @@ static void lpuart_dma_rx_complete(void *arg) lpuart_copy_rx_to_tty(sport); } +static void lpuart32_dma_idleint(struct lpuart_port *sport) +{ + enum dma_status dmastat; + struct dma_chan *chan = sport->dma_rx_chan; + struct circ_buf *ring = &sport->rx_ring; + struct dma_tx_state state; + int count = 0; + + dmastat = dmaengine_tx_status(chan, sport->dma_rx_cookie, &state); + if (dmastat == DMA_ERROR) { + dev_err(sport->port.dev, "Rx DMA transfer failed!\n"); + return; + } + + ring->head = sport->rx_sgl.length - state.residue; + count = CIRC_CNT(ring->head, ring->tail, sport->rx_sgl.length); + + /* Check if new data received before copying */ + if (count) + lpuart_copy_rx_to_tty(sport); +} + static irqreturn_t lpuart32_int(int irq, void *dev_id) { struct lpuart_port *sport = dev_id; @@ -1273,6 +1297,9 @@ static irqreturn_t lpuart32_int(int irq, void *dev_id) if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use) lpuart32_txint(sport); + if ((sts & UARTSTAT_IDLE) && sport->lpuart_dma_rx_use && sport->dma_idle_int) + lpuart32_dma_idleint(sport); + lpuart32_write(&sport->port, sts, UARTSTAT); return IRQ_HANDLED; } @@ -1394,6 +1421,12 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) unsigned long temp = lpuart32_read(&sport->port, UARTBAUD); lpuart32_write(&sport->port, temp | UARTBAUD_RDMAE, UARTBAUD); + + if (sport->dma_idle_int) { + unsigned long ctrl = lpuart32_read(&sport->port, UARTCTRL); + + lpuart32_write(&sport->port, ctrl | UARTCTRL_ILIE, UARTCTRL); + } } else { writeb(readb(sport->port.membase + UARTCR5) | UARTCR5_RDMAS, sport->port.membase + UARTCR5); @@ -1409,7 +1442,9 @@ static void lpuart_dma_rx_free(struct uart_port *port) struct dma_chan *chan = sport->dma_rx_chan; dmaengine_terminate_sync(chan); - del_timer_sync(&sport->lpuart_timer); + if (!sport->dma_idle_int) + del_timer_sync(&sport->lpuart_timer); + dma_unmap_sg(chan->device->dev, &sport->rx_sgl, 1, DMA_FROM_DEVICE); kfree(sport->rx_ring.buf); sport->rx_ring.tail = 0; @@ -1671,6 +1706,9 @@ static void lpuart32_setup_watermark_enable(struct lpuart_port *sport) static void rx_dma_timer_init(struct lpuart_port *sport) { + if (sport->dma_idle_int) + return; + timer_setup(&sport->lpuart_timer, lpuart_timer_func, 0); sport->lpuart_timer.expires = jiffies + sport->dma_rx_timeout; add_timer(&sport->lpuart_timer); @@ -2833,6 +2871,8 @@ static int lpuart_probe(struct platform_device *pdev) sport->port.type = PORT_LPUART; sport->devtype = sdata->devtype; sport->rx_watermark = sdata->rx_watermark; + sport->dma_idle_int = is_imx7ulp_lpuart(sport) || is_imx8ulp_lpuart(sport) || + is_imx8qxp_lpuart(sport); ret = platform_get_irq(pdev, 0); if (ret < 0) return ret;