From patchwork Tue Jun 13 21:31:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692195 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 6BBA6EB64DA for ; Tue, 13 Jun 2023 21:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240275AbjFMVcU (ORCPT ); Tue, 13 Jun 2023 17:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235301AbjFMVcQ (ORCPT ); Tue, 13 Jun 2023 17:32:16 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 286D9198D; Tue, 13 Jun 2023 14:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KMonqQWGzcCczcQrHoEzT8YRyHlI4FpV53KDvWGsPGAHEt8XkpEohKsvhSGIEn0xhgUIotAuW7bRXXcqc+29veEli8l4pZF48f+WDF+RB16jyYpypi/d5HRVJzxuQjpjsrwWlrct3Frgm98vcIR1y2+IaRqjGGoJMbG9ZIOtNdAS30Z0uiODOMiBfROdHTq/VbQAhRZyMGL8v7Nno6T6U2hfwAAmBlmH5c3Q7qv11ztr//YyzYS3p3rh/VGd5/bXce+LEzs/TBkD/EhgBCh7/+UFXkMFzetcsq6E32ThvenAqrUvezfAakQROFgwEys1G0MuQBeMOB/5MIhWQ7MVNQ== 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=QI8n0XPwXsaaH6UZQG+Zvq7pxrcY++lIzGOz4LgaYtE=; b=RdpzkdL53uOwHV0DSSnpJODvgkVxrvkgCH94Y0CdBHx3eOgm7i5QtUG4eSc6gHDrcLSSk9R6+EZXaF16X6NPeuHz6bJRvr/0/KAzK++FVR4bAYSw2BsTmSe1h7ZKPkCNDUMfwwLLboaLbGqXv6VFXCwPvBVtQ5EoiKLmxbU7VSZ1UJHefK74r9L8bAQ6jeFQBcpMjgZCAc8Au1Hu9LN/WoO5/yrQ63UeH4lS0CMVySo3lYz1z+/sRQ67cZuosuheTSH+DciL1ajekyT1cfHCUWXTwxCL9JH46OXNSbPrv4Jl4KIkYh+fT0z+DdN5M0fBmnKfiHS37KIRPDzbaOtSRQ== 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=QI8n0XPwXsaaH6UZQG+Zvq7pxrcY++lIzGOz4LgaYtE=; b=M9PJBhoyWLUPn0nn96VN4e1ufOSuUYuZXbz6pVa2KBFE/By9OD8/ZwpuOyKlgnmSc4zO3aTHcB73xd2U/Vg+6o5G2FLfEJY8lO7bfwfFHUhwy2iI7XL4ShGRmxAXs+eUgqo70ue4PqL80fkWR+cEe7IkRZfRf+lRZw5UvAC3pWg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:12 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:12 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 02/12] dmaengine: fsl-edma: clean up fsl_edma_irq_exit() Date: Tue, 13 Jun 2023 17:31:39 -0400 Message-Id: <20230613213149.2076358-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: 065189ed-9393-4c68-bee2-08db6c55a695 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zjq5g7s95+V+lcqiT8et+Twh5n9s26KSwtc5KtnU8W3E1GOwjSAEFhcIRmCRFVvnKgqKL77wrqniBiYyNQOnYozr9nqmybNoLPl42gu0wyErk18cu1Qi/BWKlS4ztrWyEmlgjQ8XRx0dZlh+suMrAH3NpBF1Ry46Sls8nkOu5awR5jxQKbeQbL9wOM+7kF5RTTVcMlgApR/tskJcn2+RmxpW8A1int1oLzSWle17K/xuM4NW04IN/4LMugnxlrlzLZ8D9b7CjOOA2yq85+qXWC4cPMydGOLffAPuM36nwmroW7eCmTLP91bzcVTML6G/2WiKPIL+WZeddTMlhrTu+t1wSP4Ig+CmDJm5Vxl+RUMyYMbR5Ss9quw993jtwsLHJ9AD2EWxkKumkYVf+TQIDlV+KnoUw03uMeYybDTfrgVA1vH7CdmWkpFZKSfEJQxvmSrykm3z2IQfnTEgxwsKa0iz32JtqV6yTOo/l28h2SstrXEftMTsOfi3L8i4HjMrPBs9QfBNeJ+rXlFPspe25JCVKDIbvGp2NXPsAKB6vOZ9AHhTqMewgshFNFGTwXFqu+n/cfPkRU27dJNbGVHI8m+ZPoBSI27ppxQsRfuJFw05taM+OkR454WJFHg9RYnr+yltgnsuGsLtGVvAk6PfLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(6666004)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AhH+cfbyR+r6/QcYmsQK3oVZpkYg0tKdv2qawgxaczIWCJVj9MVN/X5j2Thh04KzcA69lTi8HGmBJb6bYVngSDnJ5yJRuJUMQ/QdwmwbajRsK5BZbqu3u4AbauFZYwVoKO14IIgCXGIe21GrnyxMauTj7nOHubiyMr/Ty6F7AL8tnYfL4iM3kDmJRW01HgbBkL4AQcBeA5uYd71wcjIKgGDlOqNDrUQlR0+pKL/pHzqxmu5Oi28tzxpHJ9cm+V59bDiA3zDfquaS7uJ859pSkTxUG6s81H//oUM+2McI4Z7euMx+Cm1lWsahE8Qnpfq0ZSg/kOHTj/qPGNWa7f532c/yZWCCuCHSNqrsTP9VYrT6DD1jmNUkwJpuU54+fWZFw6mFj2zLxFKiVUX6WZR/ZjK2E6HiKlr6uqSxuIl4Fni4Cn886UodtxSVrgI64+t5qNYMD0e4Flw1iN3Fis4jwKu3EftRVXFZu/VEfvOWXZhqShTL+ZNEkirsNcKAbZkESHCzEq6gl+n5Z5lSYKuQ1rbYqMF6MLA80HS/G089Zjda/o6fiUzVYpKxDFWvSdYFTu0vEk0JWch2UoJjQwFQ8SIIRHIlb/t3zh9huq2MWRUaUgJjW1wNGTmY9J6ln01JQRAL2hhU6Tt+PDNOzR+LaO9q4m3PO3M86ApOQr78ctiFETMbdgP+RpF9HGhrJ4c3/iX9TAhGRDQoPcTfn4uqkogJudvKjrPTf1+IF/aW3dMh5PbeE4QAN0IV/pgviadCqRBzj70OJ/j3ZvoVkIXTlSIAFA/gOIjcusyG6tUlO2T9okzdoLkEepA7ThNk4PTlcvRq1pwfzDpN7QW6Os1oHMFF8bSX8BaKh408KNY1vp/WRZQznGLyes5xOXs1mJz0WSneuTThv5A5DtZwxQQLtr9vhW1af05jiAUvjXzZcwb+tn56whUekKVhVmS92tDyMXlk6TR1w8qSs2rJsb7fg/JRJuXmvEIjL0JfttLAes/Fmswt1ypDPR56g8GQpPk0Y3snABBNQ/pDmjDHoog9jjoeapJlvA6oqPTpyGzu7nyXSW5xYQxi4KlBse7Ji4I3UcJuAvkyeZeA79Ui3bAgXi5yh7Oe/n8qlB4jlNlu1qWJZ1BJ19Nz8G0NmLvu8l+AR5igqBK2s1bpx3MeIaFKsQ3sAl3tRX1mvwnrb2hh3PCGtljdADkmm0PQzSbUb2cr/k9DTy6d6a0skAmuO9tI+SRxF0b1D/gWOLZTfO8GEBKjZHZQ/0HyKd6Qw5tZ8PTDNM2wGpQ0Zqa14+W+RaHyK/t3fDhhBR/peESaLO7fOPP4Emq3Q0Q75c6/HjpVYtb2hVWuqovESObWn1HsGOW8ADOtO/Diry6HvFrL0Wc1or8r2qRDPdwVC/Fg/NYRlOBddzpAEUP1vJM1OB9wgR73vZGKL8qgevPGuJ2+Na9UYngpVID68OV+VrmxMeugLFNbQWq3PqVDLMclkDE1KGSjX+s08Opz2saMZGdDv+orwPgu4tfAWA9R9K1XYXZi/EAxJUtvE05HxPt40xa/HTW1jOM+UFtdeUDDwM73GJdvnWI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 065189ed-9393-4c68-bee2-08db6c55a695 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:12.7993 (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: tGEJpUmST6BDd8JfnFr/B63VA+L5f38icC9RtTQsjW92mQIEbbYTY8M2Bgap4XGRSM7bzw8ojdx4DrE9crqH+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In the probe function, devm_request_irq is now being used to automatically manage IRQ. It eliminates the need for manual IRQ freeing during removal. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/fsl-edma-main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e40769666e39..16305bb9a2ef 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -216,17 +216,6 @@ fsl_edma2_irq_init(struct platform_device *pdev, return 0; } -static void fsl_edma_irq_exit( - struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) -{ - if (fsl_edma->txirq == fsl_edma->errirq) { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); - } else { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); - devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma); - } -} - static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) { int i; @@ -427,7 +416,6 @@ static int fsl_edma_remove(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); - fsl_edma_irq_exit(pdev, fsl_edma); fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); of_dma_controller_free(np); dma_async_device_unregister(&fsl_edma->dma_dev); From patchwork Tue Jun 13 21:31:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692194 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 9A7B5EB64DC for ; Tue, 13 Jun 2023 21:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240430AbjFMVce (ORCPT ); Tue, 13 Jun 2023 17:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbjFMVcZ (ORCPT ); Tue, 13 Jun 2023 17:32:25 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD091BF0; Tue, 13 Jun 2023 14:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ve5jmmCBGWurYfsXRJjxTBQ+ANsObAcJWhOMBKMgRbe4EnSxTArpr/F7Hs2xUpOAAH5ZMGaiNBE5lls2K2P25C7eB6Oyuiwz0MTHNiT5gtON0ckOs1jva3Hzwql/JlZRqtWQmQPCrYbKTb1U3zT/C057b8myBX7hY7qrYfwuPpGAelsOSXszu2iB7y02M57c1N8w7t5rQx6U/l2NaGsmEWyaCPYqwgTce2cenaYrrN1j8fxzs978mMUHqQ6Vox5tuz3TFQN/l0+UrkrWuWIW4r1Pgf14QuEr3S3TWIE9+B7AwJ5Op4L8YHfoQ6RmAWz3YVEhCQahGpKvyq9b+99O2w== 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=qtVmb2w/gc4SRB2f37IwBcHKtbBBAdft6k4Ina+w9xI=; b=iRFytWhk0yfMc+ZokDkZfzQgwyQgqaR9boH1kYEDV5x2lU2W6DZynmfAVvLpCDIDaesLD+8GsNUED5CkMHwCDqgPKU+C1h0ssEk+ceyCRQQwEKFr9Kv3TOhh4XVCBuDsya+Vbl9DPY8UpwccCRK1Qzg57AjV1kh3ASWtRjXck79mtuP0eWt3q9czIbtTk8QPJBCe7RLz5Ld2k3yXyQhAydl81XItqfwZWV3XByl9fQn22BAt7zmcPlPS9pRkNzK3IkTXtHliPsxJwiOpCtf+ppJQPeSN9WSD0fI79qyeHjnXwdKk0+ttRcLgdVBZS+nyvISMbAVXyUl8Rx5J+a5v8Q== 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=qtVmb2w/gc4SRB2f37IwBcHKtbBBAdft6k4Ina+w9xI=; b=AT/zg1mWr3waX/rRdNlQ/43VVuU/0QvusWKA8oxx57RdD6xtdpgD5RbBi0LPMnaTTOx2/EUeJiD26JUtHUMVNx1/OibFA7RCW1j3Zwlbrk+N30S986KK4dNPognXO27f4FPGTJpS3jSi/sdMEtYzW+wnsVH56mHMrjKMoPtc3ys= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:18 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:18 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Tue, 13 Jun 2023 17:31:41 -0400 Message-Id: <20230613213149.2076358-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b3e134e-69da-4160-eb46-08db6c55a9dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IM4CKMNtXO8diM6wz+Qbp76eR8hSzb2JLL9uFTeUfqIXESLOZ9L8j6AYnoSHGF40beeYfIfr6tmAIgg5Gr0wwqLWn+QVrFk5GjPjB08kSY4wHY9JxPy/NFu9hc12bi5ODGZBhomlhHBVRNjrb7Zmo6tJFvj59XgNmSzP+NnpquyV6FcEb/NtyaqDM7vz/e1fFklTPQRn+ujiExpW6a8ufmWlzC4NPCYY62JXXeppsh6whvhMlR1jHIYDwQIQJ+hqwCN5lyY46SG3/PIk4SP3pFkkcdQ112DcWkhrvOHwhTTN3BwCXsKze1InfamN8vh5OGUOrilKQK5M3GtvNMso33LrS4d2e4p1ZIGulXX5xemyTuwXGZNA5M1lvGxWOGLx+QrUZLuu20yHd1Bs+PGKOwLrI9DYO9xPhfoNK76SN8Gwp1ueJ0L5SaSn93h3o7i2I52YrK/GQ+sMFZWv0LD9KXHGn5Tro0x9Tx305qfGN4/TikHitKkYVSpOW0Fty7SOtHrCzdtjrndsvPE/97pZpvIZuFG3QkF9QaXR5XlFEisDYO5KXKtToH/LvmGPjUz3Hy5lcJ4SIOD/5+bfImATp3UW+ItEKhRx0PCzmH0pR+qOVIgnxoUXkgeE6gJFvjMkhn4duURNTw/vJqwRf3EoixQ/bMsaYn5hns7Louw9gDE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(6666004)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xEbcduWY71FLfNbjjaF0KvYh+vwOUcLK/siGB2iMH+QogqM45WZ/jekDvOIyy7HbpLMqgJmnWxecIak34mBxlOGgOoxnDqRdBUok/jwkrEbNIgT6/Tt0GfT4pZNjtY3Zab2f8OHd7FNsdKRrWnqNUI+jYSGMFzYP6CoLYwoIklv5LBxOPt4hdZOjHzNFlzUJwgxEMLkAenSRFkZSvFmYnQzodh8pDkg2Ihv+ZlJlxYzTOAsurn9MSHjkvU/AQ+y8j2SbLKiWr0d/Pf36T1NmgSyE+7hi66TXW8LmZUG4hHJ9yk6NHjpBi2veArDTBFXHuGElMEJxHLBBAxy9qAoPtHnq4V0SUEZDhb3DzWif0jexnUfpwrWtcjbTcybg//nZw2rg2vRckeNAb9kfasfvz0VjVuGG8B9nli9GhZ39ZjcIKJzZeCeR4kUdzQ5tqpXCCyF6VNmJBIcBTutLPa4n/mrNTpUc+TS+OSyOfiyTdoRL7SlISDDMF0b7QNVIB2fq/oBRSUcvugeMVyxbgOA6nli2UZ9ztwxdBWdszqX3xqTXRQy6XwOz1r792GrMe5eB90Hf//ftpkzI0z13VVq/fqvpkRdezVYiQ5mLF1X6lF6RloemmaOwtEoiVDHmsZjk9iinTPQKqkDtlyQTL3t21Unk/98hTkNtV/xLvKH/gd3XUrcnzCh0R2z/BNQMDscksb57v5JBefYt7gbfrQ3RkDqwqJjpWrI66ZRcO3k+wufVDUSjEFQMB5+Ak8TIIWr4QP+PXvnP9VALKxsujgP5gI5v8asXSeswk++FUHNcHBL26v4bmhXzSGn4BcAEtCUBYc7ekqIlSszs/nohNAh3s3cpjqz6eO6PzhGHh98UW8TQp1/YcUMyudLD5mBUIgwPqxfb+qILPLPsAKzqCAlY4dqMMovpcXurePfCDFNciwBlKV07g0KXcA7NdMUQdIg8iYeN+nhu7Rf9KGQkL2Pr0zYFOELU/xkeRRPiFWNTly8N/Ok4F1hMQCsBjAhhHk/Hj/+ouGHwUaz69nmfy1cemQXcTyqLuFydwpXi8spH3oVCCBoyLuKcY6XT0TCPUwrdY2/JtQtmy1DpKbDV1drNZnmg54Z7rJSeePesqwCFEZSzjKza5RIsrm/qiMaiDmf9egHsH/L3DTKRUDfgkqzAVcSRVDMgrCBvyPF+9gpjYdEPV4bIa4ULx7WRme04kq/GSUSLPMqtHsJmn9FLQ2hq+AZYhMJgSxFsgy1XtXoDh8PwSITy/ocSyj/zs8axmLLqaUm0tWVqIZNk8F8gVLxh8ANsO8jmNdTOZjNCzmWfVme51EzOmOBlkzi98XiyVGMy41uqV5GkF8u/18IKSRRVCB7iGBr/0mb3/mpaou5wttD+PdDTZ6vCANZMvpY77mJxbVqm13gZdmWkwbCfF/1/URVH/R99DyyCEIjy/Klq0OlprALU9ofVeUpgWnxsNr57B3j0klNIJ4KzKzAIdJAeqrqxH3w63JdQF6v/1Ecbmz83yI4980S2SPxUKbRMCgPQsdXcAhH8XCF0EvX7C5M4eBnH1Z9ohHOy4N8Xk1rJ78I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b3e134e-69da-4160-eb46-08db6c55a9dc X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:18.2756 (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: pjJ2Khfn/75y3IJNOBPjRCkIuf0M77BmBxMugQmGteqeI7qwTp3Whu1hhcxebSFxBPVoJf8RePbSTBT1uVC2dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The enum edma_version, which defines v1, v2, and v3, is a software concept used to distinguish IP differences. However, it is not aligned with the chip reference manual. According to the 7ulp reference manual, it should be edma2. In the future, there will be edma3, edma4, and edma5, which could cause confusion. To avoid this confusion, remove the edma_version and instead use drvdata->flags to distinguish the IP difference. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 47 ++++++++++++++--------------------- drivers/dma/fsl-edma-common.h | 10 +++----- drivers/dma/fsl-edma-main.c | 8 +++--- drivers/dma/mcf-edma-main.c | 2 +- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 10dcc1435d37..9948babcadf6 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -47,7 +47,7 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); } else { @@ -64,7 +64,7 @@ void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); } else { @@ -120,7 +120,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot = EDMAMUX_CHCFG_SOURCE(slot); - if (fsl_chan->edma->drvdata->version == v3) + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_CONFIG32) mux_configure32(fsl_chan, muxaddr, ch_off, slot, enable); else mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable); @@ -682,9 +682,8 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) } /* - * On the 32 channels Vybrid/mpc577x edma version (here called "v1"), - * register offsets are different compared to ColdFire mcf5441x 64 channels - * edma (here called "v2"). + * On the 32 channels Vybrid/mpc577x edma version, register offsets are + * different compared to ColdFire mcf5441x 64 channels edma. * * This function sets up register offsets as per proper declared version * so must be called in xxx_edma_probe() just after setting the @@ -692,33 +691,25 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) */ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) { + bool is64 = !!(edma->drvdata->flags & FSL_EDMA_DRV_EDMA64); + edma->regs.cr = edma->membase + EDMA_CR; edma->regs.es = edma->membase + EDMA_ES; edma->regs.erql = edma->membase + EDMA_ERQ; edma->regs.eeil = edma->membase + EDMA_EEI; - edma->regs.serq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SERQ : EDMA_SERQ); - edma->regs.cerq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERQ : EDMA_CERQ); - edma->regs.seei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SEEI : EDMA_SEEI); - edma->regs.ceei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CEEI : EDMA_CEEI); - edma->regs.cint = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CINT : EDMA_CINT); - edma->regs.cerr = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERR : EDMA_CERR); - edma->regs.ssrt = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SSRT : EDMA_SSRT); - edma->regs.cdne = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CDNE : EDMA_CDNE); - edma->regs.intl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_INTL : EDMA_INTR); - edma->regs.errl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_ERRL : EDMA_ERR); - - if (edma->drvdata->version == v2) { + edma->regs.serq = edma->membase + (is64 ? EDMA64_SERQ : EDMA_SERQ); + edma->regs.cerq = edma->membase + (is64 ? EDMA64_CERQ : EDMA_CERQ); + edma->regs.seei = edma->membase + (is64 ? EDMA64_SEEI : EDMA_SEEI); + edma->regs.ceei = edma->membase + (is64 ? EDMA64_CEEI : EDMA_CEEI); + edma->regs.cint = edma->membase + (is64 ? EDMA64_CINT : EDMA_CINT); + edma->regs.cerr = edma->membase + (is64 ? EDMA64_CERR : EDMA_CERR); + edma->regs.ssrt = edma->membase + (is64 ? EDMA64_SSRT : EDMA_SSRT); + edma->regs.cdne = edma->membase + (is64 ? EDMA64_CDNE : EDMA_CDNE); + edma->regs.intl = edma->membase + (is64 ? EDMA64_INTL : EDMA_INTR); + edma->regs.errl = edma->membase + (is64 ? EDMA64_ERRL : EDMA_ERR); + + if (is64) { edma->regs.erqh = edma->membase + EDMA64_ERQH; edma->regs.eeih = edma->membase + EDMA64_EEIH; edma->regs.errh = edma->membase + EDMA64_ERRH; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index db137a8c558d..5f3fcb991b5e 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -138,16 +138,12 @@ struct fsl_edma_desc { struct fsl_edma_sw_tcd tcd[]; }; -enum edma_version { - v1, /* 32ch, Vybrid, mpc57x, etc */ - v2, /* 64ch Coldfire */ - v3, /* 32ch, i.mx7ulp */ -}; - #define FSL_EDMA_DRV_HAS_DMACLK BIT(0) #define FSL_EDMA_DRV_MUX_SWAP BIT(1) +#define FSL_EDMA_DRV_CONFIG32 BIT(2) +#define FSL_EDMA_DRV_WRAP_IO BIT(3) +#define FSL_EDMA_DRV_EDMA64 BIT(4) struct fsl_edma_drvdata { - enum edma_version version; u32 dmamuxs; u32 flags; int (*setup_irq)(struct platform_device *pdev, diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index f5cf95d185f8..47bfef1c562c 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -225,22 +225,20 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) } static struct fsl_edma_drvdata vf610_data = { - .version = v1, .dmamuxs = DMAMUX_NR, + .flags = FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { - .version = v1, .dmamuxs = DMAMUX_NR, - .flags = FSL_EDMA_DRV_MUX_SWAP, + .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { - .version = v3, .dmamuxs = 1, - .flags = FSL_EDMA_DRV_HAS_DMACLK, + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index ebd8733f72ad..7b05e303ba51 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -172,7 +172,7 @@ static void mcf_edma_irq_free(struct platform_device *pdev, } static struct fsl_edma_drvdata mcf_data = { - .version = v2, + .flags = FSL_EDMA_DRV_EDMA64, .setup_irq = mcf_edma_irq_init, }; From patchwork Tue Jun 13 21:31:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692193 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 B54CCEB64DB for ; Tue, 13 Jun 2023 21:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240388AbjFMVci (ORCPT ); Tue, 13 Jun 2023 17:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240543AbjFMVcc (ORCPT ); Tue, 13 Jun 2023 17:32:32 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 803131BDA; Tue, 13 Jun 2023 14:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aCy2tEHFLj+40uHRvdyPPIih71WIBv6MjNaxhSyGn//WqlhChloCDCfZ2yufghezPgl1a5epfm6nJcb2kGC2SrI5rJtaD+M79WrZ8QbcSxlewCjXOrWY4P3ZST8NwJTERQmThGqRyMbtyGD6ga0irdiXPXiHzt67nNeLPEHzRpwasXpTE7z0NzOAqKyk/nsQThGKeqfJ4qntWWuitzORnXYVlzrFBUvVZsF4ozrRnG5yAkx9pZlo27Pt3dZ/XCbAOIXhcNcyvXYWH74BybmRNqGl3ffZvE5xLBJO2aB4Z/acWsjlXrCLSqjwPe0C1Rjqc0ukp4uif2IOYfBTkMoJZg== 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=s1+6nOaISVZ89Qy4+Cr3cnXLzqMpnDganBMJUwxpjWY=; b=k/SLl93AyEpw0Zk7npZXBqPedscSpXs8oQvKlldYrEYamUiiySRsKNzwdffk609gp1K8HD2heBDVOP7PY5JNCvlJ1G/3YAzg6RO07yE4/lBIeSa6/99uuYNx1He83zN3GXkCfkg6M9YtxsISm9bLaf20fNM3ySpqwm198Z2sQa97/PIA5r/jDR0gfg2vtfPOsdBmlPuBrmYWbAzD62dEfo2pKOVUlYB3fdJ65jaOiMyc8BcV+ZVN+mLDgO6XgLk59lWw4PdWkc3o5Z1/CivqMbpvYLu1wARI/qErkda4+TpzT+IF9tRP1K0gkccB3pxxZe6GZSG7yx6RePuUoX5U5g== 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=s1+6nOaISVZ89Qy4+Cr3cnXLzqMpnDganBMJUwxpjWY=; b=JIgA5PXicYADmHeKOhGiLCcHdrfgqI2plzTxfdJoyocTng7hRkJIVVHtHp35uFk4QZdh6pjpTQLKqTYjPJrMmk/XZ3JfoqokIyoHWO0bGtb+XR+JJlCcIPGF8zZFTXiS6kCBp0aQ/Dq+v87dCce1Zks/jR2xSf/hTD5BmDCFesw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:23 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:23 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Tue, 13 Jun 2023 17:31:43 -0400 Message-Id: <20230613213149.2076358-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: d1f709bf-0787-47e5-2a0f-08db6c55ad37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cFMz0K7jMGVoTDP55L4l2G45vmlO5fTUmSEzVkwno+Gd+avXSGEnG+dDAmFOG3FSZxhutc1z/3sQm8J7G+mdEiH/7PBeBKoGTJ4rbEbvkOHFsG1Z62rWXfGvF/nSFEXvIXQDFXE9GI2T2ui1IoBFhyTMtCfvQJpU/0kPtZ4yKfqbKwkFE73DmswPR0qTQQHeQIRUAgsIy/g/L+WQoXbiW95R4rXbqKn17wW6RmQxcPGlZFeCMA53DzB7f4LO5IaPSG3QGhvliJBxv9oDm/qPU8vVwcLdNZgKcoPK+KwlwkX5f7mFzJD8Is85/XJyvDVh5M9L0lIArCXy+BBLpZxm1NzRLu474WRwaMEPY82dCs8yMIaZFIZPXILbZz2o6VmZ/fpzb+8KznDLcl9X2k/1XzQaTGA7LW722SNLA4KwqgNV3AjBufurieBlDhZIKT+5ZPH5sz8W3vL6FOsWNyd/Y3f7iGUYVFQQpK3yY1NeZCwAJskCAociqsjwV2vn2i5m4vyYJSUAqwBF07py+nTAFfOtO2VNZKEjNPC2rheZktdRuBCbZaXPa2T8iPkJAcxlNgAiob9dUK9VmQjCsk+WkctRN5On0rhys/ohV9r97AnPmPW9Otn/tA/pN23nExce X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(6666004)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rIDKMIKIlGWH9S4kvPvvrrfq+Tlh1Kuk+L4gOh9SPAcsYiUfwN51GbRXeiSjKLAx+xIUwvYO6hFJBUbi20DB6syBXzruGWHO0k+iA8OTtAIZnnLuQkYGiuqNkO11Ozc/sQmhlJaek6VxZqIzJkaagHShkA0DOQWvNkbNK39eHJxoTiJAAiPwzbEev+lnEicYh2wnbB6QcIVpljZb248psc2EPdrJ+HF8pFSP5gnCuOUSjzzMxPe7bV0WrmT0b8Fdn5gNav4do03+zHsM5gvCNQ4OLlnF9ccZ6vEHrhfqxHQ5ZPUFyV5hXXEC6riTwBpJoCqjwgomWEQCPkbe3loIWk5+z7APPEBP0JLnJOD7kJNIxgwHBj8KFAnG6tiUy4ykL1btFuZ+OFnQ8DhQtaIc3gb8q6FQLYedrhWqsSHEv6xH+TysKB/mPapazGvio7pfmtcv6zqLhmboLuUPExakdvUTfbcolRAmiLbiFYeaKQth3117Vss1qsb/oR93zuH8hBQ+n6yxUcYtoECWCV1nmTsOgA0onjQ9K1mEenzj8CgNuDUrr8PS4J8oOpJ5/jpvYqPLb3H6K4J0USkRl0RqHERvgZ5cQuMRySsNQUtwhBjc2TAxXl+MPRXl9TfuWkyvWvqjGUv2AwL5S+lI0t82zI12eMplAYnm2IqTrlMkzSeQIRkWNy9DZJ3vitN0MOibnkBWDm6BYMFEB0x44a9B6Z2PjOXQmV7r3IiMahmdV9Qvx5JLNOo6RzkYqWz8iMQbSKRNHo3qGfS+IfPvuo0JLH3yVnxPlA7xLvA8lAF1IeB1kuXh/XJdpJg9pEKD33paMdSTiU8f0dgHvzxCld1hnAqkwrVVgMts/eJE+oXZFMGPeu1fcBRplo+63xoXLLZwWmXTpqysHr142FPcdQD5K+8EZhwmUC2/21j9n0dmFZ5v8F2dn7NH+LRe+/SWyFgndL8dadzO5QKEemRedGbL83kQgF9uKlYAdL+aa9hEvjCOnBu+ZFdrjFEOmfmDQBTV542IX/JIrxNcNBVd8LEpsr0j6XBw3oWbYLGyqQE44IHSceI26kkGa6ncJtNhNbj6wHyzjxNhZJasAKqW/U4ehcjzWGM+MzcSUN3tgp9R/qiRGz6KqFK72q3AGbKoRUFUpFLiIbZ3Cn/g5M/YkTG6BfoMT+PO5Vu7TYAKFJOIGa5SBPEDsdY3cXrJNvGbQfHJWK4GRJ4+JcctVZoTDpwuSsxTBLilenD8NUhrPDB5VZ8PXFScToY6IyE4sUKaXrpAeixI/48RRPQPezU7KPKFc5InXQl7xQfkhGt2QQfvb9fLj6sDY0pgC5ndZhyXr1acFWt86hk1WkPf4zRf+m+MfagG1jFSHpWLB5J+bAtK92wUpiejoRUvWqiyWaPkb+f8szoDgJZq9YnHc9C4/54zTLfzS0uOhWi4k8RDnMmjlFGLyJfYx0XoE9Hb0AM/2jEiKfzgA8c70qxjomJwoqmoqMq8fEcBDVebIP2+h7nEtxBHjt/w+k9M9d7sX3Y5QyhV+wKhsR7Yn124vVCz+Q07kGJHUdI6/aPvRjfLoW2661MZFNG3RuHXYkPQZnIVgtJ0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1f709bf-0787-47e5-2a0f-08db6c55ad37 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:23.8442 (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: wAqWH6VmpRbU/EHhKoQo/tVGPvyQMuqF4s1t/BU9rW6rzsEkRl8IZfe+Eyp2i0+DhKoqvV++eTsC6ol/XLxLoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Removes all ATTR_DSIZE_*BIT(BYTE) and ATTR_SSIZE_*BIT(BYTE) definitions in edma. Uses ffs() instead, as it gives identical results. This simplifies the code and avoids adding more similar definitions in future V3 version. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 21 ++++++++------------- drivers/dma/fsl-edma-common.h | 10 ---------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index a9d17cf142fc..51fbd7531c74 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -154,18 +154,13 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, static unsigned int fsl_edma_get_tcd_attr(enum dma_slave_buswidth addr_width) { - switch (addr_width) { - case 1: - return EDMA_TCD_ATTR_SSIZE_8BIT | EDMA_TCD_ATTR_DSIZE_8BIT; - case 2: - return EDMA_TCD_ATTR_SSIZE_16BIT | EDMA_TCD_ATTR_DSIZE_16BIT; - case 4: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - case 8: - return EDMA_TCD_ATTR_SSIZE_64BIT | EDMA_TCD_ATTR_DSIZE_64BIT; - default: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - } + u32 val; + + if (addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) + addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + + val = ffs(addr_width) - 1; + return val | (val << 8); } void fsl_edma_free_desc(struct virt_dma_desc *vdesc) @@ -623,7 +618,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, /* To match with copy_align and max_seg_size so 1 tcd is enough */ fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, - EDMA_TCD_ATTR_SSIZE_32BYTE | EDMA_TCD_ATTR_DSIZE_32BYTE, + fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 242ab7df8993..521b79fc3828 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -29,16 +29,6 @@ #define EDMA_TCD_ATTR_DMOD(x) (((x) & GENMASK(4, 0)) << 3) #define EDMA_TCD_ATTR_SSIZE(x) (((x) & GENMASK(2, 0)) << 8) #define EDMA_TCD_ATTR_SMOD(x) (((x) & GENMASK(4, 0)) << 11) -#define EDMA_TCD_ATTR_DSIZE_8BIT 0 -#define EDMA_TCD_ATTR_DSIZE_16BIT BIT(0) -#define EDMA_TCD_ATTR_DSIZE_32BIT BIT(1) -#define EDMA_TCD_ATTR_DSIZE_64BIT (BIT(0) | BIT(1)) -#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(2) | BIT(0)) -#define EDMA_TCD_ATTR_SSIZE_8BIT 0 -#define EDMA_TCD_ATTR_SSIZE_16BIT (EDMA_TCD_ATTR_DSIZE_16BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BIT (EDMA_TCD_ATTR_DSIZE_32BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_64BIT (EDMA_TCD_ATTR_DSIZE_64BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BYTE (EDMA_TCD_ATTR_DSIZE_32BYTE << 8) #define EDMA_TCD_CITER_CITER(x) ((x) & GENMASK(14, 0)) #define EDMA_TCD_BITER_BITER(x) ((x) & GENMASK(14, 0)) From patchwork Tue Jun 13 21:31:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692192 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 EC5CAEB64D7 for ; Tue, 13 Jun 2023 21:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240412AbjFMVdF (ORCPT ); Tue, 13 Jun 2023 17:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240451AbjFMVc5 (ORCPT ); Tue, 13 Jun 2023 17:32:57 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 072361BFB; Tue, 13 Jun 2023 14:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ntupCuzYvVNiwbUbWhUxqPBAUipmnxJm+kLZnmxCViLJAo8SSJGhOxSi4xNCJc1jf5O4ogAEWUD95x3dGeLU2IvR4Rfs4kp9QRpfhX0qqi3rGIzr+q2bdo12hvw28s0S9N2NDgzZ2i8jSUwY1peoPXPy/vMvawodqnpwaYmw55sFro64axYRk5wtw2qOlXN3y9IjF0srV4VwK1Vj6vDAhscTILgaTnIyIticEYLmby9m8vdXRfOTZBjQb3IczGDE7GBqMhW/d0/gtrIXG251MG6ot6C11Zvh40fMfwfsa2JlmtLxtyHDuZU/qoADkqk9ax7G8qrCRWeDNhGjUgZhDw== 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=Q3jlBv0SLDnSXx5LFjozJINPkoX9ob6AsqXt6WuD2a0=; b=m/ibRhRZKSgA0Ed4vsyPHJHHeKjDhmPrHAeKjaX1xO35/zTUT5dNK/wHuMFn3h0lVhdG+/BYBos3bgfUcS0yGSXdcV+NM/VcK66+qtJY2ts+PARcsOMcyBAYiDm3xanCvQALJLF1pCe3GicFjCbHJW2+0UJP1TYfz4m5vDQ6EJaLU6ueFtU9re1w/txVc5zcwHe5CVsWdGaFm1d1MpgnHH2h6YABEbjAccTbpaVHTsao4nKHjXwj3gCsIFb24lU/91O+3nX3qb9/6LbhhUpH5JgMg9w9aT55t3UEeESgcVMtNhUsW2sw+dUvgNSjPdv5Do6mA2fqfLcXpVmUtA8luA== 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=Q3jlBv0SLDnSXx5LFjozJINPkoX9ob6AsqXt6WuD2a0=; b=AAVMVsni0vz+ODlZAuhuuZsi0kTcq+jS/cK+sbw8j6Tea8GJNK5uY3JlpH+gir/5MeTm/70WdtjqLyqrqizLUytHsFRWt628RguTMlnPTC9C0Y/Smgyn08TYqgxr7fpUMyyyeaDGdL8NPIW/SW8DYDk8+VM7HhaeeQR/VSkW0bI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:29 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:29 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Date: Tue, 13 Jun 2023 17:31:45 -0400 Message-Id: <20230613213149.2076358-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: bc1f8011-984b-43af-f413-08db6c55b07b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SJvwuwlbpS49oeM3f39c6YCs7OTczdB3unIh3pjD2cbnZOkzqd4oVrQgZOcz3HlWMdmppwf+c5sBnJ5sEnCkD770SC+Y1A9lsdZ+UDwv6kgzESWa4m18OfIshruuc+8xqx7HRSjQ0Z9f3HCC3k5rigfS1npVBaStdWRxaR6creD2XedacZAjKwW7VDHBYO8IkfOXBHJLgbhY3pKeWbQPZd6Lhx0GHrK/fTGWtilSXQiJYmxSpBVCjhwr5PLTiXv9i0ad/JrD6KPQupxLpCIbx4eosb8cS88mL4uIof7++sPlYudhRBshZls5A2xYlFAqW1Nsgsak/lFEjEch9nYd0VnMs1Wo7LCbcIwNCHg9a8j3MSTXnsnkBZEQmdYsmQ+DFeBy52gAtaX8uidFi4KsdfKWd9LfTK+XI7hHtqt9OBLTyFcY1EV41pv+BhtdNWse8uMudVP4quwK8pbQBKIqSkCoqOpLjNmaryJz6B9M3TKLIUWwWMGMwUynl9a/x7iq0e07zdcmGPL2Ir1z7lWdjWeaJDlLjfVMYGFHKlnBKZqaWjhurC6ZSGLCUxUgBXgf4Ggi0Q3v+sAf2zV1hIOV6qhgw+fzUx/Q7/2BWQjw1ia3LNRFQEsEWrh5vpC6n8dY4tjRGvqeptOSxStZkgTDLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(6666004)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T8PrLlWilR8JTyxFfmHLdX+sWlWRPE38MEJ5f5CmjLLpBcFoDw4qN74fY2ImHgeUJuNcd9avaT+ekXmfk13Tw2XuI5qPzIHNEbMAw4h5zr6GMMntyE5MCJKVlOQO8L8GU49YNrX3OWV0ZBW1RiL6z+JFKE94mjEZYOO7EQIgFLek35p/KFG4EJkxX3PxLAtpylmV5z/V6t9TimLl4T0RjA/3VAfv7l3qqKvnFSOs/fLFwVParU6eDjjteqZPMcu51P2f+nVDje+iG18OQH4GmbbyzQDBsIWDa9lfLDYWzd9fyoTZxFNGiL8Gg8x0/kIN1CnclgRKPCfdoEJAMPP3E8DbuHwLkEVyx7lRHE/XkzIkKYGPn3A1b8sJTM8ceQsIQeiPKMMWzKf3cwkGOiUNcOxn1iJ5bOwRznDV20YDG13Nb1D7wK4oXNkY3v76bVXqKXVWyjhxfqs74/cn+L95PP/iRyhCGMl//DaNQI3W1zWi3p4qRD+blIXeOV9LoiZ0K4yf/TGUCe+GONnMOTbWrUu+jZYEMN+hmjiwO44PbV5Jt1uW5K60QXL7Ob4HDt/BghI+n421XMPIgiann7Di7s8xHmngsKDOkfmJVZ8dLg3G29rsiH8eSkb76lSG2sArv/oUADqp6i+25FBeK71tLnuIssNq01e4bkiK7vyCm+eATSLd+n6q00GRvW5N6nTaQSv/LxJ01LbF4ljHweqSx8MyAn0dINmSH65qOqxeghThADVv5d/GswEvQAskuM8/SV4JkbQg6dtj5ymYZoPTZPULLOebUORZPjhatQ6Q2dh0NCS0EHCOS0yQcEDt2zozkx4LiMDjaAzaZbyz5E0Ibf01Zi26Sbal4qrlStbPBHYUHw8bj0l7kDGO8QSGnw14uGu+xXOVfKajKvN9Ny9I51FEgURIRMg14mrrLOaOlPUN7UdfwfuXVWxrHDhQfOoIGMLY/9fn4Uts0NJPVchcLPd3UykwDjVrC6LW+w15D+UUxc4ZfvGitEW3c0k8hkheUFTzPFeDt9JRvtlzM2qdpyoBqIPtgT9MAThYumRBZh4+aQveFx37Vs9hJs1iQjebbam3iDtOZKs2x4PVRh43SOxgz2+lP8G5GPePYf9ZTNLYq6cuL+M6x7SBkDcZ0wcklonA0NDMhouUismp8xMLM0z4rJl8bmlpg1Az2VTUisK0upH/o50+jLT8+B31ETOAdJYaHYejMe1nDGkcVUitJ7wEHSTbJ006UXAf9EUgSuw1xm2KYKz3XLrkze1X+IVzNHdYuzYnXE7Amhpb7yzjhFt0Yajr22n6JxPaBYYHOI2fIr/KsLApUl22C/3z0LTpNDmACYi+SO1pyfCcrpGGp0Zr6NhpCW9Sdo/xqFm3WzxExji/egklhNHpU8Sf4ZXE2q+ZVudYQl7mrJtYqPYkOUBceepsv4x8NvJmpvjnfklr1G1I0L0tAjlmLo026bC/Qbe5j5RSmMX2VPCA4e5+K4O5SkKgmf/Jm7YqM16YNyi55++f63m4iNW6t9nx/bCHlLOpoGcAowHGoM3Xby/St37CIfZ8vRnSCse8xbXKI+4ILA8y6oH8v0WoiXp+rZDW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc1f8011-984b-43af-f413-08db6c55b07b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:29.5263 (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: IfVz3d2cwQSD+9TzvnAKUBc+kYe0Hn7J5lemQMBLxxLS6PVgO5muvJsZxu/TaYxcH3zu3ivodVjiwW50183zRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This accommodates differences in the register layout of EDMA v3 by moving the clearing of register interrupts into the platform-specific set_irq function. This should ensure better compatibility with EDMA v3. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 503e5ad5a8dd..e67aec3f76b5 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -113,6 +113,8 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma { int ret; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + fsl_edma->txirq = platform_get_irq_byname(pdev, "edma-tx"); if (fsl_edma->txirq < 0) return fsl_edma->txirq; @@ -154,6 +156,8 @@ fsl_edma2_irq_init(struct platform_device *pdev, int i, ret, irq; int count; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + count = platform_irq_count(pdev); dev_dbg(&pdev->dev, "%s Found %d interrupts\r\n", __func__, count); if (count <= 2) { @@ -311,7 +315,6 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_chan_mux(fsl_chan, 0, false); } - edma_writel(fsl_edma, ~0, regs->intl); ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma); if (ret) return ret; From patchwork Tue Jun 13 21:31:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692191 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 EC8EBEB64D7 for ; Tue, 13 Jun 2023 21:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240727AbjFMVea (ORCPT ); Tue, 13 Jun 2023 17:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbjFMVeO (ORCPT ); Tue, 13 Jun 2023 17:34:14 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 783761FDB; Tue, 13 Jun 2023 14:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UY1A34INTaNKRzo25aN/v0bB/qfWmNdCA7pdlSYGwIn3pPk3ryuGQ9xWtWTbrny35L6cbetpMPYdfcrNMSV7Fc7TdmFnSKuZvmBWgqw19sEyCtnwprVWOlSBObXiQ/xRlZLqUC2VBg1Eo2LXDrh18/WlB6+pVDZnqmDaEKBy8hWBVf+kqR0WQ4X33BiitRUDykkKgl3FMF84n9lvX3lJ0dFGWKsafLpxqfpGJtaQWvApiViy+uDgRKBl4jMCjiQppipkrI0fd3bu1zVocdp8u+8xRMHpT0ltkoH2QEXaRcHt/dTIzb0sqiuUepJh3c5Cajq6trLEsNu6PzlXifxjyw== 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=PeCMQBP8k+5S6/X9HD+YRizczLEve0pLk7+72KdnwX0=; b=JXS2m+Gjo/xZWqELqy5L4iGWkEExMd4a+znOKAo4PYBVuEtBuOoy8I1n6zbdB9bhd/S5ATKsHakbVNMqYtMAAZ7Qxcdbd4FT3EjsQltKUubiFEoWvpFtwVFFEKAFHEDyowgk5UjHoegWWNiT3DovHYYHqXVJWkHIj/m+qEUZMixDarTEGL4CaP6LYxxk3iPKMDGh5WPfWDpfpDO173Knqrx8rDf3Wg8Ho0yVFYoIcN+OI4iCp6rQsa+SMA3ZWioOg6NGPagn5u5fpo+ubFgta9vM+DOLqaYC2eAY1L2QcxB0WhIIT7t27cHDOP+deNP90KrrzHeIbG4VaqnuEKiQdw== 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=PeCMQBP8k+5S6/X9HD+YRizczLEve0pLk7+72KdnwX0=; b=qJsDS65JtTQBTmXuIGfX7oUKCA5xEhGULYFO9Y0r7adipPj561uEsydHMf0Glz9l8QyBUUZs45HwPX3rUdS7xTXOc9Ic5n+gTVJaL1vUcB6+F1LS38TSjbFYHbQNNDoQBOhiKdHN3ewSrahTKUJdVHduJDU8wgTPSztM8WwIWh0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:38 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:38 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 11/12] dmaengine: fsl-edma: integrate v3 support Date: Tue, 13 Jun 2023 17:31:48 -0400 Message-Id: <20230613213149.2076358-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: 39dce9ec-4e65-4e51-7943-08db6c55b58a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5gApH1jVa3IJziXoEfkThcGgfQEJvG76tWIoJLn3ln8ZZVJspEWMahPJzNztv954eEQMvD36qckEhn99EzXB8rFRTDJ+uz3W2GOJeVWGdn3+8+5L70kiG504CMRMn0t/8NBW3O5qS1ClORHmk5TYUBi6bvREW/dLF6kvtc7hGMUr5UOaxy2ybQXd9S7AYdLoHY53BYoElh9fasonl/EnJPYpno8YrOjr9AGoRQFHnk9C0MQv+0wg4xukBAtvhXgJQjSgk8zHRUdB/78K/QCKnzqg74X2HsTd0r9g4oMHlGm4V2JvubqHMzcYv99I2bgPsZ8ogpEDGzAu9nD2Ws5YPMFP8MfJ2DZgn92HtwyasruK72aIytFR0BuI5033SbeIIWlhHxj8x3HUTBWcDshHDQQEX6Ux1smnWYt71DzPwLEnv1XEwM/h5BCqKmP5NTOKMvvv27HytNh3Wp7yaFzeroKd0CU11mBM9/5pkeBLs95jTuyoTtuDWCGZ2JjeVrLOKIGn8q6QdVq8a4hY6vtLEeEEQfUCPgMdZ8bBrOe51P9evwW+syrFTtJe+T9Dh32cI8yBeVEFywwFuYmKDAgiNduseHMzdy1KfQl/t3b4VFuLJ7aSs78KSuIcJdEshrdTv3KWXbvuaxI0IxmVSpbTiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(6666004)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(30864003)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WsOp+DbFZGx05Vp727mj9H55BxaVnIGL5gcnyYyFHFaOfAsiWili9hFLqlRTxGysts9cVwMTPB2diC3Y9M/z4kkm9h7KvdtP/SsuMK5/IVzgD4Wu26GpwtaJlwF7FjPhLXX5bN0czxoY5TKeFmfcbnUbldZxYZZiU7K+Qt0qVmkuaY6YfiUFgqbzj4EPmjkXREOJpF59TiR0usBPUiYF6yuUN43AEwKn2Sb6kDh/Qkt/TFXPBoOG5nnuCu4+L09Ol5wTFdfrB5HZY7NCqod6+J5kkKndQGKmcmLFyQI2yhrWBZ2CyMlVbiLKsJaoLEX94M4G/tCswyLvdPcY/+Hc0Dkx1BTWH6NgtOd+YQ5MF32gEZQeOe7T7wlB98djHfeuQe0zDERqiihrm2ZwY2ye+1ueEWTQNhtDovTYhyAA8VQ5Ldy+KXMkkukpcx/o0gZ7R7U9vUCI4rT3Xldyu7jl2rQrEbo9WF5ioHUFbTSgEIiac2aCzu+ipi/Ji4G3xYDlMsY/yxNxBmLPW3wBn/Xx/gfBHabNbs3y/tLzpfLyYQfpl2y4XWEJOS9HkrO4ca52vfoKXPtZlukHMgPtTt1RozzoArwsuwWC9fyhSFPNsRte6Z4DChzb8mHCkn8EdilExiDpOw6y+HE9sx9j1I0K/i37nxpt/PlT3k38Sok4vtvEFqEgNPzO5gnSd/Ev/MtlC2Lqde9efCz9hIkqXUgStNLV3PeZVcz3nNIC458n3EVQdQ0MlYkqcaFZJ79MKQEyAFUGDjo/6npp5QXM2k/7NC8Q3kL3BnqPuCXvviZ8u9GzneIlB7A2lYSjllOGRqoy4gORIAj9YycvYwNdHNS0RlWjHTMCp8xSYTVAVAX6qyDnCmuyG8bdWajWIYQNtCKsZ3BI7bsKo/+tyGMXOWfNa0REsmCOHCMCECE7dr8lsSNNcVC90w9ieCZT2qnPHtH7g5LmeoGLBzsExI2s+F6Ligo+Jyp1MLjMdQ+4+luuApx/iS1Ab1IIYkkpqWGJUfZKOy105EQqyP6jIqjzIdZGHU1ORaQpaDqGLKiBJ4P1u0PZBPeqGd2m3QxbZC1kg9V3lj7s9PJQe+5WznxsKvG7A78Otovq0tBEC08ayadZR/JKdy5BYqwt8FyT6fb7zFUrowsIu5nvikK71BE3dJyZ7LX8MaibAVT5zss0Z5wyK0F21UzIjcN09gSvBV0HI8QC03FMmYetnJb39b0Ws6y23VjQx/2H0kNB1QkSMy98cqCnksWiMZnYKtvNq38MGVXwVyL863X6NHUNaD2Iyc2e+6iKj8yCKHRpLzXlD3eQwBBI/BW29M6Rh1aB07o+VFohrRkBuhlKxC0Hs2x/YChs4UvxxzMA8dILb71wnt4LmJZcwolUgBwphTCNMeLqW942VtX3yCfAp7m4K73Tm13VVCLBGq106CH7Vtt6Zf+oSlXZ+5KtoZTvUVP6q2LQFjBYUwOABOgKWOYrUPSgiEGq4bSusAo0R+7YJVGEnA6qZGKTAKqYhACtN8v8u9+HmDAlOAK5EjwY0PEUYBu6rb0vqsZeCLhSqfszhlqxbjSaSCQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39dce9ec-4e65-4e51-7943-08db6c55b58a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:38.0949 (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: 04lUYf3h+6LoCsr6+R9vhy4d+n588bYAFuFXUMBPJkvwfGHBsrKD1LLqKMf+vCs77TNlA7JLjYE/Pnj1w+RhSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Significant alterations have been made to the EDMA v3's register layout. Now, each channel possesses a separate address space, encapsulating all channel-related controls and statuses, including IRQs. There are changes in bit position definitions as well. However, the fundamental control flow remains analogous to the previous versions. EDMA v3 was utilized in imx8qm, imx93, and will be in forthcoming chips. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 158 +++++++++++++++++++--- drivers/dma/fsl-edma-common.h | 73 +++++++++- drivers/dma/fsl-edma-main.c | 247 ++++++++++++++++++++++++++++++++-- 3 files changed, 454 insertions(+), 24 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index eead6a4765f7..bec1f4d6a3e1 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" @@ -66,11 +68,46 @@ void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) spin_unlock(&fsl_chan->vchan.lock); } +static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val, flags; + + flags = fsl_edma_drvflags(fsl_chan); + val = edma_readl_chreg(fsl_chan, ch_sbr); + /* Remote/local swapped wrongly on iMX8 QM Audio edma */ + if (flags & FSL_EDMA_DRV_QUIRK_SWAPPED) { + if (!fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } else { + if (fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } + + if (fsl_chan->is_remote) + val &= ~(EDMA_V3_CH_SBR_RD | EDMA_V3_CH_SBR_WR); + + edma_writel_chreg(fsl_chan, val, ch_sbr); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux); + + val = edma_readl_chreg(fsl_chan, ch_csr); + val |= EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_enable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); @@ -83,11 +120,28 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) } } +static void fsl_edma3_disable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val = edma_readl_chreg(fsl_chan, ch_csr); + u32 flags; + + flags = fsl_edma_drvflags(fsl_chan); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, 0, ch_mux); + + val &= ~EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_disable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); @@ -135,6 +189,9 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, int endian_diff[4] = {3, 1, -1, -3}; u32 dmamux_nr = fsl_chan->edma->drvdata->dmamuxs; + if (!dmamux_nr) + return; + chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux; @@ -186,6 +243,10 @@ int fsl_edma_terminate_all(struct dma_chan *chan) vchan_get_all_descriptors(&fsl_chan->vchan, &head); spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); vchan_dma_desc_free_list(&fsl_chan->vchan, &head); + + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_PD) + pm_runtime_allow(fsl_chan->pd_dev); + return 0; } @@ -286,12 +347,16 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; + u32 nbytes = 0; int i; /* calculate the total size in this desc */ - for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) - len += le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) { + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + len += nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + } if (!in_progress) return len; @@ -303,8 +368,12 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { - size = le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + + size = nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + if (dir == DMA_MEM_TO_DEV) dma_addr = le32_to_cpu(edesc->tcd[i].vtcd->saddr); else @@ -389,12 +458,15 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, } static inline -void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, +void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, + struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, u16 attr, u16 soff, u32 nbytes, u32 slast, u16 citer, u16 biter, u16 doff, u32 dlast_sga, bool major_int, bool disable_req, bool enable_sg) { + struct dma_slave_config *cfg = &fsl_chan->cfg; u16 csr = 0; + u32 burst; /* * eDMA hardware SGs require the TCDs to be stored in little @@ -409,6 +481,21 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, tcd->soff = cpu_to_le16(soff); + if (fsl_chan->is_multi_fifo) { + /* set mloff to support multiple fifo */ + burst = cfg->direction == DMA_DEV_TO_MEM ? + cfg->src_addr_width : cfg->dst_addr_width; + nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-(burst * 4)); + /* enable DMLOE/SMLOE */ + if (cfg->direction == DMA_MEM_TO_DEV) { + nbytes |= EDMA_V3_TCD_NBYTES_DMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_SMLOE; + } else { + nbytes |= EDMA_V3_TCD_NBYTES_SMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_DMLOE; + } + } + tcd->nbytes = cpu_to_le32(nbytes); tcd->slast = cpu_to_le32(slast); @@ -427,6 +514,12 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, if (enable_sg) csr |= EDMA_TCD_CSR_E_SG; + if (fsl_chan->is_rxchan) + csr |= EDMA_TCD_CSR_ACTIVE; + + if (fsl_chan->is_sw) + csr |= EDMA_TCD_CSR_START; + tcd->csr = cpu_to_le16(csr); } @@ -466,6 +559,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); struct fsl_edma_desc *fsl_desc; dma_addr_t dma_buf_next; + bool major_int = true; int sg_len, i; u32 src_addr, dst_addr, last_sg, nbytes; u16 soff, doff, iter; @@ -509,17 +603,23 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( src_addr = dma_buf_next; dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; - doff = 0; - } else { + doff = fsl_chan->is_multi_fifo ? 4 : 0; + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = dma_buf_next; - soff = 0; + soff = fsl_chan->is_multi_fifo ? 4 : 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = doff = 0; + major_int = false; } - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, dst_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, - iter, doff, last_sg, true, false, true); + iter, doff, last_sg, major_int, false, true); dma_buf_next += period_len; } @@ -568,23 +668,51 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; doff = 0; - } else { + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = sg_dma_address(sg); soff = 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = 0; + doff = 0; } + /* + * Choose the suitable burst length if sg_dma_len is not + * multiple of burst length so that the whole transfer length is + * multiple of minor loop(burst length). + */ + if (sg_dma_len(sg) % nbytes) { + u32 width = (direction == DMA_DEV_TO_MEM) ? doff : soff; + u32 burst = (direction == DMA_DEV_TO_MEM) ? + fsl_chan->cfg.src_maxburst : + fsl_chan->cfg.dst_maxburst; + int j; + + for (j = burst; j > 1; j--) { + if (!(sg_dma_len(sg) % (j * width))) { + nbytes = j * width; + break; + } + } + /* Set burst size as 1 if there's no suitable one */ + if (j == 1) + nbytes = width; + } iter = sg_dma_len(sg) / nbytes; if (i < sg_len - 1) { last_sg = fsl_desc->tcd[(i + 1)].ptcd; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, false, false, true); } else { last_sg = 0; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, true, true, false); @@ -609,7 +737,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, fsl_chan->is_sw = true; /* To match with copy_align and max_seg_size so 1 tcd is enough */ - fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[0].vtcd, dma_src, dma_dst, fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index cfc41915eaa1..3cc0cc8fc2d0 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -42,6 +42,11 @@ #define EDMA_TCD_CSR_ACTIVE BIT(6) #define EDMA_TCD_CSR_DONE BIT(7) +#define EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(x) ((x) & GENMASK(9, 0)) +#define EDMA_V3_TCD_NBYTES_MLOFF(x) (x << 10) +#define EDMA_V3_TCD_NBYTES_DMLOE (1 << 30) +#define EDMA_V3_TCD_NBYTES_SMLOE (1 << 31) + #define EDMAMUX_CHCFG_DIS 0x0 #define EDMAMUX_CHCFG_ENBL 0x80 #define EDMAMUX_CHCFG_SOURCE(n) ((n) & 0x3F) @@ -54,6 +59,15 @@ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_8_BYTES)) + +#define EDMA_V3_CH_SBR_RD BIT(22) +#define EDMA_V3_CH_SBR_WR BIT(21) +#define EDMA_V3_CH_CSR_ERQ BIT(0) +#define EDMA_V3_CH_CSR_EARQ BIT(1) +#define EDMA_V3_CH_CSR_EEI BIT(2) +#define EDMA_V3_CH_CSR_DONE BIT(30) +#define EDMA_V3_CH_CSR_ACTIVE BIT(31) + enum fsl_edma_pm_state { RUNNING = 0, SUSPENDED, @@ -73,6 +87,18 @@ struct fsl_edma_hw_tcd { __le16 biter; }; +struct fsl_edma3_ch_reg { + __le32 ch_csr; + __le32 ch_es; + __le32 ch_int; + __le32 ch_sbr; + __le32 ch_pri; + __le32 ch_mux; + __le32 ch_mattr; /* edma4, reserved for edma3 */ + __le32 ch_reserved; + struct fsl_edma_hw_tcd tcd; +} __packed; + /* * These are iomem pointers, for both v32 and v64. */ @@ -119,6 +145,18 @@ struct fsl_edma_chan { enum dma_data_direction dma_dir; char chan_name[32]; struct fsl_edma_hw_tcd __iomem *tcd; + u32 real_count; + struct work_struct issue_worker; + struct platform_device *pdev; + struct device *pd_dev; + u32 srcid; + struct clk *clk; + int priority; + int hw_chanid; + int txirq; + bool is_rxchan; + bool is_remote; + bool is_multi_fifo; }; struct fsl_edma_desc { @@ -135,8 +173,26 @@ struct fsl_edma_desc { #define FSL_EDMA_DRV_CONFIG32 BIT(2) #define FSL_EDMA_DRV_WRAP_IO BIT(3) #define FSL_EDMA_DRV_EDMA64 BIT(4) +#define FSL_EDMA_DRV_HAS_PD BIT(5) +#define FSL_EDMA_DRV_HAS_CHCLK BIT(6) +#define FSL_EDMA_DRV_HAS_CHMUX BIT(7) +/* imx8 QM audio edma remote local swapped */ +#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8) +/* control and status register is in tcd address space, edma3 reg layout */ +#define FSL_EDMA_DRV_SPLIT_REG BIT(9) +#define FSL_EDMA_DRV_BUS_8BYTE BIT(10) +#define FSL_EDMA_DRV_DEV_TO_DEV BIT(11) +#define FSL_EDMA_DRV_ALIGN_64BYTE BIT(12) + +#define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \ + FSL_EDMA_DRV_BUS_8BYTE | \ + FSL_EDMA_DRV_DEV_TO_DEV | \ + FSL_EDMA_DRV_ALIGN_64BYTE) + struct fsl_edma_drvdata { - u32 dmamuxs; + u32 dmamuxs; /* only used before v3 */ + u32 chreg_off; + u32 chreg_space_sz; u32 flags; int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); @@ -148,6 +204,7 @@ struct fsl_edma_engine { void __iomem *muxbase[DMAMUX_NR]; struct clk *muxclk[DMAMUX_NR]; struct clk *dmaclk; + struct clk *chclk; struct mutex fsl_edma_mutex; const struct fsl_edma_drvdata *drvdata; u32 n_chans; @@ -155,6 +212,7 @@ struct fsl_edma_engine { int errirq; bool big_endian; struct edma_regs regs; + u64 chan_masked; struct fsl_edma_chan chans[]; }; @@ -168,6 +226,14 @@ struct fsl_edma_engine { edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) +#define edma_readl_chreg(chan, __name) \ + edma_readl(chan->edma, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + +#define edma_writel_chreg(chan, val, __name) \ + edma_writel(chan->edma, val, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. @@ -224,6 +290,11 @@ static inline struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan) return container_of(chan, struct fsl_edma_chan, vchan.chan); } +static inline u32 fsl_edma_drvflags(struct fsl_edma_chan *fsl_chan) +{ + return fsl_chan->edma->drvdata->flags; +} + static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) { return container_of(vd, struct fsl_edma_desc, vdesc); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 8ba705080f5d..b0ddb82862ea 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -18,9 +18,15 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" +#define ARGS_RX BIT(0) +#define ARGS_REMOTE BIT(1) +#define ARGS_MULTI_FIFO BIT(2) + static void fsl_edma_synchronize(struct dma_chan *chan) { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); @@ -47,6 +53,22 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t fsl_edma3_tx_handler(int irq, void *dev_id) +{ + struct fsl_edma_chan *fsl_chan = dev_id; + unsigned int intr; + + intr = edma_readl_chreg(fsl_chan, ch_int); + if (!intr) + return IRQ_HANDLED; + + edma_writel_chreg(fsl_chan, 1, ch_int); + + fsl_edma_tx_chan_handler(fsl_chan); + + return IRQ_HANDLED; +} + static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) { struct fsl_edma_engine *fsl_edma = dev_id; @@ -108,6 +130,51 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, return NULL; } +static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data; + struct dma_chan *chan, *_chan; + struct fsl_edma_chan *fsl_chan; + bool b_chmux; + int i; + + if (dma_spec->args_count != 3) + return NULL; + + b_chmux = !!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_HAS_CHMUX); + + mutex_lock(&fsl_edma->fsl_edma_mutex); + list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, + device_node) { + + if (chan->client_count) + continue; + + fsl_chan = to_fsl_edma_chan(chan); + i = fsl_chan - fsl_edma->chans; + + chan = dma_get_slave_channel(chan); + chan->device->privatecnt++; + fsl_chan->priority = dma_spec->args[1]; + fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX; + fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE; + fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO; + + if (!b_chmux && i == dma_spec->args[0]) { + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } else if (b_chmux && !fsl_chan->srcid) { + /* if controller support channel mux, choose a free channel */ + fsl_chan->srcid = dma_spec->args[0]; + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } + } + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return NULL; +} + static int fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) { @@ -149,6 +216,37 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma return 0; } +static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + int ret; + int i; + + for (i = 0; i < fsl_edma->n_chans; i++) { + + struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; + + /* request channel irq */ + fsl_chan->txirq = platform_get_irq(pdev, i); + if (fsl_chan->txirq < 0) { + dev_err(&pdev->dev, "Can't get chan %d's irq.\n", i); + return -EINVAL; + } + + ret = devm_request_irq(&pdev->dev, fsl_chan->txirq, + fsl_edma3_tx_handler, IRQF_SHARED, + fsl_chan->chan_name, fsl_chan); + if (ret) { + dev_err(&pdev->dev, "Can't register chan%d's IRQ.\n", i); + return -EINVAL; + } + } + + return 0; +} + static int fsl_edma2_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) @@ -203,29 +301,109 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) static struct fsl_edma_drvdata vf610_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { .dmamuxs = 1, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; +static struct fsl_edma_drvdata imx8qm_data = { + .flags = FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx8qm_audio_data = { + .flags = FSL_EDMA_DRV_QUIRK_SWAPPED | FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data3 = { + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data4 = { + .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x8000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + static const struct of_device_id fsl_edma_dt_ids[] = { { .compatible = "fsl,vf610-edma", .data = &vf610_data}, { .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data}, { .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data}, + { .compatible = "fsl,imx8qm-edma", .data = &imx8qm_data}, + { .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data}, + { .compatible = "fsl,imx93-edma3", .data = &imx93_data3}, + { .compatible = "fsl,imx93-edma4", .data = &imx93_data4}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids); +static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + struct fsl_edma_chan *fsl_chan; + struct device_link *link; + struct device *pd_chan; + struct device *dev; + int i; + + dev = &pdev->dev; + + for (i = 0; i < fsl_edma->n_chans; i++) { + if (fsl_edma->chan_masked & BIT(i)) + continue; + + fsl_chan = &fsl_edma->chans[i]; + + pd_chan = dev_pm_domain_attach_by_id(dev, i); + if (IS_ERR_OR_NULL(pd_chan)) { + dev_err(dev, "Failed attach pd %d\n", i); + return -EINVAL; + } + + link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (IS_ERR(link)) { + dev_err(dev, "Failed to add device_link to %d: %ld\n", i, + PTR_ERR(link)); + return -EINVAL; + } + + fsl_chan->pd_dev = pd_chan; + + pm_runtime_use_autosuspend(fsl_chan->pd_dev); + pm_runtime_set_autosuspend_delay(fsl_chan->pd_dev, 200); + pm_runtime_set_active(fsl_chan->pd_dev); + //pm_runtime_put_sync_suspend(fsl_chan->pd_dev); + } + + return 0; +} + static int fsl_edma_probe(struct platform_device *pdev) { const struct of_device_id *of_id = @@ -234,6 +412,7 @@ static int fsl_edma_probe(struct platform_device *pdev) struct fsl_edma_engine *fsl_edma; const struct fsl_edma_drvdata *drvdata = NULL; struct fsl_edma_chan *fsl_chan; + u32 chan_mask[2] = {0, 0}; struct edma_regs *regs; int len, chans; int ret, i; @@ -264,8 +443,10 @@ static int fsl_edma_probe(struct platform_device *pdev) if (IS_ERR(fsl_edma->membase)) return PTR_ERR(fsl_edma->membase); - fsl_edma_setup_regs(fsl_edma); - regs = &fsl_edma->regs; + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) { + fsl_edma_setup_regs(fsl_edma); + regs = &fsl_edma->regs; + } if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); @@ -275,9 +456,29 @@ static int fsl_edma_probe(struct platform_device *pdev) } } + if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) { + fsl_edma->chclk = devm_clk_get_enabled(&pdev->dev, "mp"); + if (IS_ERR(fsl_edma->chclk)) { + dev_err(&pdev->dev, "Missing MP block clock.\n"); + return PTR_ERR(fsl_edma->chclk); + } + } + + ret = of_property_read_variable_u32_array(np, "dma-channel-mask", chan_mask, 1, 2); + + if (ret > 0) { + fsl_edma->chan_masked = chan_mask[1]; + fsl_edma->chan_masked <<= 32; + fsl_edma->chan_masked |= chan_mask[0]; + } + for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { char clkname[32]; + /* eDMAv3 mux register move to TCD area if ch_mux exist */ + if (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) + break; + fsl_edma->muxbase[i] = devm_platform_ioremap_resource(pdev, 1 + i); if (IS_ERR(fsl_edma->muxbase[i])) { @@ -297,9 +498,18 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); + if (drvdata->flags & FSL_EDMA_DRV_HAS_PD) { + ret = fsl_edma3_attach_pd(pdev, fsl_edma); + if (ret) + return ret; + } + INIT_LIST_HEAD(&fsl_edma->dma_dev.channels); for (i = 0; i < fsl_edma->n_chans; i++) { - struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d", dev_name(&pdev->dev), i); @@ -310,8 +520,13 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_chan->idle = true; fsl_chan->dma_dir = DMA_NONE; fsl_chan->vchan.desc_free = fsl_edma_free_desc; - fsl_chan->tcd = fsl_edma->membase + EDMA_TCD - + i * sizeof(struct fsl_edma_hw_tcd); + + len = (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) ? + offsetof(struct fsl_edma3_ch_reg, tcd) : 0; + fsl_chan->tcd = fsl_edma->membase + + i * drvdata->chreg_space_sz + drvdata->chreg_off + len; + + fsl_chan->pdev = pdev; vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); edma_write_tcdreg(fsl_chan, 0, csr); @@ -345,12 +560,25 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->dma_dev.src_addr_widths = FSL_EDMA_BUSWIDTHS; fsl_edma->dma_dev.dst_addr_widths = FSL_EDMA_BUSWIDTHS; + + if (drvdata->flags & FSL_EDMA_DRV_BUS_8BYTE) { + fsl_edma->dma_dev.src_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + fsl_edma->dma_dev.dst_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + } + fsl_edma->dma_dev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); + if (drvdata->flags & FSL_EDMA_DRV_DEV_TO_DEV) + fsl_edma->dma_dev.directions |= BIT(DMA_DEV_TO_DEV); + + fsl_edma->dma_dev.copy_align = drvdata->flags & FSL_EDMA_DRV_ALIGN_64BYTE ? + DMAENGINE_ALIGN_64_BYTES : + DMAENGINE_ALIGN_32_BYTES; - fsl_edma->dma_dev.copy_align = DMAENGINE_ALIGN_32_BYTES; /* Per worst case 'nbytes = 1' take CITER as the max_seg_size */ dma_set_max_seg_size(fsl_edma->dma_dev.dev, 0x3fff); + fsl_edma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; + platform_set_drvdata(pdev, fsl_edma); ret = dma_async_device_register(&fsl_edma->dma_dev); @@ -360,7 +588,9 @@ static int fsl_edma_probe(struct platform_device *pdev) return ret; } - ret = of_dma_controller_register(np, fsl_edma_xlate, fsl_edma); + ret = of_dma_controller_register(np, + drvdata->flags & FSL_EDMA_DRV_SPLIT_REG ? fsl_edma3_xlate : fsl_edma_xlate, + fsl_edma); if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); @@ -369,7 +599,8 @@ static int fsl_edma_probe(struct platform_device *pdev) } /* enable round robin arbitration */ - edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) + edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); return 0; } From patchwork Tue Jun 13 21:31:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692190 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 D877DEB64D7 for ; Tue, 13 Jun 2023 21:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240394AbjFMVfa (ORCPT ); Tue, 13 Jun 2023 17:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231703AbjFMVfX (ORCPT ); Tue, 13 Jun 2023 17:35:23 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEE6D1FF5; Tue, 13 Jun 2023 14:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=diPt5ripJ6GhSQNj51Lpu5el5jBhPRWa9/hNk4CySx3fPAJbtzwnyvvh8flns7vhUU1K/9vdyIMhf4hchuQ5YV6uPb9JMQGJV3ziTkEVN9uzxEw5d5lNXDIWf49ypYpuw6O/G62vLApeFE2cA4d3998upKtsfk15K06GtbXk3P+26nwGkAiKv2QTn1y1PTYHgekxOyPCGQI5JT5L0Nl/A5o4sup2M3mbxu9gEQvCLFB35gvkj1ohemr8wrfBMkP8cvhFwziCvDMFqApYGmwHMaKg4EC7hBcQtWMMRjHa01a9xpSk30WXRkDasp2TKTsAXOlHCaCP0tvirbADDdN+9w== 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=3bBn48GvYU2PDBw7lnQdJEp+7PBC3yqtIWZ4VrcJV8Q=; b=ZeIfBVQRxUrX6O0DxyhBVX11NDP+vNf62vWFfSiKxxvBcN3s6m4cyuzOun7xd9k6YNrkTXaWIdYFQXCE7xqK5FNGrwz3Mlu3hZznd2hZOkWOaKZPc75ijtGfrd2V/10pwUsLbhU3FK11DK5T0jAUtYz+olL1aExWhho38nL6dh7zaDIXJON1uwKz3mznbT2kFCYRWaIIs4OU+zP67YuOXlSS8isdoH5T6+5+VIYf0oPsnNGDaz3cHeDEV6PUO2qkYAxG7WO7uiM08M+brFdftbehmZzcgDM+PvrlZXn2z7eUOLip8H36qwMYlWlQdGg7qUvbdifSHqARVdEqw7JvnQ== 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=3bBn48GvYU2PDBw7lnQdJEp+7PBC3yqtIWZ4VrcJV8Q=; b=dE9YXympFM3GUqKdPL65IRaxrsZwy+eHZcZwG4FHeGGV3Y4ItwfoicQmfJ6XCMlhkraZyNM4zCv1IyTIt+3k+KYOs+lZnBXyntp/Oau5WdY1UYmjMR4Ux4l+qh4S0o06Ox79FcLRmkV5BnBKYkZAspF2dn+Dyx3DZpBH4gb9aHk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS1PR04MB9479.eurprd04.prod.outlook.com (2603:10a6:20b:4d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 21:32:41 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Tue, 13 Jun 2023 21:32:41 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v5 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Tue, 13 Jun 2023 17:31:49 -0400 Message-Id: <20230613213149.2076358-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613213149.2076358-1-Frank.Li@nxp.com> References: <20230613213149.2076358-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:217::8) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS1PR04MB9479:EE_ X-MS-Office365-Filtering-Correlation-Id: 81b381b8-8bd9-4277-3456-08db6c55b754 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UTgPvNPdeF/0/FxowvfqJC0jDV+6o0tGDS3sCl/iM3RwA7hYXOz8rAsxi7v6Vk/0Z7PagWCN78hARAy5m1iPLPipAiK0HWst6npnmO6t+MBGftDVDy/TbfHcl1KZpu7u7MG3V/XV/2ck0y421p2ASdH5DhfTtz6+MlKrpZSaS6hd4qdqnrhZ+j59uiX+TcXvv+7+QYdIhv40EQU4zLu5bHx5NlZ8NNOlMpcFvUJKPldJEQMIB2gUTqTQzwZ13sgZorSl402yyaPOXGrW2UCuINNLUZWvOVPKHYx7fE9jqpxRSPNrUhylGAjFayk6H5VWNjM6V4Ye+/sfduT8JnJEnwOiaaEiJIH/Tv8jx154hgeaHWcUTTil8ysrjL0EsM/WWcF9rnouOn0nKyDUDMt5oHyvd9bMDxgwR+R039fmCeBse3MBxBFJ9saywsSmj/cIhWCcG3ZWyfPbCf45Ic+gbMXr92PSElnOvOUHUjq8QIjWtPLi+RVdjPHYTh9lzv+K4O2F0NVwh5dcEThemrDcuRmONV2QFKrYTH8+KT4EUddFeEzxGzR/R+UFGKCEda10K5r7sScLUEL1C2Ct3xvGQ3zsQaQ4OulUDNjiCiS1lRDve05LOkQhIBfGZVRPa8Lh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199021)(2616005)(36756003)(86362001)(66556008)(478600001)(66946007)(66476007)(316002)(6486002)(52116002)(8676002)(41300700001)(2906002)(8936002)(5660300002)(921005)(38100700002)(38350700002)(186003)(83380400001)(26005)(1076003)(6506007)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y45vNP8Pjl+92VHQCjs3OZ+MsLofV5JmOSp0vWhEzfqgEGtvKpXav24ow/ZNkEnib6Of/BrY87EkLmmcEdO2yXSvhdnEa8A2hhksb+d5ZzMIfUEsLNT8vyewP7ENrVBL+QzrrxJJld9kA/jTllLnL5L7r7CBTdaEUWho0yUNKCRyDbxjelZ7CJctAUUO1tdROyaTqEj4I0kh78xps18D0mywhp1/ieGGJCTCHBY7LE5xLXQkGMq/B1HjJDfY/mQHwN743rbYZTo/xxG8HtMqVkOFDTYsd4UQT01uDCRLA7vNsucOY1+RMy4nRcegUz7XPLNP4JTOhwbofSv+ZesPlv2hJ4nGupYrtoY/eH2NPNn+a0+I3597isac7JAFPNd94csAAMUuqlB0AFVY5u6snhO/ttN3UQbCvNx0Kj0eV60SlCDrLqmEDXHgKXrhjofntYqbbx33PXQKyaE9tGv53b7Yrs/S7Zk6CDUK88tNkCe4SSiLtAAjhp12FZ90XLuuKzLnStJyL2kHTbMecEfYVy/V4VW3TysgXDXFmuOsGkevzlBVl+FISZ/GwaT+Nm/k6VF8A+//kyo8s5vlKDxVZJlLXmHfiKt5A4B2A0q2TLCe8LSXUDHCrJnp4F6rayCzSPGbB40A+PcIn6id7WPaE5Ps4vNS0Cp16hBRakVHKGD/0oHFF7U9Uu1TvCPg6IBFplYmzyck1uobWrBbiBAsNizfdsy/iIO6IYDB1qVv8XIBD/cdd3fuQdoY3/VK2jPhmPNcDLfGWMgKP3/D5jfUkP3gzuEIcv8Ah/eZQKANuK1B4eGpNAHCJ20YiLngPvkRHPRMwk2bvqxlE1Xu71k1P+HQUK5H4rrBnG5kyHoaTM5aaWxNQGL9C8BB2/SCiNGhmiuD4uVmL84efOiCS56SWWlvXKjQCQNEGZkvg+O+IxWlThSaRxZvg3KWmqhx2by8vgxgAjCgbjldRWLar8D2lWkQ5HgyAgbgh3e8qSiANqv/Q+5JwC/2U5tIvpvBcTpdeHApKlRAOOm+Xo1Mn7TKmRO+2wtjhwKvnH+mQRk0G6SIIpcDp0Savn4RFuADTxiPAkd2vF22FJZ+d5pcuxbWyjHTV8amVZYPsblcFa88leKTOLQ8GGdCBut+nB9rawB53D9tx+rnPnrrwDtqBxgH3gd+n6HNPiweP5tTkcZO3nc7X9aMD3hPmM0HzDWAGnzIimQOH5l/d7452neBYgc/zgbIEd0lfCQ4q8VUNODrIv28cdO26CC4g4eU0DbTpG4YHjocZry8v48FnZx2J8L8thqV2uOYWozxbA2+Hgl8OTOMTwom6PIAyAf8FizKacrWeTFAsaSgOFneyrydjhr6T+lLme4+KoEazq90iVjPap0v7lawStR9AwCeyUPFGLEy38l+K5yQwya5UJpHsb054Z2uhpSkVkkK1hdKubzKrQ9eGKEGxQeJWoWceuAY3RfRchcghazHzRAVj0ThoCRWoqUA7uaEHKxMKP5oBYiHdT6j3PVTAZ8fxQGa2lgVKAYZ5q3JOVYtiNz4mFuR7MTaTzmeh/tAmueqckaAhP2qaSI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81b381b8-8bd9-4277-3456-08db6c55b754 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:32:40.9346 (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: LfDY55Q55R/HYAcc6qX9HHFpmP/OSmf+L1rHDrQAliGP1HVQo3TFsWzCeGiTlJvJkMh0FAIKzIwhiILWPWKo4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9479 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Extend Freescale eDMA driver bindings to support eDMA3 IP blocks in i.MX8QM and i.MX8QXP SoCs. In i.MX93, both eDMA3 and eDMA4 are now. Signed-off-by: Frank Li --- .../devicetree/bindings/dma/fsl,edma.yaml | 118 +++++++++++++++--- 1 file changed, 100 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..2f79492fb332 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -21,32 +21,20 @@ properties: - enum: - fsl,vf610-edma - fsl,imx7ulp-edma + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 - items: - const: fsl,ls1028a-edma - const: fsl,vf610-edma - reg: - minItems: 2 - maxItems: 3 - - interrupts: - minItems: 2 - maxItems: 17 - - interrupt-names: - minItems: 2 - maxItems: 17 - - "#dma-cells": - const: 2 - - dma-channels: - const: 32 - clocks: + minItems: 1 maxItems: 2 clock-names: + minItems: 1 maxItems: 2 big-endian: @@ -55,6 +43,43 @@ properties: eDMA are implemented in big endian mode, otherwise in little mode. type: boolean +if: + properties: + compatible: + contains: + enum: + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 +then: + properties: + reg: + maxItems: 1 + interrupts: + minItems: 1 + maxItems: 64 + "#dma-cells": + const: 3 + dma-channels: + minItems: 1 + maxItems: 64 +else: + properties: + reg: + minItems: 2 + maxItems: 3 + interrupts: + minItems: 2 + maxItems: 17 + interrupt-names: + minItems: 2 + maxItems: 17 + "#dma-cells": + const: 2 + dma-channels: + const: 32 + required: - "#dma-cells" - compatible @@ -101,6 +126,19 @@ allOf: reg: maxItems: 2 + - if: + properties: + compatible: + contains: + enum: + - fsl,imx93-edma3 + - fsl,imx93-edma4 + then: + properties: + clock-names: + const: dma + + unevaluatedProperties: false examples: @@ -153,3 +191,47 @@ examples: clock-names = "dma", "dmamux0"; clocks = <&pcc2 IMX7ULP_CLK_DMA1>, <&pcc2 IMX7ULP_CLK_DMA_MUX1>; }; + + - | + #include + #include + + dma-controller@44000000 { + compatible = "fsl,imx93-edma3"; + reg = <0x44000000 0x200000>; + #dma-cells = <3>; + dma-channels = <31>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + clocks = <&clk IMX93_CLK_EDMA1_GATE>; + clock-names = "dma"; + };