From patchwork Wed Jun 14 19:35:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184658vqr; Wed, 14 Jun 2023 12:40:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qVTe7cP3ZHvH90VJLmRsNkjw/xJPlv8/Eml529zsYjzZtv0SW9FRbU8z47ZbdhIaZvpWz X-Received: by 2002:a05:6a20:8f0d:b0:100:ba96:e5e7 with SMTP id b13-20020a056a208f0d00b00100ba96e5e7mr3570195pzk.18.1686771623065; Wed, 14 Jun 2023 12:40:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771623; cv=pass; d=google.com; s=arc-20160816; b=HuLB6nIxFlsE8BfZe848kuz24cmXpT15IuMBEmPgKWXzPA3wWf3J1+LLBoydjYUcZi qRxC7daCXEUhKIQhYNVGhJut+saWzhFsWzP5RKC2R35gpFaQRYrQdgA58eCHOx6PzbGZ 9hhu4kw31VCbDmaB38XxoEgNF7wsT3eZ4Z+d6eOXc2geHtSQ8PURAhh1IMJsxXqF2gG8 gIk22xibDRfP0i44NWY8FV8lN7/W2KdkVeAnF0YhqmCbj5HrxZNF9u7P2W8cEkHNHCdd cNYEcV9AlN4W4nchBHPaScZrEAWuzU6wMA1R+5cJIaiKBZpXpSQs53joJ3FL2+6C/i9R DIYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RKzz/DKQcGPIpSzsnHktT8UhEcS2xeQdpWaKphJia7o=; b=nGUj7p9C9uSl+ZJcoAXZ92xAcp+2bfOT9hpGX0GdUaqLpV1VOz55n66RDT7ePg+hk5 g7TCX/Hyz0fB+jjkgT+pAtpsZBbFudv6rjajZGeRgvUD4+ATSSoIPZLNCxvBTiUe6qIf 9lWvYcRiC6l9rmkRTy3O/uHPe0vbXXrN27DGGS2Ooo2f+qoWKbERp5CRmEv3wdUyyJh6 Q4/8EQZT86PRJO1i9H2GA+KrCRm33Pd309sn8u66oBkYNbK2+0MlDxATVrmu/oJhjpB0 sc5cX3VI+08B5mmItLoxOsdHjCartOP9edJUCW4xWHkUIsecMo2X+0Sm0FlEqK+tMz2x R2KQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=djZRA5Ck; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020aa78bc4000000b00646df7a783bsi11256502pfd.118.2023.06.14.12.40.10; Wed, 14 Jun 2023 12:40:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=djZRA5Ck; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236829AbjFNTgO (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234666AbjFNTgH (ORCPT ); Wed, 14 Jun 2023 15:36:07 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2078.outbound.protection.outlook.com [40.107.6.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CD01FCA; Wed, 14 Jun 2023 12:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GHGelxCAAzI2NFQLjud5/pYxtY+YGtbdqf3IVuBfRrekzQEonaQUxsDvvYbxcMtaxZiZkfEKKFjzvMBewtn8icbCFyCpcdG0mhuCcJJc5k2McS9hv1o8P+/fa9TEQG+AQW9Cf2a2voRlcVrpoBsK6BNivPU4ECfmcelAiIxpshPSygQPcbaLYJkch6PzYnD+maKbBVDE1hzyTcuUQ8HgcbmoyO/J9MWkN33jebJZKlSGSbQV11c3jv2nnXr1pnhF8N23PV8gVt4iiwUVI5oMfA4DAiVqNIzqKZhTlA4q0ykzQ2VVnQ1ghj85MUcbzLKzjZHFEFhgAF0UqG2M6i0BrA== 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=RKzz/DKQcGPIpSzsnHktT8UhEcS2xeQdpWaKphJia7o=; b=F+6ueDFm0MzlA7yvaA4s0HG8P3NjW03IMMtiCsBirS8Df3Hzq7tpKUuvt+3yFoJdGvVN4nwixcSR9OvNMW6LXw7nS1gxHzTdVYt9v0lxR56GFPqjHyrXBD1qrhJeiiqjLYjShBodpe4DxWFc/IYcTskDu6rBwV7Sj7AtmDufc7/e7wzNkNJigRdio5Fz1C7S+xH2pNocRkliQo9ys55Gt0PQMEb4ZzR6b1hzMtKkxMr/55B56oNQNAtgbiNNyP/HhNNq2tYdgTdvsgLpeqA9TpkoZg7E4Ta6/3/UZuTDQ5zmhTZvFtITR+ewyZ8Ow9XPMzkM4vwsWffsdLovTXXCTA== 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=RKzz/DKQcGPIpSzsnHktT8UhEcS2xeQdpWaKphJia7o=; b=djZRA5CkpoIGDEuY3w+3FmcBmf+M/x3X8+kzvBfqAkvmLiVdBrOAeGy7+2qF+zQAKC3sBkO/v+ulvhbsJ9uRnE07Rc2IdONN23kJWKau4dJKcEjLTnvaeaEY+atMBtYwrEnKhdyLtst9a3tBn8zSubLp3TDJkRCwYF6eFfxPiUk= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:03 +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; Wed, 14 Jun 2023 19:36:03 +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 v6 01/12] dmaengine: fsl-edma: clean up EXPORT_SYMBOL_GPL in fsl-edma-common.c Date: Wed, 14 Jun 2023 15:35:33 -0400 Message-Id: <20230614193544.2114603-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: e9e47fd9-b705-45cc-06b3-08db6d0e96ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FAept+TYd9FQ+GUCoK9V1E4JqItS/QkhNTzZW+Y8Qx10N7ZWN6WVGJLSCTt73XnSmc0bSmrd5IAufZmNyKHrHlAifQQUq175kIItBuPWHOR19Z6TATlfNrE/8Xgf0lkzpTc8fEMKB4TMBbrkj3WITOgfqqhOzXHtTR5uvmPM60cK14ldtRi0jYefEP17sXcWAG19YvAkJc6qYwHoSu9/Gx3d/m3rYnVB1WCeOn4fVTumll5tyQy66E7irP7LVOLFdrcbl1wKTLTt8SI4xNSRXLo2rlUFS6Tvc44gerGu94PzDzBIig0CAlyi+rUFDAISLmOYpM6C4xCK9X9nnEtLMtUDykgDltLDUwWXGWT9ohYNaziKhd+FuuthPwFa3zCk+uaKXPZOOv3ffZROllY2DZLakOFQOedGu5fLqwjwcNlB9pftx98ymUAIIXWaV66sGl6VWAzuQ1Aew1CSV2chvebDuVfcJdN77FHUaeixsdO6lcoUTVIMOw6RSwcFmJR4fcmFlgTEG0hS3r8SEiZSJWyeI/PXfE+RD1C4O0+M4yiBbgRr8DOVOr+XIbOu5sVCQkCAatL2dE+gcTqOB4DmvT6hEsr/26jGUvmsAMSKk/glHjvWIk11BIFOMksaZ8X1IopUL+omkWqALC3S8D+esA== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z8LQuv8++4pgpcz+SYu0fyxs6WEr3vat+Ah3D2w+XJZwGI2unPbVDPXY7ZxVkTFCvqQL8DsTbq5v6n9NKcIs6zP4aP3IsoGrFa8ZSxAxHyaNbQxMjCAKnELEVtPZBpQ6yXruQwSDcBzy2kJ3Xu9y7AqViHpSMztI/VBGo+k0KpO/ls4VHglmF03NEJ6h/TsVwHcrGDl+MPgRIKFaQhyyTDZKy5LWlS3AsGpaSb7ckziaaKbpkkCoge4r149Bz3gIqHHb972RADTxEYNqi8UxDBkQy6KHCGWz6XJEsCoNWOECOMOctoOMPLM+sOziRpAWsk0dVEM0jUQPdRK+06b0PGZTexvaUe15ETKNCKzt+czKasgQHDiq4kO2TV9IdVYG/tWyHgOVyZoszzs5c+7QfzovdRFimHfAd+Ssm4MkKJuxAHRUZ2GrmCML1SZj5Dk1/WAnPMSnr9AvRHmrqwHViMcCj95CuOCopQE38lGHRBhWKpDbAcSWI44bvrIBIgHPFmvgnZ1/2zlghY/iJ1tP3a4m0v/Sb5aVvqGhIz7iDAa6Zjpgy4aeh/LXshbe2atjHHCVRbLs780PUzq7Wm/7lEZFqomwUcLTVWlvLt9Y5bKUSIZHfye/h0yEuaXKMBQkxndsS7L9w6HgfjmUfD4SLl8gKIG8wyW8T5mnZ8svyrga8Rww2THFLWc6lJAgFYfbcX6lZeZvXBqT2defH34yUkRaINL7x2kUFBRfAWtKhky/CLHhctiPVcldrFhDsqkRbVjR5zqFzUtY0VnA0IWTrKPE6usqNnA5+0ECkz2I6bvqr1ygtIdLLUL4ye1WBPaTmRZhD7VedNq/vz1UefhDFXg+n1NPolq8rD0ZzxwHixBhHstGqH/j0pGxz9BC5Jz0R1nh6TPokDJsSCogNuxQWplU6vGchXI53sj1z+RUIOFUdbYw4YO5uQCdCV+Q/npXiWUoi94VPrwEDFYvPa8x5N9MiurFF3TEO/6p5okVypKaXUipuRko1MJkQUwZ1m/vKWet+2gmw4Gulu/l187x9tdnXKLY9ALNSP89KPUtvPd3UzxuuIO4cP/KME+jSyja+GYEY78g6y0OBdYWo3I4tMjZVrACB8xyhzV5IPBhAVDiytm8gANvct68Zm6LXrIi2zHQg5cDCGFNfp0KaefqrlkTLHYAR9hz0lsiVUVnqDp8X/e1rq8N2mYXa0dL9MXwcPUpdnqxOK8OCNV8p7FI2jNrN2ehhtVL8OXlPbGKpVCROKfqn8R7xNa43m4dpMU5wLPaNtiUOMumaXs7fIs1+SAxW6EbpstLUGfVQVCVL8Gb69XHipcXJWBm9HU6cE6YRjdNorF/qsCONPwgKT3SIXYN45+3EBLmrd8IEBdnk4RjU8fjtjiWNdFo3MjAJVe6XgFlErNgs4OZ6haMnTBW7Gkrr/fx/I69kdf7gpGCHaXadP6oG8DE9q0UUtDL5SB+nV8uc+ZToDtyCzxanBCxL1ofMvz8NHBsn7JnHAAKs2fJq4BaxncDD4l05laAsSS5n8m+bxqGa8HhbxXhXsdWSN+hJ46UysfvxFBShjYv6BjAnrsGTtwxjmJuZSxCJ+0G X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9e47fd9-b705-45cc-06b3-08db6d0e96ac X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:02.9443 (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: oxTF/yl7TMz9n1UQScQBb/zPtFYx2MDsdz9D+JqyO7eI7FQtTLXThOZHUEXFoTzxfmhqOKKg+6I7X6LIVsYWHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708241525483835?= X-GMAIL-MSGID: =?utf-8?q?1768708241525483835?= Exported functions in fsl-edma-common.c are only used within fsl-edma.c and mcf-edma.c. Global export is unnecessary. This commit removes all EXPORT_SYMBOL_GPL in fsl-edma-common.c, and renames fsl-edma.c and mcf-edma.c to maintain the same final module names as before, thereby simplifying the codebase. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/Makefile | 6 ++++-- drivers/dma/fsl-edma-common.c | 18 ------------------ drivers/dma/{fsl-edma.c => fsl-edma-main.c} | 0 drivers/dma/{mcf-edma.c => mcf-edma-main.c} | 0 4 files changed, 4 insertions(+), 20 deletions(-) rename drivers/dma/{fsl-edma.c => fsl-edma-main.c} (100%) rename drivers/dma/{mcf-edma.c => mcf-edma-main.c} (100%) diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index a4fd1ce29510..7f3d62c9dee2 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -32,8 +32,10 @@ obj-$(CONFIG_DW_DMAC_CORE) += dw/ obj-$(CONFIG_DW_EDMA) += dw-edma/ obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o obj-$(CONFIG_FSL_DMA) += fsldma.o -obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o -obj-$(CONFIG_MCF_EDMA) += mcf-edma.o fsl-edma-common.o +fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o +obj-$(CONFIG_FSL_EDMA) += fsl-edma.o +mcf-edma-objs := mcf-edma-main.o fsl-edma-common.o +obj-$(CONFIG_MCF_EDMA) += mcf-edma.o obj-$(CONFIG_FSL_QDMA) += fsl-qdma.o obj-$(CONFIG_FSL_RAID) += fsl_raid.o obj-$(CONFIG_HISI_DMA) += hisi_dma.o diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index a06a1575a2a5..ce8d7c9eaf77 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -75,7 +75,6 @@ void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) iowrite8(EDMA_CEEI_CEEI(ch), regs->ceei); } } -EXPORT_SYMBOL_GPL(fsl_edma_disable_request); static void mux_configure8(struct fsl_edma_chan *fsl_chan, void __iomem *addr, u32 off, u32 slot, bool enable) @@ -126,7 +125,6 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, else mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable); } -EXPORT_SYMBOL_GPL(fsl_edma_chan_mux); static unsigned int fsl_edma_get_tcd_attr(enum dma_slave_buswidth addr_width) { @@ -155,7 +153,6 @@ void fsl_edma_free_desc(struct virt_dma_desc *vdesc) fsl_desc->tcd[i].ptcd); kfree(fsl_desc); } -EXPORT_SYMBOL_GPL(fsl_edma_free_desc); int fsl_edma_terminate_all(struct dma_chan *chan) { @@ -172,7 +169,6 @@ int fsl_edma_terminate_all(struct dma_chan *chan) vchan_dma_desc_free_list(&fsl_chan->vchan, &head); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_terminate_all); int fsl_edma_pause(struct dma_chan *chan) { @@ -188,7 +184,6 @@ int fsl_edma_pause(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_pause); int fsl_edma_resume(struct dma_chan *chan) { @@ -204,7 +199,6 @@ int fsl_edma_resume(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_resume); static void fsl_edma_unprep_slave_dma(struct fsl_edma_chan *fsl_chan) { @@ -265,7 +259,6 @@ int fsl_edma_slave_config(struct dma_chan *chan, return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_slave_config); static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, struct virt_dma_desc *vdesc, bool in_progress) @@ -340,7 +333,6 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan, return fsl_chan->status; } -EXPORT_SYMBOL_GPL(fsl_edma_tx_status); static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, struct fsl_edma_hw_tcd *tcd) @@ -520,7 +512,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_dma_cyclic); struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( struct dma_chan *chan, struct scatterlist *sgl, @@ -589,7 +580,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_slave_sg); struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, dma_addr_t dma_dst, dma_addr_t dma_src, @@ -612,7 +602,6 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_prep_memcpy); void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan) { @@ -629,7 +618,6 @@ void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan) fsl_chan->status = DMA_IN_PROGRESS; fsl_chan->idle = false; } -EXPORT_SYMBOL_GPL(fsl_edma_xfer_desc); void fsl_edma_issue_pending(struct dma_chan *chan) { @@ -649,7 +637,6 @@ void fsl_edma_issue_pending(struct dma_chan *chan) spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); } -EXPORT_SYMBOL_GPL(fsl_edma_issue_pending); int fsl_edma_alloc_chan_resources(struct dma_chan *chan) { @@ -660,7 +647,6 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) 32, 0); return 0; } -EXPORT_SYMBOL_GPL(fsl_edma_alloc_chan_resources); void fsl_edma_free_chan_resources(struct dma_chan *chan) { @@ -683,7 +669,6 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) fsl_chan->tcd_pool = NULL; fsl_chan->is_sw = false; } -EXPORT_SYMBOL_GPL(fsl_edma_free_chan_resources); void fsl_edma_cleanup_vchan(struct dma_device *dmadev) { @@ -695,7 +680,6 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) tasklet_kill(&chan->vchan.task); } } -EXPORT_SYMBOL_GPL(fsl_edma_cleanup_vchan); /* * On the 32 channels Vybrid/mpc577x edma version (here called "v1"), @@ -743,6 +727,4 @@ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) edma->regs.tcd = edma->membase + EDMA_TCD; } -EXPORT_SYMBOL_GPL(fsl_edma_setup_regs); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma-main.c similarity index 100% rename from drivers/dma/fsl-edma.c rename to drivers/dma/fsl-edma-main.c diff --git a/drivers/dma/mcf-edma.c b/drivers/dma/mcf-edma-main.c similarity index 100% rename from drivers/dma/mcf-edma.c rename to drivers/dma/mcf-edma-main.c From patchwork Wed Jun 14 19:35:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184310vqr; Wed, 14 Jun 2023 12:39:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6xr4toJ0L4nc1I1qiQCIxoqHATTJJf6rg5l8aG/CAknJQ49afU+mEkXdXp4rYqwlhrUyBZ X-Received: by 2002:a17:902:db10:b0:1b2:499f:672c with SMTP id m16-20020a170902db1000b001b2499f672cmr13992057plx.33.1686771573064; Wed, 14 Jun 2023 12:39:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771573; cv=pass; d=google.com; s=arc-20160816; b=1A7FaulKMyFHf8p/RH6AZ2cXmzgBthp9I0DQwYb/qvv5HcHo1h50LqtBdggQgwcfuX /PZ2EMvBRUxVnTMeEijmz4Xi4rVFpTGlU3CXVh97jJDTLOAdUnquAtnGoBGemQWkD0dg 2OiHQuUPrOpkpIJXGlOCtm7WyREdbyrpeEZFPEkvCweMymUgszac46Epceo0NZNH5J5x KV/WmZgxfdSV0UX/V6DH+d35Dz+U4lHDrwMOTbiwG6VXjGUPngHFfHNuyZ+vSiFFjlRt gBIaobOJ359DsIsoNSLSqBKwflPPq/eACxMcaXyu4QbUU9vAyv0KoYHfMIqyqH8QqT2O 5/dA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QI8n0XPwXsaaH6UZQG+Zvq7pxrcY++lIzGOz4LgaYtE=; b=F5zKau4yNioVDvipB/bN3GDDAALre4fqGmALGK/Fye0FbZjPc/y4mCmLer2/ktYtAA azGFDnOWJ+mkHGKJVVrO0+gxgKRO7TMAj140CP3T1154OvRAMGFPdBO9y3OuYdFXyIwU Z/9lUr0kXwh3hFSNHTVYKhg3/vSIH15ovZCZ5zEMPLJhSnLOOTeqFaviY9cIZUBiuURE xAngSfmk/GPiGoHRCnpqGUWqm4LUJnZN2vkFrEBJl+WTMlHdVMzWeEZc1/x48xWS4ln7 S5t7TQXuGSr0E4P93SYAb0PyeYvZ5CEvjgAYy68AyrkpjfW+gjkJTla2YrEX6xWYBZ5Y BKwQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=edFs8weY; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a170902ec8900b001b216490170si8555378plg.258.2023.06.14.12.39.19; Wed, 14 Jun 2023 12:39:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=edFs8weY; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234666AbjFNTgS (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236224AbjFNTgI (ORCPT ); Wed, 14 Jun 2023 15:36:08 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2078.outbound.protection.outlook.com [40.107.6.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB471FDD; Wed, 14 Jun 2023 12:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j/k9A3VneUxLnVlQd2NNW00VPSDFJvGerTFLJeDonovqq4PXu7p/aTR2VtkI9+R3WDvWPLtJtenTooUcAKjv/7oMMq5VGihiqxUmkd7073f4kh+N2qloapAdoDM/OdZSXWL/266GJp/f+AyQ3L2AVmpfw7Bd5nS8ibd9iDtsZ1cu8S/XK/UbweaZV2/mUaXvYgPUrPCh6SlHll2zaXkHwv2xFClNqujy7xoLZr0UhqLWcUy+qPfS++H4ON1ecO1RXfuqCosqnCuMuAsKSkRC/Iyoambh6iw0RYbZryS+/nYaQwCkm+1g7jo/q8fYyMgjEqjmdlCQhNfbS2MDbQ1PPg== 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=OURMC1ab/ILI54n2s06PARv4AZyTJkLsboEavK/upLHCIhPTGS3D/WnPS0SQBBKpN9bVnrXCCQ9ld3IysfEowqNMvCn08GDisM5Phq1bMTda7smxs/9RZtpw9l7+Sqng0H5jo86xKzZy5E4WT7tL1jHp2YReLdrMC/ncyajkwv76LExCTIosX9RG1bA1A0ew2YVlJ5duv+VD2ybV6Y7DKxdHuW3jC9Itm6VhouXvlBzcAwQYPNHH8fk2Ap5vK2zGsD7J3y5iB7TmxiJmLri9XOm2fJ23MuEaKU3+/M8yus0u9YDWE9doNiI1nErCRHTgSRiuF3Ta3iQPCDBkX+2Qzw== 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=edFs8weYWu8mbJISeo2G5stw5/6vK45NY/kASEDJ2GkLA+uesNPZVhk6yaqDK64KLmU/Km896aZH+eI/RtFur/Psn/ZZ9LppLlkm74/I1bprxALgcUbMeyIJP7QKzlzpMb89RAxCgch0KQa4zRpelLfYBw6kH58w7KeQC8RvTXw= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:05 +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; Wed, 14 Jun 2023 19:36:05 +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 v6 02/12] dmaengine: fsl-edma: clean up fsl_edma_irq_exit() Date: Wed, 14 Jun 2023 15:35:34 -0400 Message-Id: <20230614193544.2114603-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a87f7b1-6937-4168-9cfe-08db6d0e984f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QU58cMv1mt/BdVSnBFk2QdRnXMBPF0JAGBsXIHVTjLTy2L/aimj150Bp8L2bXnzZMqttwyHF0h7MNYuAzMmqyrnFSUGu0QdqUojlwkn6tjBfO7UKG3GqQwz1wP58uXa6a8OEngRHhEbNrvmm3kwuU6UPfZH4EJ2POkGZTDjJpe4ZsMy8tHfNHao4UUHOJtB3wby5rilS040C78iQEBbF4XK4Fxyk79KTr1C1oKbfnyMJT/SUrSt1M3/VxqkzZvhzWfw4I4JeKcTsQdnQhQ9fb2k+23T2HqOGUf8ZVMTLFnBa/JuuqIjJfN23ZvDT8t/fnGhUc/PL0VDambMcFmjOOyfoz5xIPc/iMs0Y26qXxGfr1n2GGhvtDd8xOy5Lw7AC1L9e/xbu7bYQ0tg6g9tPuzO2vZfAfwQWfFB44zIqnxck/cTlMBLZFDM+A0tYXq13Ahm2EmOXOqzPyVUUsLQMLnAhXSJHgXd9TJJwLc+fLNFLeHB8R3BW6sRnHbRcnLv6QyTcPdDyI5eRJxjJZ9ht+EfU4+maNO7AfDI8TKx/eIS15d3vxlZsChkcXEt2kWGEafi+HUEBjkob7l/fditz00Slu4KDxT8JfqjTYKAwLOZgGPA/VQ9Wo9Cn5MPmRqF3T0DBopxYQRl4LB2Qwrj8jg== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ggXCqkXWrTkp313HD/sOFJPIt1Mrwb8+ZCmw345fetzXo8/gwWepyqVYa9YReDcgq8FVubkk2dLgaI6nudYefP8W23UAQnF2u4hyHKw768UltvtYpDQl8H/gHmmtoRT6jYJfgC1yy6fYtc//gSRj6aKpAOyiL0ubcNZW5ySSH9X8ff1ZMU9GmMqwRW87Uv45q7ldLYXq5H1Wl4GTzPzuVOY8+HW+A0fZaPvpJQj5AG0WK2R26tBuU24hvHCkhIHZ2pMUnw5YzTXivTlJ7+ut8NIskvKLlDcTojGKL4W0S1lROTxyLIykQCRXDIvpQGRJTKdDq9amTPj8WPLiFCeSEYOfhNNeTGk0/lk5WgrXyZ4N0eJ+bk/qgWm/FMWahAKqbBX/7aca9ZmWdLuh1FUXrbJwWGRrO+tAHNiPPbMij1bRw826r1a+57na1ai3y2bAQkDO/xCDxoEnRIzqiV+DeuGdLZ+PRbN6mS0gRaO8K9s0pUlr3HLOr0AGzonvleBVFhJrzUUY8H0gc9yQesVP+SpKsoXly3CfBDeh3GVAui/NFDWKD65HAgJJlwrU/ATNhqkCsS/hFIuWf3Sy5IxUWRKzR7JVOgVIz4IZxxMq62yyyiT9/xQp4CnZYIhp/KEDvMiksigqUJ+6gJ97I4QbFSPmj4ZllANUqlVXfjFGurfyejAoSN5ZcKHRr8WY4AEPzyHecvz3RhAo1dBHYpzc0nY8fRWnSO0uk7TwOAqmXWvsbpitL1YtINr2vmfP5eIebPY+aamM0DSuoLGsTLPhAvjTd+WpnsdIvpn9EF4pgJpD9KwJmh2/PQ2drUwrj8XNjpkpxziDxuXDeytUXYXpj4rh6GRKlpYpOC5LdH22oEwqXqIE9q/bCW5t7GpJAad4qNu0S/d1YjbnSCK5CJ5LchajadhiROOkoFCRR3dyUj88nq/+yJoEO14iEVJhLYKoTjacT5w3Km/IRVEKCbSMYRPaNx4hvvH0a1OQ1JDRZ0uvD5WNrlni+6IPEnadm+mv8UBJW2ZzgS0Uw+CdmRuI1fZmT8p9j9xX7Q73H9KmG1sAimWcNFBz8Qgr89/b2JDFvMpRGmmuimpahecX77sY4gJNpuK3pE/a9mVYdpV7MlDLOHE38iVTEuyHVAkSQ41WwNpUxuLqzEj8S92rzaFzgqsEEByumJOOu4JqqvveDD3kljN2LI08zUFq+kvXJusn5Xzsg51L4NCKNO6C1BTwLt+4uOsiy5WzYF47rj9oCsNsdaxLm2tLmLYjJbKA/70oCUf724bI0PKdg5JdDjHQTWHnkWP/VkseZYvHFRSbkdLkyfpPol39BfluPbl1TKKP5b4ZXIa0c63B0Ywsg9QqpJe2M23mFmSRgqmF0t7ipprWUWQbyVScDP7/dYVqRCK2EpUUMz+gCXTut6piHEFRBlRRtWs4AufFlG8WXCqDvfWQWtj5cRLqwPNHUXsPjJv2wQA8gFAa43rg95fqL6MfzBTgRejformV+iHtefdrkGEEU1pawiCMUQP/lO2YS2LexCmRpB0IMFXjMqykasalYPG53p2E+VJIqsMmXkWGcQCIZz0VXxX34CRDkiN+wdkz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a87f7b1-6937-4168-9cfe-08db6d0e984f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:05.7347 (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: fQ+ghYW8pcW7hOtpmrCWxVAaigosbyF62U/TTHsbCK8+CJFUwlx4qCEwa/yMfZtYGzawuY45iyArWBRmqtqv+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708188660518717?= X-GMAIL-MSGID: =?utf-8?q?1768708188660518717?= 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 Wed Jun 14 19:35:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184758vqr; Wed, 14 Jun 2023 12:40:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56Xa6OR4UYwV1n9RLrxogVp6k1/sjyrU3xgjcb/KS3csgVNCD33nAnV3POZK3TSLxXIJ9N X-Received: by 2002:a05:6a20:543:b0:10d:6dc6:32c8 with SMTP id 3-20020a056a20054300b0010d6dc632c8mr2662562pzq.32.1686771634142; Wed, 14 Jun 2023 12:40:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771634; cv=pass; d=google.com; s=arc-20160816; b=s1NGoFjLQo9LKQHWvHEYuCfzS8Cv80tsrNGEJAaXaTAbzIdztO1sdDHigBf1Pd6XK5 6OzJ4w+c84+ixu/3FYiwwhnHb5efEzKD34HLLeBnZtBGEEte0BdrnsPwWnpmw/eo45yO A1uHoXahn0TzqBZxm3MFs1kJaztLvgXXFkmhrQZwI4rZhNVy/FhEZcT2VmFzazAY8uOI kZ/oZ/j2n4pA+4CE+avX7wdTPpsib7OIYlmU4X6fw0GjFpgQIrMHFgWSFEOZIwS3ZTjL OyEZOxpCs7vBUgjj1w2iQDS2ZlAMLr0qGEKWqwlnMYik20NycrZMWN95h5DV9/naawT1 MQlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w5Juf3kOYMDDqoTfA5YQdmkMKOm31LEp8hl7IUV/jfw=; b=U9TFvXQPzTCP7oubVlAhR5K5VEmbPmHvTL4yL/eHXPAuAzMFn+LuxSbzCMBJEqucJh GOp5FljIwt1yhs9gQuMP3BoYB5XbIDmXUuCV+x0D3u4NTkMNVt9Rq2BzaRaQ28wqmEM8 cI91hWdI+nOnlVFhw2NHFgE70ZpeJXTaWD3LbklgleLUpRexA0QDJQOmFv8hWJd0LQjT BhUbhEgSjmEerZayRlm4ETMmoconSND2rt001nKm7TEafWZVvXCNLSLTTnrcs+gMXvsw tdSBBFmSnpyk6PakNknCOOVeb4UrzI9UGUiU/KKU9FYGJ+Ry81Bh/JOSlkJrwYxcwUdX K9/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=dmoFzVpl; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a637312000000b005194eaa611csi11642503pgc.397.2023.06.14.12.40.22; Wed, 14 Jun 2023 12:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=dmoFzVpl; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236224AbjFNTgX (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjFNTgM (ORCPT ); Wed, 14 Jun 2023 15:36:12 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 991272116; Wed, 14 Jun 2023 12:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKx4IVUyVzkqKE4cFKZikiz4cyfTHHLULvG6lEYcDuMYVLZv8sYDMVgea8vgRDG1IXOIcCQ0FU3eF4Bz0XLmtb0vBy59DKe8vR3KWDBKiHC5glfSLxax+GVGtJANZNSIAwt7Nnu86Hv8fN9izmspGqhJTGRobjXsQC9yaTdKt4cyhQetE2ZepFTPETNjEbyJ9DmI52E52kMuDnFeoY+9Kv45ArAp/agOKuOR0zTtuLaJOfa26B/+kqkfX92+4WDIRLargHOtSFb+oVT5vKFXUMmg8XLwhfd5S0hvIIEGvE3WCztlskHb3+fIMm7NOPXjziHll2arUSZZ/ou7yYBpfw== 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=w5Juf3kOYMDDqoTfA5YQdmkMKOm31LEp8hl7IUV/jfw=; b=JYWmvxLl+xK+VpPfl+g2zjUlsQ01pzY6n8kOOc6GJ0VW66OESL5ntw4edLd6o8KQ6A+S+fX+TRFDHbfdTn2rD1Js6jfvn+WiPBd6KCO9p4o5h8Ib+E+gKLdHNRNT3Zz/YbWAK0CyANvtVR1lherkptb1CN1jTfwxq191DiHrUGOq8rwSYbDIrg4lq9W7KzxG3Vjv/hvbfrSK480RDxYVzJiipHd3G/lvWu5wg5FWlP+ccwMBr4D/O6rdYHd2sSkj5rdcZlOQpLfBK6K1kDvg4JvfoNhYk7KEMHxDyj32qeyAXAG4LLIMXvp8lfpecUfe+7h6E1LfHGIIBRtzuWvVLA== 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=w5Juf3kOYMDDqoTfA5YQdmkMKOm31LEp8hl7IUV/jfw=; b=dmoFzVpl2LpIAikoJjAlpn7yc2o2e/N32QamOh8OifLEbv3rrsB3EgXvdVDjQmhnXhxQlsiv5QUEryWqtms//6i+NTUmK1GCxQMrCLpR9TxomeQJKp7hi7RtvZWbGjxbz4lUYDoJ+YbApmC4SI/fsEg7E/0WzCR1Cv2FjM9NDKI= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:08 +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; Wed, 14 Jun 2023 19:36:08 +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 v6 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Wed, 14 Jun 2023 15:35:35 -0400 Message-Id: <20230614193544.2114603-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a10ee68-629c-4491-45c1-08db6d0e9a06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ueqCbXYx0cVSGbctVbu2V6qJhON2SlNwiZaDzCg+YvUBoyZElKf85JsulCrMPwkZf7WgaCqvkeIpIAhn+lR6R8QxoxBvwNFmTj9qy0GeW7eJFLDk2NOXTzL0O3qEcMzBjI7lF7waHFZMCf7NLw1NMOSMQUZJHtV8MxFWSH5Mi2pkkdMyAzHyOglvCZEaDfIi4f2vg1bQrZTjdpIOUtyE3nuY/LC9RH5WZw82WTDJp3/vYKJKwoz72PH6MXfp3KeStCiiekR9RmBanQmSVZwXiLDhZpx8z08YH13d62MIiLbBpSYNfc8Bp2EGS6rwBvThnyqqMkgMKfWG9ZAURRYwF+b1tOdEscfwfe2rgEQJUtKBl6ze6T9/hrO8ve2xTEFpLJ1rVgjcRNB1Xk8+rzChaixpHaj+D4H/mEuphUxqV38wxxAU+4ASVwXmdGlDjbEhxO0oofv2DkYtdc2te4fZ9jRlb+XPtzVEO5EcNze3QkTZOfUPN/CzZS9RanHR3MvWP8NnFxgjV8nDeIi+5xYzfwhV4d35ZocwhKzrCjfpZGrltk+u7NaLd8ExEgaAtuXbeOQOkw0qNaXIWqKe2JOuzDVmBSW7ye4R9E0s7yEtcJLzHkLpHWZrGsAg8zqlwI+QSkAAHNV9rA7X/3NGYMq/Bg== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sd0YdUmJdStZzF6v/JzaQo7lAVuamI8vHQ33Rwv6M0C6MtgZOb1ThYuXVqBN3cmt28ZkgEgiRL/jf0LDls+qsiSJk4lwSBS7W5GTwwjqlrIE41x8ZQdLCZbo6Lyr0hBuyfz8L8G/p3ZYFHlHEtp7BvxbciH78tGDfcOZ4ratk+M0l2kyYvyAiHGAG5BhS4EWSHnJfDcHLdStY4EBmd6zmTcHe6Tn61diDyyI1SE3ezTqC5iUtMn3pphRjZUXdCZSOSRkL+nYSfCAoz+kqpDo2+lk+h1KeGkrSIpMOfDXVs/aHA6on9MDlKxOuyjQJsCiwij0JG2O0qfhMoyhbiAVjv3FxMHTo7ycM5JZS9BNHdYRnRfyxq+8SBu1iaP7XJ4Ji0+WNh8zGOk81FYVYTbscesWgheMCwsYFH1q/4ujubgqX2XMPD6ckUdR0cY7dQfQ/dTPwNAgrwcpIJU0gUIHgmbPHlT2I8k370p/dgo5wCIUUWasfeDGkrAt8A2+kJoyfvNltZZ+dqjIPlcEPtMAzAtWNewsLAmAuju9okMV1F2poB+2+y7iw8lwPyUw+eSXJyoJkLK9NWj5/Rogm6PyAFjqL8Jli/uvFn1252K7zyVc0zsJE+znGHwcV6Y5/VJIIPEhCC0QFXdkkHpdjU46hPS3koFOtJGJn579cLLrReQ5ENT7ZuGSE+O+EDG0p+/+j28raKEmf00zQ/7k3A2J5nMastKLrk+Z4GsRg17/peRRAU4vOs+Im1uifFeqIdR9kzZcA1HhTvPbt9ckVUAIeWTM5ACAQQOeL8jIDUZtEdRsjFwsqzMdoFXCnh1RA06u977fVEhLhlAa4q6EMFMbH96PUx8sBnSfEg2/bW91vPH92QsNZGFy96R3mj9jgjACdWke9h7Cqi6ME4WCTcY0tVLErkjtVrIEscjxIrUITmMIzH5DT/pPzgUI/J/bZZ96BV6iXAc6VAuAzZX0ABkgMmMIXNSk6FLGN7tHcEcvfxKYgmqthtBoI/UZIK7kZj4bgqD+HWH6Qym80BfKw74w5H2LwafJsV2+h6af+3i/EO3llrw8g6DU3CxG4Va8rm5scyGLGfiBEWg/pYG3pIuLBa0QYtF9fXyaG2ip5zmNyY01M/7s0JYbGe6pNARAQPOuTcm+BxRBMCMGNiPKhp+ZRtaDRXHNkhApm+ukgRJboHGaRyjH8t2cW46V+FXpLte68JrFRz2bltpyKhq5DfFdemsr1+igpQkK05R2Hi39jYs9y4Ps2MmqNq6ZTCtGXg1TgtcLPZynOagJOFozZHUpSlbBgeCQPuA1NpgtLMO0lXZXIefyBETonJW7cinAolCy63K/+9eUgBPcr064U4SbfuVsHXadZnlnb2ai8ccwBbxr0TBV3OWTMN18kpt5ZEt2ffG1BftzOxImwx8nZSWIktO4FjL1gwmZWQtAdVdDA+/lutmYB59SWtoPM7aL9pAU547gnw8Wjn6DUiX0HrfaqqTftZ4NuuAwuLQ4YpVHoNDXnATql8KmIEtjM9u2C0JeWo7aT4ppzON6FG9PQ4UKsl0da7EPaHF54wRsLnCekb6xSe1//oOm7aHF+2U0+Flc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a10ee68-629c-4491-45c1-08db6d0e9a06 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:08.5683 (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: mVWd4m682OrVjwdtCXhBL2NUDb2iRwhkdnED3KYQFMrz1D0+5zeNcFuHztLZzcgjImtGdqRZsYNc4ih/oSyDDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708253023754887?= X-GMAIL-MSGID: =?utf-8?q?1768708253023754887?= Replace individual bool fields with bitmask flags within drvdata. This will facilitate future extensions, making it easier to add more flags to accommodate new versions of the edma IP. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/fsl-edma-common.c | 2 +- drivers/dma/fsl-edma-common.h | 5 +++-- drivers/dma/fsl-edma-main.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index ce8d7c9eaf77..10dcc1435d37 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -114,7 +114,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux; - if (fsl_chan->edma->drvdata->mux_swap) + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_MUX_SWAP) ch_off += endian_diff[ch_off % 4]; muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 004ec4a6bc86..db137a8c558d 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -144,11 +144,12 @@ enum edma_version { v3, /* 32ch, i.mx7ulp */ }; +#define FSL_EDMA_DRV_HAS_DMACLK BIT(0) +#define FSL_EDMA_DRV_MUX_SWAP BIT(1) struct fsl_edma_drvdata { enum edma_version version; u32 dmamuxs; - bool has_dmaclk; - bool mux_swap; + u32 flags; int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); }; diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 16305bb9a2ef..f5cf95d185f8 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -233,14 +233,14 @@ static struct fsl_edma_drvdata vf610_data = { static struct fsl_edma_drvdata ls1028a_data = { .version = v1, .dmamuxs = DMAMUX_NR, - .mux_swap = true, + .flags = FSL_EDMA_DRV_MUX_SWAP, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { .version = v3, .dmamuxs = 1, - .has_dmaclk = true, + .flags = FSL_EDMA_DRV_HAS_DMACLK, .setup_irq = fsl_edma2_irq_init, }; @@ -293,7 +293,7 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_setup_regs(fsl_edma); regs = &fsl_edma->regs; - if (drvdata->has_dmaclk) { + if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma"); if (IS_ERR(fsl_edma->dmaclk)) { dev_err(&pdev->dev, "Missing DMA block clock.\n"); From patchwork Wed Jun 14 19:35:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184435vqr; Wed, 14 Jun 2023 12:39:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5711o0hOAQO9ez8d/kFU2EA4ymM9FLCGueEuox10cG0l6igAGz4Ae9QjJ37MFqdFwGeK52 X-Received: by 2002:a05:6a21:338b:b0:11d:7b78:458e with SMTP id yy11-20020a056a21338b00b0011d7b78458emr2924352pzb.48.1686771597962; Wed, 14 Jun 2023 12:39:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771597; cv=pass; d=google.com; s=arc-20160816; b=lMB5GbDiKFjJ4IRwPcYzU+9XHs221DvVXz+uh2xpGUI94k7PUM7iE7ectGjYTqfp/1 0WZNTyW4mjUgS1I/28R8RNTLKoC/86SLogTXQcB6m3K4haOXB0ueinF9G+Ih0UBoqXf1 JmRUy3KvNlksGXFAuLeRTjaitUlFIzjzZYxi0AsAXljBqrHJxax1cUWh8nEy6SXBpGQ3 xmMsH6u6Z7dP2k0PgFChE9XTSIP6cQ0R3EhQ7sSKTEIkpbEC113yyb5ftNQd1qo8zUA4 2yDo3divJRFAlIbn7jtNMwT67JsYkFFz/NKhVHGCsQni1t/4Ncfz4lCgjv9kER2Mr+PJ DpOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qtVmb2w/gc4SRB2f37IwBcHKtbBBAdft6k4Ina+w9xI=; b=VfOpva8rkYRg97h5m9euDs8dDdJ0N03AvR1lHmmSRXRVqDHnYkz+GCyQtywt7IsQFP HgOcsfCPgHOHUqd5050ArbpqiPp7cyr3fK37WAfbHSgY2jDfUNWbnLPiEnzUmiC4LdwU jqB1IA+drJXgjCl6rd7no6FRwXeXkfGQI/yxqOvChXEbuoc9sexzmNYYCCqut2biFEV1 Qn542bvLvSNnmHxf7i1HEBpJ50aT2yCYJy8kc0qliGjeU+ebdPpzwzDuKF2xGFz1ZkF3 Hfqhx6FFmbuIVIzmEshaPUwH1qWXnAvHUICWHgP+YUy5C5u1ympSCUWhAXhQqAa5EaAs Z9Rg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jqdNZ7lq; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a637707000000b0053490e8df50si11950907pgc.223.2023.06.14.12.39.44; Wed, 14 Jun 2023 12:39:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jqdNZ7lq; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237004AbjFNTg2 (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236818AbjFNTgO (ORCPT ); Wed, 14 Jun 2023 15:36:14 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C618D2; Wed, 14 Jun 2023 12:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljd7h9TyKc4MGOKi3vsPrvrNWEi8vLcvyACGesFmdNTo9/odUbu82WLTYOlQta6ZmwU4ATRYDUU7cfMTQVzpMe0S0NSsELv/FMc15jKfBWM7J95Gwk6g1/sEjmgq7740/Kr8MTYkOcsLGf9T2uRlVTF04ZBV7EjMvovPEv61d2QST/ALy2E413lcXhwI7KvbwWUEuvOmXZokSeM/zSMO9zLSgdvLBIoHd9Cl6SkO3m7CwaSvf0powGIK8K2oHTOqFrSjThLbvrduYgYAU3uoeIcJrFOqpFbcBih1ZtEHXyB6P/4FGeRHoxsv7QkSYtOu0zTtOmQ0OoruKRgNGv6AzQ== 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=g+IjQdct8nxPMeMC69PqczRREceeYgV2u4+TP8nMQCla0ja6emUt9m3NAk0HIYsONnrVpyKhJ/DiAdmrQZ6VfNuQgIPeCFgfWUmJ2BOK/sELuvBBNW5Cjji2yPzIgUP37wUq8K4ROpnN5w78dtcd3ZUWAD8vbU+Rrahl7jGdqKRbmw7jrgAPTcJEJmbnkTWL0eCwDjLlxnSy5iU89AVIlAr5dTVJMhW6ZoSyBxXsvimrYi0m9JOXC6IoGv5omCTxklBopDgSrhFsfbURRIxM5f/8psclAjTSU09v+nd/eZvRckyihfU0Mk95g3yFsALFsDqUb+7X8ghzYUr+Ij8cEQ== 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=jqdNZ7lqx/tTr0HOrHbCCFFUyCEdfoTNxfMBByv7zo6QhmKSLQRE2MuoluHXcMzFadwch1DVK3NZCKIGD/JeX9ecoiD5Ng3wZ2nlBOwSivB7l1OCEYxpolnVr7Nb2qSzwozsXJoyE2mMUmCdqI/lVHPZBbQtkbdBJ5g65J/N8W0= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:11 +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; Wed, 14 Jun 2023 19:36:11 +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 v6 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Wed, 14 Jun 2023 15:35:36 -0400 Message-Id: <20230614193544.2114603-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 75621706-03f8-4398-3e4a-08db6d0e9bac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jzvUBH9GiFmUeUrtR8Tq75WOmQmq5DgngEITGNbyuA/HlP/l7oaGAyNIRuyzBxJYjuBmTvyHUC0hpwYUmgtQxZP8RKEO6SfS0IXgx/aqT9wi8kdQ91eIAsmem8sEM8VT0nk1jZ/dwr2viBH81Ele6LpuEzQB3GWsiRhAFj1vY+j7rtG9FyTSzbF/hsQ6kt8rmfeW/YGgDwvgDLHLR4OHW6aKWwfYgsGgfkUWj1yWh02eT1g/kQbaanXBKYKL9KlE7fGteA53zxM4f2GHz1JWCZOJbWchpXARNDzxoRsQY7rIgONdaQdUo9HX4IV5Xo94+23QNfQ44+G8fxZDn1TsYcVcYLbqm+5EIbH7qoCcJSBwQ6nU05mVg5siL+TLfyxOTLOg3y3jT0+5Un5kR0Dt5QAUCYdRuNeRwiJ4btpax1whgRpXkw6py6g0CXZSeLyhEBAZiR35vbK0co8xaHUXYNSIkoUUhaImTajkuHvPLToPhlVN3wsRus9Agjfo3qB+Ab1FbyPvwK5ax0Il1+uALNw3BaZ3R6v8LjFydUskUrQOVo/NCnjqa7zaA6kvPCcscVUItAIQB7n/cQ14xgIFJWYZt+SPKz3VuksAX/UknGVaeFL/qi79JggW2m8EyKLDV76phRU9+cAuihY5yROwD8N4c9NdpHgQcwhaZO5Vd2w= 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kypQp/otbrD6Hhk2WfrP1EDFr0XDNuFONb1HwTIp7Muv2me5WVaH7hw1a8nMPgorc3ZdSxZkYCqk0aTkeCERGIxzeSLUMYMDlm/M9OnMK5vIK3d9XonF3n6lEHowWmIJhH6K+udzKuooEi3FRrHJiLF8AsXO1FiBS2li8T80X77uYMNauhK7O1aYt1PlTsndw9oNHnzGv3oEssurWU1f35fF3IZ1Z7w1HA0Dh6IlzTPF5rsRzTwxuyCgx24tH2H/vecAkpyhYbD7yq7hL03XP2Ph79VfYbyE2jH74brv3HEU4RCYnzQn8rK0vt9vUMOZSNBWbHl9nu+EmRrr29YYGfGdABMj3uCD4ksSu3zP8AzhNShQE10bBZ/vq2m+1U8pWiJVyD8Dzl2w2jvb6LNG+HLU+bx6+sJlbJ89DDBiyqHObk0iipiDRi+bj4X+GDG8sYuhMqiYm5QmbV6xgK/EeEFAX6wxzsBHxsB6eukFAFTU0Gz6tjHKQCYyr02d/91940kTiHqGwDVuGBGRifroML0uHcHJ5V5jUg1KUb/cioLh7D9zZEHPzNLStfcLAzcdElWPaC85uKYrn55C2nPG8fa0pVOnlI4YZiFjuoyWNRaJrU0OXThCMV+y+uJmvvMFZr1ZNT51qqxK635BTRlFulAt3KLJvhJxRqVG4bW9Q09GcVq56Xu+wDruu+0Sp+VgR8wMAoJt6IEduZqcTq7k1soLkW/7M28UuNSLV5Y9Rg1cdPoX3o/mTig5QJSKDCFN8puRcLXWV9ueYCgZoyAjBDE5hmqh+OAo5Slto0hx473X2Vdu3lPwajJaNRJ2zrVROzM97BGgeYWGn73tqI39fiy0bKfnG52CPPTu/I4aRtscrh4X9QTC0Svpx1GtcOjF/Rqyr+oCxu+sXnB0S5tltS4kKLFj/0ip2dJjT+dMARBQH7g8GUJS5+8gveRXgYAjis4EbHzUT7/a/8B1dYunO+0/TkN3wRvZCzj+d6/2lWS/g2M6bf+OVzCohOVv4c4U6PyBqdwqCCR5xnMdVuUBLlvYI0Dt42pG3Tp0dlf1L/epTFkr4JeUBuuYoeeR/mGl/zdnZeDUxsxZ8ThdiMvhtC4fYBiASXaAkPbtRfzjIuR4JuzkosFGe1V/KsLGfwXqWkQlfxx8ELCISyafLVQvo27B+H2jIVoS6PaqXXfZJCXkUX2YiDeOy9jQSSlp9eIh5dMfJVliIcyJ/J3gXO1TIPLCQXRIPh2Swua+XMXjcP5YYJodS2V6KQcAbBdiK5XGwUWz69+K2mWhJnxXKx/NoHLDwjD1Xv9cNp9ufuxzdqcc+Op1eTiBlrQhLkmX2M++1syGjHaPX8rST82UikxSQo4o5FqrJAeb9KpDlQ+/W/mQt+jMuFy2ioAieF/uMjoiIDlxtDl0oquhEysMEjc9G99S9SXKEseL1a7DyEdL6lXPxHu6PXpPxw5Pued3Peel3X3GwlAuRTd2GvFcemoC1VtsgxQWgvqXhIOM87d7LZ8AWzkz1IMZCmGcEDXO0liXbEYh1R35NVvR3IaENy5aaKK0XnzdWNc70AiD/SiM+PAj+OvpcRXp8Zt3M1MxY565 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75621706-03f8-4398-3e4a-08db6d0e9bac X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:11.3204 (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: FBAaRiaOWhJJ+/FCi36Q7//gNJQew4U3RxHAvRSOrwOle1rLPRwv+w3iIpVe6/mQ9S1EF2zC7ows4BGNbtcPLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708215125508467?= X-GMAIL-MSGID: =?utf-8?q?1768708215125508467?= 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 Wed Jun 14 19:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp187386vqr; Wed, 14 Jun 2023 12:46:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5noB1Pim/yoRRXLfYasWlYq+gvoQwgZlRpZzDQVYvjPxI1+O89NIcPF/SVWDIf1puwMYAf X-Received: by 2002:a17:906:ee87:b0:961:a67:296 with SMTP id wt7-20020a170906ee8700b009610a670296mr14976740ejb.11.1686771967806; Wed, 14 Jun 2023 12:46:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771967; cv=pass; d=google.com; s=arc-20160816; b=0vYJMJuVcJphmaPhki5myqKCv6u5MrbUejkVdamCxdi69KTGz9FI8AM4cs088jX9Ot VC0UrU2n+h1sDPCwHlIXcsdLsJe7qDRt+JDNvx7/H9xJE9kFxaEdibM+BiywKuR0R9jr kygz7imhRWbafR438MCj9mwfxROcOORkZKCDh95lipQL4jJlTjsRJSWPTplYcVKMlyk8 9Ty+APxPR3qVWPLjbZcLbJUbMVwNCPCmXAwZChVlsVLOqNKcSJ0buzLU2YkAvcNrLD1m Po33Ys5Chz2AJCtN9YOumu2H/2LThhKJMKqpDO9Z7XpYjYB5U/P4Mnvzn5E9x5RgCTeE ELAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=i8SowlELrPWxkRr9/us8d8rvbeSkIi6e/pnhOSy9jcs=; b=hGzQ5o1AAQEnpxvZI5j5kOzdiZ9FInBH00Zsilt97sJyFX0frUMuGNPgdCgvQUg7/R j0f5N86Lizt6vz/M5uJKnTLnGwOSMXPt2WuPVCM/ruDz6/Q8dcpZ5CWrAEL/udvbF2UP xQXxK3/wd4rclz6FwjIsIfVgk66s6VsLXbk/2jOzQK3JjTuGL+Zpy8BFAjyx0YhhrZhz scstYritcNanJpCYTYy6I4RX2pLsjdZuyJ2BTxwRm+OBKhBlOMXQyafrEMad78LwlqoL EYD9sJCqRmfyONP9X24RIDw3wauBDofTc6mfRMB58FBI2VKFynGT1XhtfUi7IEtizXTt 4eXg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=H7IYtTXf; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709064ec500b00977d468082bsi8224911ejv.40.2023.06.14.12.45.42; Wed, 14 Jun 2023 12:46:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=H7IYtTXf; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236991AbjFNTgb (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236878AbjFNTgS (ORCPT ); Wed, 14 Jun 2023 15:36:18 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2070.outbound.protection.outlook.com [40.107.7.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0DE81FDD; Wed, 14 Jun 2023 12:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQPV9oqltE35/ilhyakcMOEKdDrB6KnZcSPRctxj0g2WgBGDfmozxedhL4H7IxB9k86pBcW+kP+OHNDhXvfqs5nM/vkzf6GiuNbtSvj0cNd5WyOiUHQdgQU919UMw/NouO++ErLXJJrpUuuXB6Ce/RL6Z2NI+aKOI6XQe1fyJ3QDhV5geDdl7vz+3TpauGx0lFzCC82xkIs8H75FweizxRQA89jkBGNnqKfgI3Kr/o2jbG08m9OKR+KyI1BiM3UeM6Tx+zpdukD/7aqU+vDYXIXVO9FUwhLnoKOf6/hvj0t8DINLBLIPl/ll2RgzB20xDsKS72wb3DWIx4DK9JfvIg== 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=i8SowlELrPWxkRr9/us8d8rvbeSkIi6e/pnhOSy9jcs=; b=D0O/Munoxd253jruCLehf5/Ts+k+oSVe/LpBAhoJk7eZyhPZY7DceowBssUvBRSZNYAfGGWTeLrQH75sSDPdOJZqUGwcTnVjhHs38fvp6D+VUr6PQJ7WahLJtoAbxGuIZHwZnRb+Kk/7Kz+3J5R6JPx8hCEXo/RxetvdtUBtYX3nr0ACJ7fZE9NTP6MPEY6VZjehxCHrbsD0WAKKaeQhR1eG7dcutmF+NS08Y/K37PdfpisFEaV7Mhd7UXh47PS7pfnudjNP/EPkOe3of13Sef3XVUVxuwyRfUdUqJX8XUaObM1Ph0445IBDsCKD9+6bFtqO4QcJgGfzyY9cNxYFOQ== 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=i8SowlELrPWxkRr9/us8d8rvbeSkIi6e/pnhOSy9jcs=; b=H7IYtTXfD3F0w6urTPAPsNtjB0/5Nl6QJH6siOQ0hefdCp0aooWaUyI3QZj40ErZI+GQmbm/Vie7kJ8LAyM1CkEXsRJfnDdWHi44HNaFYfsN5udxU3sVWkBdts1uHT013XI3DRNmB/VmEbU4SgK6njQXZjICtCvI/UcGzr+yS0Q= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:14 +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; Wed, 14 Jun 2023 19:36:14 +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 v6 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Date: Wed, 14 Jun 2023 15:35:37 -0400 Message-Id: <20230614193544.2114603-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: da80c79b-6e20-46be-d491-08db6d0e9d4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1qrIP/rAMkvm1z23mGFmozhaWxefg4PntD1C729ctt100gfUoRC+6XtDeYw12v8J7oeRSJrElijg5HLCio51KKcPdAfdCUUTdpPpCzuAP2jvsTQMp8XgfGBeSkH8iZoEc9oHFqtKV/9YDvT6wUYHKM0VO9o4ggj1vikM7HFy3bAt0lDx6SQyTA6qkYjethWhegsF3MN7wvafflXcLvA7fwaumH+lNs/2Pa6XZhRUg7hPnSXe6Z9IKObPoGtObgDmE3iZ8Ptf22m1GhAe7cZqMwnrip4dnqW6VG/ijnfKLGsk2DM9hvwY3k86tx5p1Iizczw94BT1sWAzP6noZ17Q56Z4k0Kc46fVsI6iwzg5tvxMYkFnKRUt5FouVrAC6ip6jKbDimzh4LCqQllqiMM7rDvW4wz9PC7M37rPIGfSfXN6mEmc4dMnqdi4IZQg4YbiPVYyYxmoGx9pUlZyfunza+pU+3Pd59DnKEG6v8nPN9DdZ5JYi1M0h11iwWZjYpwr6DBGfxyvYu0YhGd9mWae7hhcJK7YB15+IHbJSncR566WOK1JlQxTX7SDiLpoAkzeusTIit0ca24hoLwXwGz5+FyOqf4ZEtJaw8UBbuMxbNHoKFfXypInCBecbtbs+Ebo6TQ7J7KNFFHH2a51BuS2pg== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kkBnySmCJkFrETHF0mlo3UXc3q6Wmdt6iooJaaCPLHej39U+ZEHx8e1BDJRwoFP4bt4KCgx+vrkpuFKy24XLBL8pd4ICy7y0Ccy9FIrKinFdsJCEtK5vEBjiNKVi81gUy7WP9bk/1HQXSR165L68aKjHaF067I5nBWJW19we+A6eAs7wi05mVBEbkUI1w7yAIxjG2rAymLm57MDpMZzV9apPQTr2m93EIh/MIZ+s0CNDwhLem5nyQ61ANneLX1SSGok2UyZfyBrBnopilKAyTmnrxluxCb0GWgo0lMqDYuIKe6NZ08YOa5rsgJLaRpMcBy+tdeX8rg9UJYD0uPzFu3vBlt9dvSoLCYAuN95N+htSfPRqk02VpwtWYmszykrTVgS6oXsBaf5bITLTXZ3ufBpSQfZVCoR0u3xubDdJE3FrE9lS9IVu/rYbaSgSMpy/D4vYo+ZvpOg4HaIGO0+uObCQJf+uAUvk/XpCq2RS4PPwvLUAmFJFFvOrnvUkw/oms5KYpo9GrpYbzt05OqyI87ux4eAwD8LYyb1PxyKwVZOvHYMRYqkXcx9ZH31Jw9i/wd3b3UF7UrtJXoVhcfkbAvqnhO5UKzcpynqTiaLyaIcHsps2TVbHB4W7p1b3yO7YtpV5HipdNe/oblPcRq1ppxCTnFFYhgKxKrJkEaVFUOMayasBbPEgoRx/YEtj5KJ3rptSdHBOgl0SvnqRi8RhJICYjrNZQ0TdiWhTh/WKWDGCCfTWwZrQvK5w5j1YXMmbNoCWk3yuxXc72YU8Wgx9SIXCu62f7SCqGSMn67yRo5mqGcEpdjnFCaMDW8POM6cEQ1LWMYSGiUs+yRPzHZQstXsxTb/69ID81KN7j/pbWFNUiGo+Bbomw++pcP70gG98yVVg+eiGc7zpCj/XWSdsCloLX4Ow6wOJdjN9GchlBKWkIkf22Bntp0yCxczTOKQOx2TclOCwqB+WkmA/uTYJxtfyzVdG2GTzNoFMGtE5WTZN0HE/xGBWJqFoqmJB3DK9T/V6kdTpnPfEHsSN//fdSQQ6v1tNVzA7RoAm6IbK3tM+4UwQ9W2QlCNHuGJh3ieGpb1453woOvb3Vx8CZm4LOzsrddLcCOO3FizeOz6nDW1mgZi2cDHcrSLjNY2sI58A6zpFoBp6q9L5+il09eeHq8dG+yn0Qicf6NyzBJ6SBz0RyuE+re0JMtrMF2mvv6vh91DBf5fC9XYbeCOQUpiAUb/01BkgqpSWfMZUIEU8C7XQZ/yXQ8uWjSudr9GioxK50cQSuVzrpu60zwPRoOEyY+4Qx/iuEAr02AM2ByBLH3pWEmOGQYtC1HUFLFXK9V0Qsh0ohX06axaa4ynYj14D/lxtRFCvnyAsFyKAfZZwwzNH+i5y+2TR8gIvv+JrD70N9O3y5+IVhNAu96wwpSSasLU85oBiC5oxgrwdswxOEIIaHENjrD9TFcL6tqNUBPICV2c8cWT2Jx4l5jBa1lMYFY/f2W9djMbLhN1a7xKYm+gfaJFjeVoAzUqDj6FRlLBsF8DGR2Si3HDsqZ6ksxwswr/VVsSAJph94Aue/zQ3yX0ryVLoQHcrwYalEVlDeaXD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: da80c79b-6e20-46be-d491-08db6d0e9d4f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:14.0716 (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: YegwUdivQw+495KeiE0rmJESW5kEYN7aDmlDR1rO0A13cZ8cESi1h6+7E1wfw3KjFULp8ZygOiOYwRT2j6numw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708602663998906?= X-GMAIL-MSGID: =?utf-8?q?1768708602663998906?= Move the common part of IRQ handler from fsl-edma-main.c and mcf-edma-main.c to fsl-edma-common.c. This eliminates redundant code, as the both files contains mostly identical code. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 26 ++++++++++++++++++++++++++ drivers/dma/fsl-edma-common.h | 7 +++++++ drivers/dma/fsl-edma-main.c | 30 ++---------------------------- drivers/dma/mcf-edma-main.c | 30 ++---------------------------- 4 files changed, 37 insertions(+), 56 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 9948babcadf6..a9d17cf142fc 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -42,6 +42,32 @@ #define EDMA_TCD 0x1000 +void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) +{ + spin_lock(&fsl_chan->vchan.lock); + + if (!fsl_chan->edesc) { + /* terminate_all called before */ + spin_unlock(&fsl_chan->vchan.lock); + return; + } + + if (!fsl_chan->edesc->iscyclic) { + list_del(&fsl_chan->edesc->vdesc.node); + vchan_cookie_complete(&fsl_chan->edesc->vdesc); + fsl_chan->edesc = NULL; + fsl_chan->status = DMA_COMPLETE; + fsl_chan->idle = true; + } else { + vchan_cyclic_callback(&fsl_chan->edesc->vdesc); + } + + if (!fsl_chan->edesc) + fsl_edma_xfer_desc(fsl_chan); + + spin_unlock(&fsl_chan->vchan.lock); +} + static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 5f3fcb991b5e..242ab7df8993 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -219,6 +219,13 @@ static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) return container_of(vd, struct fsl_edma_desc, vdesc); } +static inline void fsl_edma_err_chan_handler(struct fsl_edma_chan *fsl_chan) +{ + fsl_chan->status = DMA_ERROR; + fsl_chan->idle = true; +} + +void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan); void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan); void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, unsigned int slot, bool enable); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 47bfef1c562c..a0e54ca4893c 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -33,7 +33,6 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) struct fsl_edma_engine *fsl_edma = dev_id; unsigned int intr, ch; struct edma_regs *regs = &fsl_edma->regs; - struct fsl_edma_chan *fsl_chan; intr = edma_readl(fsl_edma, regs->intl); if (!intr) @@ -42,31 +41,7 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) for (ch = 0; ch < fsl_edma->n_chans; ch++) { if (intr & (0x1 << ch)) { edma_writeb(fsl_edma, EDMA_CINT_CINT(ch), regs->cint); - - fsl_chan = &fsl_edma->chans[ch]; - - spin_lock(&fsl_chan->vchan.lock); - - if (!fsl_chan->edesc) { - /* terminate_all called before */ - spin_unlock(&fsl_chan->vchan.lock); - continue; - } - - if (!fsl_chan->edesc->iscyclic) { - list_del(&fsl_chan->edesc->vdesc.node); - vchan_cookie_complete(&fsl_chan->edesc->vdesc); - fsl_chan->edesc = NULL; - fsl_chan->status = DMA_COMPLETE; - fsl_chan->idle = true; - } else { - vchan_cyclic_callback(&fsl_chan->edesc->vdesc); - } - - if (!fsl_chan->edesc) - fsl_edma_xfer_desc(fsl_chan); - - spin_unlock(&fsl_chan->vchan.lock); + fsl_edma_tx_chan_handler(&fsl_edma->chans[ch]); } } return IRQ_HANDLED; @@ -86,8 +61,7 @@ static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) if (err & (0x1 << ch)) { fsl_edma_disable_request(&fsl_edma->chans[ch]); edma_writeb(fsl_edma, EDMA_CERR_CERR(ch), regs->cerr); - fsl_edma->chans[ch].status = DMA_ERROR; - fsl_edma->chans[ch].idle = true; + fsl_edma_err_chan_handler(&fsl_edma->chans[ch]); } } return IRQ_HANDLED; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index 7b05e303ba51..316e637b00c4 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -19,7 +19,6 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id) struct fsl_edma_engine *mcf_edma = dev_id; struct edma_regs *regs = &mcf_edma->regs; unsigned int ch; - struct fsl_edma_chan *mcf_chan; u64 intmap; intmap = ioread32(regs->inth); @@ -31,31 +30,7 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id) for (ch = 0; ch < mcf_edma->n_chans; ch++) { if (intmap & BIT(ch)) { iowrite8(EDMA_MASK_CH(ch), regs->cint); - - mcf_chan = &mcf_edma->chans[ch]; - - spin_lock(&mcf_chan->vchan.lock); - - if (!mcf_chan->edesc) { - /* terminate_all called before */ - spin_unlock(&mcf_chan->vchan.lock); - continue; - } - - if (!mcf_chan->edesc->iscyclic) { - list_del(&mcf_chan->edesc->vdesc.node); - vchan_cookie_complete(&mcf_chan->edesc->vdesc); - mcf_chan->edesc = NULL; - mcf_chan->status = DMA_COMPLETE; - mcf_chan->idle = true; - } else { - vchan_cyclic_callback(&mcf_chan->edesc->vdesc); - } - - if (!mcf_chan->edesc) - fsl_edma_xfer_desc(mcf_chan); - - spin_unlock(&mcf_chan->vchan.lock); + fsl_edma_tx_chan_handler(&mcf_edma->chans[ch]); } } @@ -76,8 +51,7 @@ static irqreturn_t mcf_edma_err_handler(int irq, void *dev_id) if (err & BIT(ch)) { fsl_edma_disable_request(&mcf_edma->chans[ch]); iowrite8(EDMA_CERR_CERR(ch), regs->cerr); - mcf_edma->chans[ch].status = DMA_ERROR; - mcf_edma->chans[ch].idle = true; + fsl_edma_err_chan_handler(&mcf_edma->chans[ch]); } } From patchwork Wed Jun 14 19:35:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp187329vqr; Wed, 14 Jun 2023 12:46:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6whG+G/funn8f5/UTfC/zIKJdbhuB5f1uSKTb+L3uabF1Wixs7NpTHzSmTtBJAGQ2E7hJY X-Received: by 2002:a17:907:3605:b0:974:c1c:820b with SMTP id bk5-20020a170907360500b009740c1c820bmr15264229ejc.51.1686771960790; Wed, 14 Jun 2023 12:46:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771960; cv=pass; d=google.com; s=arc-20160816; b=iGD8SJKzvATtoX93qGa0Um08Mm/Z8R/8J4h3I7gg2FrFeZ/ujJ5pNJ/RToEsyq6+ZL f5rjZ7Dh5cjGYxWfC2sozTMvJ4DwB15+3AHuVQ23mIzeAOjXequ+9zdUQRvnDmGaAol0 NNDzZ1+BNVIVy/B7ZRWDwz9XDQiuzAyfOCm3KrXgliJYdhkMMDBUu/w9YAbz++R7sSHf fV6ETWO6TI4YlLmdk5pjFgi6tBDEGMWZ4/o/4evH8MlwuV3WdPM2Hv+OcuI2uPdnphzE wGWETphOBJuHHC6gw8nzS6ShbThHP1StL/0wMabhPWnJewDnzUuJcSM/Xptr4HJPFSxG zeXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=s1+6nOaISVZ89Qy4+Cr3cnXLzqMpnDganBMJUwxpjWY=; b=gl9e+cV2wJVQGyPp6QUS1xYU7VN0nmf1bxrkgQOeCFq352lWfmk0FgT/4VFBPBL6W5 H1la9AKXpip6REYQsPlocctwREjx5cBaCRzOPSZ+VgsMXxY0Ao1Ru0ISuQNYu+CpNaxj tat+XZinZNDTvulU4wNYURZJCZEtBdxmTo8xumcSqhNvevOrwEUtvMrD9KPresHoQMGF poMx+kB7TC3bBCK9RkV/Ksa7RKjgZRddapdFYcLOBkC/gybcf2+thgNDPO7Hcza15nrb MfRH0zfWoO0tE/PMCqgSy9z3CMlhTmQGSnwWbgx+z8iVXErhXMiSeh2IRfpTHCV3L37b WpEA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pGDkFqSg; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id la14-20020a170906ad8e00b009788da05d2asi8754499ejb.757.2023.06.14.12.45.34; Wed, 14 Jun 2023 12:46:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pGDkFqSg; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237103AbjFNTgg (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236910AbjFNTgU (ORCPT ); Wed, 14 Jun 2023 15:36:20 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2070.outbound.protection.outlook.com [40.107.7.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA50D2; Wed, 14 Jun 2023 12:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCwJXxAmtEFRTjulR4ALX60BXbPn5zkobwtoB7SBuD0xGISOP1UoD8v7Yd+0zEvyA7Z4KQJR4XOzffe7so4wFm3fWzicur/LiZ6Ao5xCuYMtDs9UDVspZ5A2jONd1qI22sg2mmxMj1yS0qVAbkEx6rWNS2ArPcX1rneAWmWEhTKJ55xBLKqPYHPttAtcxBomdFeVDJpwLHUuqBw6UAx2578lErxyQzDxar1cpMnqIKcLIOz+4MAr/Mfukl7xypVVUdoVxuhcsl5QCdxRF1m/ku0wy1HhotVWi/iG8RhJxPFiRfoqgG9tmkib3SuyYmGgHuv3TaHCbuHVsVScHEvE8w== 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=D3IqcsiCZSgMcSKip2MS9g4ytk4pTQ0lt6bAGCjpUKyzq0qgVT4NubKCGyrYfrQSe8a97J480z4VoZlFFifuEVE58Gx8HkLN2Lh2IlvWqcqTt/cIUeymLkXyUoaV6n1FhRAUjPRbFkj2obC5r/IbTn5xbxAsi2I5f9hySuXWRDQyNcz3LnmDNSQ6RqzCK84splE6jmTMMJQPZm4KFRSmMUWu7U4KmjowMDHE32I0ew30I/nkDim8vSB2mQWECNBeaCQVnqntamtLRGhCRuu2Ku8VzFFPunPlYkb6+wPLT/RiSBtkcqJZhTtefHrGWQT/zS7qlYhK90gBcM1zgex4VQ== 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=pGDkFqSghpXxBrhAnSrGnoVND1zuNUrgUlfvgr7WW7BVAeivADUH6HOaYz51uEy0fSTKzwBuNuSzfk4PuWbhBarLxgRbd4eDSz1cWWETVmfgtNzIdIuOlrQiYLhBSjPCUYU3PhJpv8wJmf+E3dJqWPK398y7rHVL0Mgr869LYg0= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:16 +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; Wed, 14 Jun 2023 19:36:16 +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 v6 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Wed, 14 Jun 2023 15:35:38 -0400 Message-Id: <20230614193544.2114603-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: aa6aa5e5-1e8a-432b-6ade-08db6d0e9ef3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UWIaiRItB4t1Rs2YaeFZdo8YVisMsEFLN9Iq5N32cvIjZfpAQJtwvhc+WLEYH4MQq07c6dQh53S/hlvHXdoPMgZb/9DtILwJzQjpeBAWSb7rcvM2LV9ztT/LR82YJ0WsAdLsLKkKkKhz3hOvRwXd6lF7KqPuSbom2V2duOP53okXXrdwj6HUk1sFViX6UNmNqb0EjwHY5TtScnurygpIcwKJMSihvY/unl3wsjEC1Qq0q2CyPvZTRpDuqxItSIicmdUP7ypccPG61PgfswXRHd0vPr/43fKDDq2xWtp8dyYDhwGfWFCAUM/qiFo8veX6ftyG3P623ZTPOWg/kbVzuJQ0qGGV8K0cfFJr3+jCKWEbAZChbebQ2OdB8uCF9OXLPnHssxz8ERTcr9DX5JXvyOmv7J+g5sMaYzRAcQsa9FZczjYGmonv1zpHm3VjtZKgOIR9Fd7ZL3xWBuA8QtqdIqGwnCkK6FH0Yrzm+H8ZGLfR2hv0XJjxVInJYfJw6ageBOCCJJj4dfqFv3U+x9TIjkpZj8oLrb+0NyZsVCmxXBBu5Eyle607DvldrtpUZb2cSCQow8pN3Aw1cMMDe/KT0QBQWuVtA4xZzRCQAw9e2JYiA2QavoZ7O8RWXb6cI+9H 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZFbT+gIuj70NwhTQ16xPD+StqXImKcwMpvzEIcvvUcp/Z9PPpPY67x3oIWZAOxOdM7v4Nkf0MOtYjGE71CL9nJzXlgs4lbQdRoJ33iA51VFsg64ugrpjfstMxFB08G0jeLRscm0SggL/cz/qQhGA4ywea/0uBwH3bJeXjC8ADNYcV5ZZP57IHjqNBmWhhaj2O0PpIbMeffrHYYMVF8sZfZ/DDcW3l7Tk/Rk77i2UM1Udz+UmDfumj3UQEOQFLyF9CMg/Zc+m66O78VKbe3OTVX/y9+c4T2oFxXKGOTbEndf2pegX0LIyncYJtpS4w+96nZUtEyTk/jTiB0vDGfJLYRSpfjgRx2bIgODCTi4INYZl6/QWzFXX+MEztupX6c07ec+SWhixXQUgOYH+n+UdnrqUbfduOh3QDXlhJT66IEIUbPhjIp4/WY/zSg4tCA/F9g6/qqR8Kymh7sYTkN2RlvUwjtHaKxzxRO9Q5N5g9q/VR811j5cRdYkbsSQS1FCWB18XMyERbvey2qcly7EDKVbjaOOMiT/5WaofgntdM7CVs0XCwWHFf1ZNZhN4sEHqBr8JtkZACNqXRGriNy7A5RQgrI/XS1Av7QBthsjRemHoFEBWz7GHchz7Tp8Bpx2rNzgD6Ep02uOTNAnSAjaq+a4MUHiTyWjyZ/nL45R/geBVhm6pDsznKR/wrxwnLLR5bLeAPNHlrUeVWCQCFedBOi16fML0FQ/Lm4MDyNzToaVGSDfAsg9eHB3GEDUe2G40CzKcsPmIkP5wQg9nsTuHVTg6OUtIWUZQJ4If2EKAG+N4avWjhm9eEgjeEEH0AAJ0r1UTcEilkV8aHJvjT20C5VBgylo4KHGtQmOquYmPe7JnAY6n3r1LqAvYcBcGG1MC7tYczR67EoYFjXRDduaN0w9ey2msBudNIgMHe+rbW2SPvarf6q+K9fCzESimd1B9eH5CqEGKQ7cVMQAp8B809rWDoOtd72ahopWqVZpUFLCKExIZpgkwODMysPHLoloTz86f+QPD0GOhoga6iOOV7cLTYQsFuz9zqXflF9kxe0d+xRnfpexIZ+BZqRX1vc/UHicN+kHvnz417vof1qZPgV+awvgm3rAvJg9CmKITT+b7SgJ8cmYfL23q07jrjTnW/u5rOisoOmx1amM5myS8v7TyE9QHdnXMsO95ZUa7AYQUD9U4kC7alKD+BujFmuJE2osl64lZt4rqkJtC4bt5PLdlJwnLH2vfVLppON2N52j4QX/8g/WQE0GqpPDeG93T5DDERyyOqOHu45Mu38hFI8IUVTmjARy2YHnYD/r+oLxAh4e9TW5IsbD7KEcPHbwT0na96qy0C8Fnx5WobseDyPlzfwOMQOxbTaFw5Xv9Ou2dZ2KqBlFg1pTPa5OPFEaf1ASomRNaQVHSJnLEdJ76pkvNKI9yFZDriIfPHjAiVXWBvKGjWhO8BkSclraSZ3uhNbHJgpAowzeUwJ0LWNZpdFSyvCtFLbgwyZzN3ky1744UaP4QbDYP98NctMPPWfva2KgnHC9UAIjD/LX7R9gYJj9U4GmvePoBntJzx1cM7F7G3Br6YXBVIwTxnKP9ZvLe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa6aa5e5-1e8a-432b-6ade-08db6d0e9ef3 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:16.8022 (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: DCKhme10JDSz1MRZuCp2o9VehBwbet4KZ2YtCBdRefZKNNyJG+1RTJ1UTLTTDkVmjacexk4ojcGPz0XsnZY31Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708595304579767?= X-GMAIL-MSGID: =?utf-8?q?1768708595304579767?= 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 Wed Jun 14 19:35: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: 108131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184633vqr; Wed, 14 Jun 2023 12:40:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sSC2LKMwVdgIO1kLw+mrrxHcF+XnzbSnxpPGaJSLh8vaCDa0gz4cd/Uxpj8349lVk+mVQ X-Received: by 2002:a05:6a00:24d6:b0:665:d717:6eba with SMTP id d22-20020a056a0024d600b00665d7176ebamr2880053pfv.16.1686771620189; Wed, 14 Jun 2023 12:40:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771620; cv=pass; d=google.com; s=arc-20160816; b=I8Yj58Rw29lZ7V8Gy1sYmeYO4ZVmKNebM9tLA7YMGVmD7nkSpre4RbutTBJQP5oa4h HcunHOKYq+wuRQta4xSoAlcX58kYcbCtoAbio/6ttvQMEWBGHHTisC4SKL+XmmlWfJ1o HDXtRhQDHaSLjM8Xy6wkkU3HabAXsV05Uc0mo6DNx+vE94T7VPB/3n4MkDYlsL31K80k Fc3guGtIoHRESD4PvQ7/6ANy2zsYMUF8M38aT42HG1/plfDLUQE1q0PacWy0nli22ijs 304kkjRtnaIIYBxHJUP3B9KliG1q3VjKzlM+XvEJzkZGCa2xpIPVjMmex5BOd5lxTS1V cssQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EWGw4Zf+HBff2ktpvDNTKgNM3Qy6tvNMDZ1fjELGovU=; b=qNFbLFctdY9gYF/EwbTrA9He9Q3JVTlmvILeq8UtR8vGNmgZvcfmaVZNY9hZ4RhCWA URjUZwMXIgcaQqR3J6uh12KTxSOXqcq7NfhSOIx/+g+FyLUQStFPBtyKCKCENzrHgdvZ UfQX1Z9jWAj+N6W5uhQ2E0UO8dlJ2b5CQDthkp9+osaHqGJ/Y3NMfh6ki9RjO4H2brqj F9VkCL714PdnFhRzbVKedHm3l6QbwAPIELTZOQSOez/gIUTdAk8lEM9k8zvcVh9PO5/K +1WZYYsNrvNyGWG/aDsaTShZI0vvqXW4LzOLEXFLneMiPVUhp9ZBUU+PiK9+JWVjX/Ic ZOHQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gk7YdFom; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a639609000000b00543a6b7642esi11511150pge.818.2023.06.14.12.40.07; Wed, 14 Jun 2023 12:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gk7YdFom; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237536AbjFNTgj (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236958AbjFNTg2 (ORCPT ); Wed, 14 Jun 2023 15:36:28 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214EE1FD5; Wed, 14 Jun 2023 12:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auK6Y7AZHSIIZ6Eum41vu4kxhyQbZ97TbkrEptKttnmnmbfmhFfbvPpoqZCx19bGCG3jZNPcnCE3DIg0YwIfZ9cebSz0wYl5YM1PEb0Vs6VeZQJlyDPfIEpNMqXARRplGJigTEcSpTPBGoRHW2KVzbXICGCJAX72/qdB7dIYk8hWdwM2WUoM4/lIFgVo6wm3ozau+GTF6C7ynU3B8N9RzhHfnVviTdZv83RpDNV7ZJtq37GmmI11bFuF0w3BImsgmj2bW2mxuAi8tqO9Vyo4N5FieFQbVDG4MsCkWGVkm11ru71jGe5T587D2tr3chNomGHsaDjZnX6l5MUXKDo/Bg== 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=EWGw4Zf+HBff2ktpvDNTKgNM3Qy6tvNMDZ1fjELGovU=; b=kiu7BSDx3OMBMVbqZz0OPNv6o/Dfz6aTkCGRp/KaUXNt/oiJ5kGPD34800WbWDu852vaponBpQKHPfGUOCytznfSKy6GCyuJoeRrfRwylalC+mn5LbB5uskoYjPrz93nBcz5ocQbc56rHC4bJJvkl9M5q/RS5Yzi5s1qfDIYi6Z1WQ5bPWT41CmoT0EbyDL8XhjcZ11R/Oyg2UILiCiz8L78TLQPEL72J9i05M+1QwpNqkzwDoTcS1AbtGJtm2FceT8GBWqPozk+TUW57BlmQr9hUq8oS5MTsFViWADyQohXVerB0pk99MsM2t6Cf8XfrcLb8qwRVfMrJh112AKNEw== 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=EWGw4Zf+HBff2ktpvDNTKgNM3Qy6tvNMDZ1fjELGovU=; b=gk7YdFomb6l2NQyrcPSTX2noDYVlt5GrSdBKkth/OPjtiPneN+lerljM7GYAWNgo3iU4WVghsTKUD4x6MLXOaTioyy6alv2JrBEhcIIhipdFEXFKvEHN55tZu1xGiilcOs7CUdQxfzFTxss/d0YJ0AAnNhqG4vgxdMHdA0ViP8o= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:19 +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; Wed, 14 Jun 2023 19:36:19 +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 v6 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Wed, 14 Jun 2023 15:35:39 -0400 Message-Id: <20230614193544.2114603-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 8766523b-2f05-479e-3c7c-08db6d0ea092 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kNHm5iOqTgtycQEGM3xej8PStfqbCnDkWU8GE+GUXcbYzrWncrZKigNshtBTS30C+eKfhnGC10J+M32OhhaoSBB9YRciILXuNJnkA41MOJSZz/NLn9FbGTUu1+SJyahv92FBpgyr5lY0do5c3KBcWHLo40VabAdLem513cKFLJSMQTnYq0CREjIIOPv4su5c2VniksNXY1i2ZX0B4GnpAPVGrCf8gz/+IDdXmv0D2ECefVREL2aMvW/BuOkgO7TWT1qRSgdLKqMGIYbweFm81CdXkVkMxNc78/Jh4U/OpAZ2XZmoiGfLYXvVEBzvg+205Hsz6+6GryFpGEABiKcJdvKuWtG6n2bYGQfyxhNBisDKrHl7ca2Wfy3aOnhgCHIpFEt0Tat06bTixusQoYlTV8WRS8LTIPtwS9Qg4l2RDLOJ3uHeEbviM9vPP2iSSF6XV1XBAA6L1+dSKyfZHumdxn3RQ4Q8h6vdH1fHG2Jn5JzU61Uhw2CfWafqJv7cskRzqaFscyVdW5Hhn62Vcpm7YYpwyJLZ+hvlN8orWpxtQ1tQMCLylZ4md4fLUxr0D5TZc2UcYjmnaaZyj6bThs+6hqLFRdkh3zHBUUESc+52Q8cu/rGeRhInWxdlEpWvNN3k3WnVYj/l+K0Nh7jxK2HmLw== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k3KntrX+eAbKfKCW/tmOdkS2d2Y1sAe1UvQsUVorY713+S5hARcFv+emFAL6CKcphszhdQS1pwcCzsSlkDE9FXMd5t1KjQVaSBZp3wQp6aUGa/kzdhMz3cZH933llKPBJ2Gt2BVQL2R9g8BxCQVU1oydS4W3JE3VSA/5iukOHL4qjYixSeZNeoS4fxrye/igfLocO6oDn0/oejyOYOphk0JXY3Ik0Glv3xWdciiLPHOUPR4XfBLZHPOPROXqLGcFgB2UBggZvrQr+3wyjzWsRGX1tYlsBFVzPt6t969jgPx+eijyMZ1PsGKZ1TxQnMYpWxuqw7HVDOIdmCr4ZKYZr0Wnt3MhIP1xXxVZ0SZVrQwowgJhk3bMk5svIi8VFoLSrpPY7FD2ljNWMB5sG7YIlZVD89Hs4+mW73L3YkKKRQLXkvtDx8EwtF9gHAo9ZYsbj9Fgv+F2N/vvswnME1sOS3qscCPz8z0ltMcF/IzP1H4gAnP8OK/PJ/HXEoztZAgF03gAXHwAxDR54ZS6J3kMmh99iIqsE/9/SVBZ4L1E4Vrn5y4E/xhlYtjqfgJthA42pVKi3+JloURyLY0KAsBT/k/IXm8Gwr3Ti0nsjY+Qz/mh3FF3qZY1C4vkOOrUzVR1UfUGlJo6OyrePuawtZvgbxeSV51Tj8svOf4T0fe1G63vqZXQRcRiPV7wu+b7lhQ7MLMjOgRgYbO5TMKzFIZMOciAliIUX1W71B7vZHzPAmKdl6ILNAMoIB0kcCJhAUvS00k7t8tH0MT1oRc8NyK2wqRt3an500UuTtnqXLK9DevAxMBSr6iYGXD+Gj8gAicnV9kYlw1DmEcuQ8colBTV0uDw/YsbwOH/Z9Z/OxdrmjZDMlFn4v5Ijl0Nb8Hkm5uMTKWponWm4oQNT13dyNEyxIZCkR7iS3dL9xlOchmbPTzCFAW83ZDrIBxypvNbSTD5yzfp0lphmOYuNaz8s7/ZJuyhFtbBCUnNuCja6jS7svstgk3tBYJ4JJtfYt3g7hQjdFmpCnhxR16yn0B0Zog96HY6poKxEpn77b6o10CrU4cdEAq/2lRytnaY/48/WceVFc2bRtlKiRRrqzeMtWp8Ng9UyxeogTXIoJbiDJSzCo3SHbxlGl36FFtwLy9b4ylqPS5h8PhkKDFmoEdrZ314bieFlrUPbN62xgvLTPkpz+li5dVZbPmnUVC2wmMkpc40q2iWqPRyRjmD7V0no1f5tIirkUVrYOinpkZ4kTrZuTTfa01O9bxSQ7f7TgYiKehzttPibokHdgFUEZZem6wWDBUAX4fCkdGNpmP7trzOBjmASiPwqfEeNTc3HKPkvbdjdgBRs0DhRmom9+kKKdDqKy7DqhsaoG23b6aG+VfdjzlKHUo2ScbfnUx/TZt3A3i9+CKRC6jbfaCXuDHlBRJJBDJlRBF118ZDhLhlg+J/k5WBr/FNuQLeVwJwM5DF3trWDkcewga4jdeBiDcB04scy6SIrlBrUvXoVsW4rx1CyM68wVnPm3VO0C0sEbCeFPXmgQHKQiDji+i4UPcfOtBRzRDYBftdgEBmQCCLCwKe/LUA6ifWPsRTnPBLIK09wZd0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8766523b-2f05-479e-3c7c-08db6d0ea092 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:19.5611 (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: /DLWyzxenCa1cVFXMWPHLZHjpjSYPklGHoQSDiCtbTuZJNbjtAXM91/h2/2PSiCAOECUU2psaWLimVnaz7547w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708238397057527?= X-GMAIL-MSGID: =?utf-8?q?1768708238397057527?= Use devm_clk_get_enabled in probe code to reduce error checks, thereby enhancing readability Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index a0e54ca4893c..503e5ad5a8dd 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -266,17 +266,11 @@ static int fsl_edma_probe(struct platform_device *pdev) regs = &fsl_edma->regs; if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { - fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma"); + fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); if (IS_ERR(fsl_edma->dmaclk)) { dev_err(&pdev->dev, "Missing DMA block clock.\n"); return PTR_ERR(fsl_edma->dmaclk); } - - ret = clk_prepare_enable(fsl_edma->dmaclk); - if (ret) { - dev_err(&pdev->dev, "DMA clk block failed.\n"); - return ret; - } } for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { @@ -291,19 +285,12 @@ static int fsl_edma_probe(struct platform_device *pdev) } sprintf(clkname, "dmamux%d", i); - fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname); + fsl_edma->muxclk[i] = devm_clk_get_enabled(&pdev->dev, clkname); if (IS_ERR(fsl_edma->muxclk[i])) { dev_err(&pdev->dev, "Missing DMAMUX block clock.\n"); /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); return PTR_ERR(fsl_edma->muxclk[i]); } - - ret = clk_prepare_enable(fsl_edma->muxclk[i]); - if (ret) - /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); - } fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); @@ -364,7 +351,6 @@ static int fsl_edma_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA engine. (%d)\n", ret); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; } @@ -373,7 +359,6 @@ static int fsl_edma_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); dma_async_device_unregister(&fsl_edma->dma_dev); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; } From patchwork Wed Jun 14 19:35:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184642vqr; Wed, 14 Jun 2023 12:40:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6EJNKlN4CLl7K6NaFuZjJyiP4hAEXj1mUpsi90v7juu2jTA3/8I9iBl+IbW8IpGJ6nBLh9 X-Received: by 2002:a05:6a00:1810:b0:664:8521:678c with SMTP id y16-20020a056a00181000b006648521678cmr3282758pfa.21.1686771620886; Wed, 14 Jun 2023 12:40:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771620; cv=pass; d=google.com; s=arc-20160816; b=0utmVayQQ0IbHMP5GBfuK63/GOJ5qqQPrHY1uyEZADuMHwvrNXXHJskMWgsz8BzZ6Z tguWnWRUPJuw0oGQfQ6bUcKv/eRY8Fc8gDZXzjzveiD/knEOqq3J7tKphTxor3H36sD0 bmGBk7D3wig4iUPzxlBpJWcIgx8yFAHI6+6noZJO0ntFIunyVN4CNDAPnWY26fQOSGsF HYApN85hYYD37NE76sPf/hRczg9WHN4XrfH/qG6KrVbEX857noNa3sC3/b7k01+Xs7By 3t8k0ZgL/RIZ+yzqjEeFh3zfG69woAj23dX+azvYrAbe8uqthMHo4UbVZSa8N4XNZLJT yDhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Q3jlBv0SLDnSXx5LFjozJINPkoX9ob6AsqXt6WuD2a0=; b=au10eVCkQPs1I882ar+YqfZs0DwD71slQJ+f0Kk05AuZH28/XIMLYqWjN+P4/mZMBi A9n/AbsRVr3kFyyLY7fbSeF5yEddsoavXmtZbwqeyHmqSANjJul47m0a75575pmflgGH ChOTZx9qlWv/D9HVU+As1AsZqHa+LSqQDKp8X5lneAk8H1tFj485qyXVkIXaXrib1eic TZj7/xKHWcmpOaaZezP+nBn2JXsxgRSZICuDJ4cBRPnfuAi+w/tQ98tVbQz0tg1wyPxx 7sLSt2IiPXrRRoDZ0a8PbXFq/20RGzUhbh4fNk99ZEq4DvZSaIoWlDTJSgMvP+Vu7m/C xekA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Kkgb3NYt; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a633752000000b0054fe464553dsi799996pgn.761.2023.06.14.12.40.07; Wed, 14 Jun 2023 12:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Kkgb3NYt; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237892AbjFNTgm (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235944AbjFNTg3 (ORCPT ); Wed, 14 Jun 2023 15:36:29 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2057.outbound.protection.outlook.com [40.107.7.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57FD82695; Wed, 14 Jun 2023 12:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtUVp15rj8FSRkiK+aqlE2j7f3xWU/rXyrh4WVxZQi/u9QR0g27d/T+m9M6MUwa/MFMaP2ECeqjL3Yr37Cck1BPXEH1s8CVsi7c41HEiZG1PyQrZG1NR/pNuzT5Z9yMrmGxA19k6WQB1edmokLuqIX3V5UjBzjPe2xpwPvl5OmrtG472yJc9biMQXxI8RkfVWYkSek6a7aMAbFKgLncbB3yWeZ4z7tU6r3yzeZVS33O2A7LSR/vRAWK3xpxzBqkIyBVHdCoJMqhUetw455vQpoXFeR8Fu8m3HpKfj8+3MR+AqYOHWedF5yJegKSqGNtnX89od2HFWtF3bVyzGiyDPQ== 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=i5ZtiOTvyxnOwpdNFDtQXEbRaXLOlhkUneT2/EEbRW7Kf5KYY8BKjmjdvZQEgVgK51R/rwJulnpGMsum2NUM4Pn2OrOq1f5cvhOr52FBjpU30rhqf5Ec4p/4xkcpR7xUYjuOuQvxZ8rAeo1ZMM9vQkMLDVXD6iyBbAEG64C3a/9SiI//1xPaRwlT8LqqqtT1Jj6/E6ukVtdKG5MJ/B8EbjjWQWkRJxTTO55D5aQGHjFogDeUCIvCFJ9ioW4pTfm1P0woYJir4P3QUWKLLMYorA9iTmkL0vhR9lh6ISP3yURyJc5WchJ9D1CKcKZ25XAeydX3mqz2wAVZw0SO0E53eA== 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=Kkgb3NYtwT67OGHKSqka0W6mHBjaA3pRntRW4a/3kCLBLa9FFxDnhVPebYh0hxGqZ5QTxcO0V2N42klOCCIcBsgufYlwvME5cKf7TtjNINZuMhG4YBwBw7qZ9456i/o3bBkAajwOvRnJiuqv5nyIF8NLY2iBiTDo4VBh3TKzIpk= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:22 +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; Wed, 14 Jun 2023 19:36:22 +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 v6 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Date: Wed, 14 Jun 2023 15:35:40 -0400 Message-Id: <20230614193544.2114603-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 995b3aef-da91-4bb9-3511-08db6d0ea238 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TcICVJp1Tcnwqpz8Bji3AOB+c8lm4RlOBh2ZoVbsBrfvv0IagN/rNG9HzHLxTFbKjBftZoTBYRsXnc7tBS2qUAc2mNb4VILRqQMx7GZ15OyiImUwVpBLdsV5cLRM7qOHhvHn0O+bXbJyjAzmDZGhQXKLy4wilDc0t/cg/Mkd7EUlimZ2Cj01IQ5LORZAIbhkDwBHClVKYXiJkpl0WhMbjfta3M8fNvw0Jx1G2Lf331I1DzRAtyv+PAmFIwZ7hoNwDxWgcbmG/BKcOhHks4kcKz0jFeNx7r85G7JJHPJzjycTunBYwmDL2LmqJkIlJpHh7fJvHkW97JjRacwQyc78UkuLO/d5+yCIq2sRPDGxM3IXuzU2acxSdtEXSZQ0gLZPglSLAQI8jqEYCv4x+Rg4dSg+Vw3JfGkMZNAvhQrG05wQplM3nabKulqEmrZiOJ8n0cgH4HRjBsIynrk+Fo1W4RULS4vTft/6E+6FUilRzCm5JxtetDH3cqYPxvugJ5cQ7K7n9ajjdMx2sanXIZFbqIqvLUAV5gktrnusZ1ajMKLB5RTYbj9Vd4II9wk47Uxr0rcgZY98lCWTru1jnZCwUAor83/9DTh+1v3PxstuxgToz5C2le91m5OD2XYA0l9ugT0HKwQDVeSMA+lQa94KAw== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I6fw1aAYZ4emaN2IiYxzWme+au8QxWupEnfJpZTr8uBO4P/U67QCx/PbHgB1OPAP6fltrXF2R0CNPPphRME2HQqK57OTZ2gVqJs2B8PXE8T0rjfbFUJDXcav0agosZcfxzNVnRm8/op4CSV091BkFeU7NqRF/ScEzKh7zAEMqK4DItOH5+8BM92+MeCL9E1XfFELNp4huRcNqaOg/NELYB88vlNIBKKcsXoyZqwtUB8YdfKm9Yx2eqlTHr76454cOMBnjeELQGSFSWUcN1/p36jW9ow0loPWBcxvUSS7dsQWuoqHCXq6uh/CUsYMdT6QoGfEcuTqMRGSWm000TNn5296IJWAqX7WwKHlMUow0X4++UCibRsnHLo5ZTHRXJGl7PjJs8/+tHCSSMXEHcR7Ri5t9GLi5gNDCUdkvm6Yqd6JllUMctMAk6rrh1ASsPms+ok1QcnEchOozRQlVa3QVmQkeEwwnmiJSAo9hZLUCHcURMkpqfqkvdBXehIt0yboBKb4qr/P2yvhi30Pk9HwNbaeB5VbOILtzXf3NkDIw00qKAMykBCzjQluTmApQOv6wHDNh5BK2P6W7Dxcy9bgnYmcyj54/mR7T7BndAgC4Z2cGR+ikBND0QyCliIiQ3mz5XQQOElq/mM1XEYRHtB+hjxa7S47Gx6c+jkRgeF4mYZI91AKWMpqKUXwHRNLPCgp9G1wjC97q9mDTSkkkLcL40zC1zHk0WMkcUyno9Vb0HNwkifezrjO9vCHNC7ClxsZeVgGPPVEJxFMtBaitEjN3v6it+FPi4muCjYF6I7zw+HGcy3BhV/uGNgO2pNvwbCEI1h+NhdTxogJ4Psf9HGWET4eawIZfT4kJ/q2bILI6V/ma/l30Ag5RrESGwdeSsSnqjiE9ZgzDlEI0gbgy11BIRmxMkX03GVCFbSuDyNxTc8oY55xs7AFiKV9jt0CARdz3H1oGGoNAuyjEK4UhAe5Kae7ii2F/NOES+14s9wZh+SuclUw+Hzma6xDcSUij9SGcfVuIom/LBrNHVJgbfGpZejq8DLg5tb8HvlTMvIJTSoWd6HjXwKhWuHBcpXlVjo7CulD94IjtU8Q5fmX3gp6Ub4nOU2qr5Rqei3a987R0oJe5e2evOn7sbb5Mu/O1gKzxIbeYs1EemCAUXN/vomFDVjR8WTksovD8U/GWA3F0RMxL5qxds42F3xShjcrTzdJdr0RR8GbQE/f1BjWiwxD4Xel7gM3un9ATB+Aq1J/CQyrbowNi+Rbt117adryUjGWv+d9MaTclRzIXr1DMNRynje3l+flwNEAzhyrq8Iv9REUhkukEaWD7/5AmtLd0ZsgT/wO3BRXe3GLuqDUC4ftwB+UbDqKbiWj1TTVG7jXYFBYvCXJD+JKG9bO0jKOhVoFjUSnRcixFBY2n7EVSQIrL5RYmV9u2vlJIDzFM3EkXsTOLCPsIzYXOLRajmfus09hl64a/9olCn4ytSA9AuBCLeqObeQFqwcB3jCp3fZMqK87r6KkRVdeFTWopu0A0QYFo3V/kpDHljoP210vWspCZNLpHpIqEx6fnVYzjWAIdyxdSruFflr6tw3UuN8DCwWB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 995b3aef-da91-4bb9-3511-08db6d0ea238 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:22.4529 (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: n49oHguS+80B8yCFrT8/mxNF4B4M6e71LmZ/emBkEUirZHaDViocfOcUuHITBSCCY1ghDcG4JlL8NqJ3+X9fxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708239426033756?= X-GMAIL-MSGID: =?utf-8?q?1768708239426033756?= 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 Wed Jun 14 19:35: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: 108140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp187437vqr; Wed, 14 Jun 2023 12:46:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43FIBolihDqQUsgzwr7vYFRagMetcxPVJHw28kbOn8juvPJQ9FYmilzDbDxti+1wokgxaY X-Received: by 2002:a17:907:97c6:b0:961:800b:3f1e with SMTP id js6-20020a17090797c600b00961800b3f1emr18714970ejc.73.1686771976957; Wed, 14 Jun 2023 12:46:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771976; cv=pass; d=google.com; s=arc-20160816; b=HRb4a4m3fKfapyvGm6EMvB78/2mGgCqCzEoGhBhxpPId4Tjs6rpNRhBBvQ18MgjbnM bZO3CjVH2w7/lxV60WFloaUUTUrr2iYmWVqDW0769o1Q4iA27IV4woKwFx2SG0mnwfmf 5QW3NXvgOP4JlmSnGTC9vNWKfhOagunmkkSS+PIUl1JDjbyaWJ12pDtDjvBdh4RgqGPi Zc54wj+LDCe+NmkR7MkTxDLMJEX+r6ITjrWTJW+ra1FCIREFdmsJfh+ZYNJyzsfb3His dsIFXNIP5iP4CHKIafd7DyHpbWDk6MqHdiP2dPKeUHXXLWWgTA5zazMLo0nqL4r+NB4v HDWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bnuduEe23aVNqNQ/tr/oGRmipeDq3TVAdHibMWxJevg=; b=T3cisSWWgqSqfWIX/z9am2KDVouzLByXDDGkFDRtxz3P79m+y+5HM9wEc2kEv9R/nb nd3I4GjwXpjergh0KHvOd+vG3dWZbgbEXa06FHg2ueyySifx8CWw6v7gwMYNx8SAuGRu hRXShb5iTgYiXS77IJ5oKOIlGM6VedVGNQY9G0wsQ1n25sYPE1fqso7qF5JithQ5CmFq EWMmyWPf0q7mfdeOkHc6R6i2zUnawSrQk42ZjxunbRXP+jijjU60dhw99K/Dq52eScmu F0M0ad3rLhm5c6Fdvd8P2M3cm9svfLrbq8b9B3dSqmgbU+vvBZynezwshKRINnYt4A3x 9ipA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=knT1BvxJ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br21-20020a170906d15500b009828adbdb68si623276ejb.458.2023.06.14.12.45.51; Wed, 14 Jun 2023 12:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=knT1BvxJ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238543AbjFNTgp (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237114AbjFNTg3 (ORCPT ); Wed, 14 Jun 2023 15:36:29 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2057.outbound.protection.outlook.com [40.107.7.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2049BD2; Wed, 14 Jun 2023 12:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQK/gbXWcvEGH5YTD1na40aQ7dXIpVPC0lVmHJkHPf0prevwW3ZQMX311Mq4mUtba7V6lKuPZIa5toJcwgApfZC0I+38xy8xrZxylVPk5bUG+qd2uc0ygrDL4bI45IuNPKV8hVf0W4Ijni4ZihvaoN5T/sLikQnr3v5ORXsM0vjfhRy8l2JPoL2/jSbAQcudJZLT+nKB4SrvcDq+E6D9fHjryuT9BlaLeTA6f9ZJxot+8pnhqnIS4PLNpgXzUuB+rTsbmt9l+J6RZ2IQZhQoOrVGjoaxJCLGLTfXYqyP4Psr8EoAvWnb+XcGIm0H5dzGzNWRlzHdr9mEDiHD/skbMg== 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=bnuduEe23aVNqNQ/tr/oGRmipeDq3TVAdHibMWxJevg=; b=dT4RhVtz8QBVpgJQvFtrEyA5p0y9FKd0ufmpVk4mg7dHTvMZmWMg/DQbfkBgbdMx8PTxontsgEg4C7kxd73AjUBWx5+/QdEArM3vhf0jydw6uPCYmXKJg8WtXPF+KRRrvsiza4dylZYcodDAO9L5SPomggPjPTI1BAKLU9sZv+GQJtJLWNCX1Cz05w/7jBrtOxF8VioVoNms3sDGAFwbdKbNo3+8qGOYMxS6V/laRYBwXcDq9n7tfMcw0rWRljkVp0VqyIFG4TbQbdhz1qgRX4W/8e16YMPumUlojpm+7cv8pwZc0flu11lk70hn8py1Ai2oenD3J4VD5wT85oVgrQ== 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=bnuduEe23aVNqNQ/tr/oGRmipeDq3TVAdHibMWxJevg=; b=knT1BvxJOvd+HNQHU6K2aR6ni2cifod0V7sRS6hcGYCjn4W1DHnnqlCtXANFcF69u5SeZcOgZGu0SMWrJAJ6cBMMbegk0Hpyldx+3kpXENMpkuW3u9DXw/QeFsPRmOhsWppSrPiYbvEJ9/ayCsacj88dPU8I9JmHZl6QcWKZxwk= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:25 +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; Wed, 14 Jun 2023 19:36:25 +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 v6 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Date: Wed, 14 Jun 2023 15:35:41 -0400 Message-Id: <20230614193544.2114603-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b6ae214-ea6c-4324-4020-08db6d0ea3f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: An1sLp/64vx/+WJdz9eGXKjAIq/WjgRUs2cM0yhM5nUKT6dqpfrqPbIaEpC+mt+lxw2C8s82x0tzzX5XiY04c7tfY5K/Vx7pwS5cr/eTVk9XCj8kIauJw08Vnk8pmGFqUj8MHBseC+O2VBnhc8h4OLfXzd1TlmfFEuRtACXAiGpU/k6wgjbgPuq3Yo55srFY3clHEGzeIdti7GRH8/xg4xTc87tz9fOQhfm4wX8T4HGY/oTeFWSCogM096SWnQQyCw+wHrdpFOkayFjXchqjRFoxgWLenMvlaVrkkq1skDNHMUyUfMmEwomrHoppaZU9xFCZYv15aloAfva1GeLJI/uYIBHLzma8J11weDxC7lCZ03pmZsTvUP20/tulfIB3n5irRzSDwSIpFtkUwi7ycMKEAhvLmFCtFMCW45CSNfnQgHbMq276KwZnvzOH0oGZbpNbZIYCBcicSbBQeqgxMIGIsyq55AazX+m6fd06sWu2rnxB1U8Cbq8CAzUYOFxbdLzg8Ky6mA0QK2iFbAOa7RKOJ0t7MD50mKJZ0XnIHXgJ3jTSNQPk+MaICAvR2VcNPna7tkKO/dv10cCblLwMt5ffFRHrwobd651fS4JVCZalMd6rmmvHi+EaITZdNkVE/zb9MZW+IKg/4+cFi989KQ== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 51mJV+8p02sBVYavpgiVMZsnN2Y5KEEJRT0+mcqjZZ7uzXlkFVP/r6E2Nv/Y90Qt5LWoi8fbQluXkMEbgwvV43SbDr8W+sgSuzDWUCmGy9Rfzcb9TYTnUGSC/m69DOJpC2brySDV9jB0CDKZ7A/RME1uA3+botoIVMhGzUA6DFew6yDAZFY3vsUr/kEcs2mnfCEHarn5t1nADJ5unI5pFptrDMVQAEys3TmZsOKdt9n9418m9xocayUHsND/aPygG4LcvhLlKitEyhXRwcdVdjhyPs9olfhvNmXK5HmFemG4jW5GAwIH+Xyhky8zYZR3KbGPxfpxhRKEwoyIY48W7eyZk0RC9VkoQSsfo8lAckJna3nnORNKrF/osicGbw5+0hUrT8LFAvIJ6DiRtwX+qHNuhBMSoAQgVjcj1C7IFIczTjRoOgNMxjNxzgexUJkvNsgYeLpUwN+FCK+t/vSZaxI7g23khsWX8ovBPxD5rHUnAAYio1RN9+GBtFHOryBvzjpFLHid5sMRbPUCHGBUqkIWLQwjJkN0inXj/eeDoqkMqvFDluBbLOvtv48uT0cVROWEiSsRqhR55d9SvfEd3yXgQGxcqAPChGaAqlJ3k/K5o5n2yfOnkBqiM6HvJphTUKIcfA9xo8wV2a/LfGXs4W4MYiuwMEmeIAozZ+qSYi6B9FQtBzmnmLOLDHulC9mOldFoQ8iVTUze4xuBREx4mrIlYXSNbPOsFF76q+mf7UiAlCEs16aF07nMEjbmk7w5D+YdfYOtrBXB/ls/w7gesxqG//WKwINozBDWgdDNpOjP/Dyz5eL8phCLf+IRsIhsE8fTkC97BBsAXFTBkuOj0c2ChvgqoJwXAZIcSj3CLBHq43GyazFmo4cHNCrLB31oduwd0LZSr18AGqNpu8Cl/sIjYv6ZvwRbIpw5klbSqyvS0odjMG+AAeLWy6BkL4LaDEBpmaOaLr+TCunqVOmSEKvC3uL87FJIter8nNRFbsrUoAB+NN76fyaPkzeeYjF1uy6wcgpwuXHwQwuysymcg5GlbsFt2/YOeAz3O9XhSYppbmxCywB3v6BvkTjZ38z2ZTyX88iDIXrMxRYVffVfSEmcCPuYXrPOSqtsRamu1Plfwjycm49vUlrsQMW8wwA/Uf9swwlbHCmcI96A7Z/vSn13Z5AHAyCMc4SEC0bHn5B0QEde7fIAqTYrQHfs6NDJurtsNKhdK2hdr0sm2vtvzlYYZdiarqZl5OXGbf9vsVTCv6LorS8wV8WQavRxrs6aLXKTZUB918c6CxsQvpNGOhIArsNBe1nO2/ZiN1Yswtg++bmLFO0JD5nfFUEejcgZPmE25TgJZYL0y8GtLXOeI4MbsI+5eaaG0mbgkQN0shUvN+dfcILJb9ST1vMHjW2igwdzudWWPW1VvFjlh4/9vq6F8z7DhcsVpGwatDvGhuX8BMldvsCvYodoXoN1FMWrpDG9yoCWuv7gtGlLzm087yqjhIJVWhCJm+lXPYUfY3Ljbw95KaW6ybKGgfZfiFcO9NfqTSUTT//LhzGb1mlz0N9i3Zb7Y3chkgpojX7Kbec= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b6ae214-ea6c-4324-4020-08db6d0ea3f1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:25.2104 (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: 69VbtJrKtKWyy61Fl6V0o6GjwyN1xEbspvz81caOFseduSm3KWfWD7gMrYRKs5DC1VDOyu46PG+VmFxHrUvt4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708612768211771?= X-GMAIL-MSGID: =?utf-8?q?1768708612768211771?= Relocated the setup of chan_name from setup_irq() to fsl_chan init. This change anticipates its future use in various locations. For increased safety, sprintf has been replaced with snprintf. In addition, The size of the fsl_chan->name[] array was expanded from 16 to 32. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.h | 2 +- drivers/dma/fsl-edma-main.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 521b79fc3828..316df42ae5cb 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -116,7 +116,7 @@ struct fsl_edma_chan { dma_addr_t dma_dev_addr; u32 dma_dev_size; enum dma_data_direction dma_dir; - char chan_name[16]; + char chan_name[32]; }; struct fsl_edma_desc { diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e67aec3f76b5..e2fbfaf9155d 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -175,8 +175,6 @@ fsl_edma2_irq_init(struct platform_device *pdev, if (irq < 0) return -ENXIO; - sprintf(fsl_edma->chans[i].chan_name, "eDMA2-CH%02d", i); - /* The last IRQ is for eDMA err */ if (i == count - 1) ret = devm_request_irq(&pdev->dev, irq, @@ -303,6 +301,9 @@ static int fsl_edma_probe(struct platform_device *pdev) for (i = 0; i < fsl_edma->n_chans; i++) { struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d", + dev_name(&pdev->dev), i); + fsl_chan->edma = fsl_edma; fsl_chan->pm_state = RUNNING; fsl_chan->slave_id = 0; From patchwork Wed Jun 14 19:35:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184687vqr; Wed, 14 Jun 2023 12:40:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tPDmcR61XCfEUu6BrJHScddKj3Nx/VWpIv077L4Evg72hFjKVo7lzgraD3hFzYLs/ki5E X-Received: by 2002:a05:6a00:1309:b0:63d:45f3:9fc with SMTP id j9-20020a056a00130900b0063d45f309fcmr3159294pfu.5.1686771626501; Wed, 14 Jun 2023 12:40:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771626; cv=pass; d=google.com; s=arc-20160816; b=DPfgNYLVsv4nqwDAxqWvTyzo25S7nyRDbHhKg2yaN0z6pjVp99YBSJXaMJ1+0mbqL2 KcMTtZy0tNXzaCi65Ps9xPNRJogpINcDISQhkXZ8dHOfcWR/FfJlqo51YYO7LcJ4RQVE 814Hfy5dNfXemzSD5UCQe/t07G1PnU6Bua3NzVKRjnTsEsRCxAJYM/QLki2mBvijR2XG vJr9Q6KeuoLFxFGV9rmdhgM0B9Q/De61xCrazcZMMkJQbC3dapzLE94ttgSUqKWgEDPv AYTOwLUIlRwigxXf28rrzkPu+TNc/46RC4rJkN4U/65VwfLLgcuVKugTaWXYYbjif8Xy T12A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LwWZJ1o2vN7Jj1Wd6gxZKukLqr0NduZpRCO/jcgnVtQ=; b=Qt4f3rowwz3pkR10TwayDqcD1IdY+ac5dIFs/oyzrgpiz7xSdZpdXgil9DHtZDvqIk AKr6BrDXJrX1HWKjQ2d31noWOcZ0onRXrJhJmHvx2jNT8gWhkkwYUnamyUIsM/ItbolY umr7PIelRqieJw5DyzeLNiEtFr5XupLfwguCfXLtAa37Qde/ZzAD15mL+mmlrQePWtmO P1xe96QpVXR4xgDgsANlkMI00cxWp+4XWaFlxzxBVrLRevUhGhOnCKQSaVOUSRkbSo9s VVNXpFVkgrXPjjjqNeVyTwg4Wp0bKiPzul6ZRFGcyctJgz4DcrMbOJ45aqChH3eFtbE2 lATQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Q0A8uBwO; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l193-20020a633eca000000b0054fa5d9216fsi4735730pga.62.2023.06.14.12.40.12; Wed, 14 Jun 2023 12:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Q0A8uBwO; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237048AbjFNTgs (ORCPT + 99 others); Wed, 14 Jun 2023 15:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236965AbjFNTgb (ORCPT ); Wed, 14 Jun 2023 15:36:31 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2057.outbound.protection.outlook.com [40.107.7.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9869FE4D; Wed, 14 Jun 2023 12:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KpYiqUoRP9Zfby/ws5GF2wLvXyJ4SfnQV9DYiOCf7a7WVyYi2OqJdvZmM4IpilO9PKD79ZEHfA/4eA3sVsJafWDTirRw6o3smUs1339DCVmk+YUtdWK/9Pe3R0UIpRdNIv4REM7AOti1UNoYpl66x59Zo8vvLYPdih9VItZVWZunCjwABT3tlW8yTziZ2FBS98OPWWyI5o3sipuHr2g084prDhqdOOkXuO3NSWRbEiTIhzM7gGbgbQJQpzVPzLFbx026ZXCMlSi6qB5x3Z++AW/nQXsTBQNNSSphiIohOEhryyCbZjmD9YK0f+eUW3O+pApXLF0oDrmA4fkZCiUwSA== 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=LwWZJ1o2vN7Jj1Wd6gxZKukLqr0NduZpRCO/jcgnVtQ=; b=RIJ9n8+ochuJCqL+xH0/JxFmtNACVmx8mRzxi7ykybtyEy+dfPVFs4NeYMYWCmE4xnJ3VNsAVmw3Mv22BbM0szgmXLx1OF0XLgIbCqbeRN2TUAMlt2D3qWFOx7pabsB05sG3EMyzqq3syrY/GEV9MkwupMn+XGM6+yrXtJIce5rE9VBz1ehe8M/eLgGlm1ChwXSW9Gt5+RItXfpBSJc0BoWvZKqKfVGGPSct+8j5Ba/sXldDsrcv/kB9n/HVdfGgMCsbgMJ7ud/evzrPt3mdo2fPXbocKls0bg45MnxHMa3kwN6pWKxy57J0FOdH4rrqFNQz8XzNArR/iWzo0lZwYw== 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=LwWZJ1o2vN7Jj1Wd6gxZKukLqr0NduZpRCO/jcgnVtQ=; b=Q0A8uBwOnXyu8OEabl+9YX7TfbZwoK04eE5pFNr1tA/e2wc6Ofql8SKZLmw1lHKhxQgjz/2bHw+P/OP2zK1kX43eXguXoqnK4JcGK6Q4eK9vDwmwZnm18SeJKlA8snaR71js22jxunD4Pn304CZ+rrv4vTF1VUkh/wQh8AI4KZs= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:28 +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; Wed, 14 Jun 2023 19:36:28 +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 v6 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Date: Wed, 14 Jun 2023 15:35:42 -0400 Message-Id: <20230614193544.2114603-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 3845525a-447c-4952-9b0b-08db6d0ea599 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zdcjtc2nDI5ZIV8hXJaD7ZGjdoHOsTM/WQGzsV5wFD3Y4zmLkAD5yFyxFNmMhToL6kUpta3RvFsoUs1b8FhaxSB0P8j8JbEiVgaLRcXE2WrVloYUGbC4CKlOmdkj5FrhcUG5kz32KgTk+d9wiSqBM7agF7qntLrRmPDkmKhvhxzsf5sKoD+MGkAazgSuK2syX7Wdi3v5f3VciT2HhRd5GA/eEVPQtYP3sx2L3UExPFq5m7D+r+DWZIwYEAoU10+y3MPZDqDP2p0osCacSACDHaltpTrxpBrWI6eQsLyXF5Ziu2VkcWkHlNvGques3ueUFhID78yg+rf9eRx+wqUfzYEN/GG8ZibByJjg84oco3hzaBm9mC7T5XyU24gAfQwu1dKKOYJydMWfv8uXJE4BXn3tFlFre2uvo5ZdCCLoDVFHJmkKTtfhUQ5Mjnjua2epgvSGpn2nLJulzHdIwU+U0iIeDz+OfEflgkI5TSO2IR4aWq2QZUrMzpOsQ83/KRTEsFHftl4zBCIBWz8ZRfeYMmHoOqU6M15Vp/yMQBnMYnZyl5YwX1UW5TOfvVL2l6xQapyGphoFYtztCW9uLhRAM9Atxs2iZwntR6/DRzqBMw0oxlT4c3bbJNvvPZ8X3P2p 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(966005)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yYr2+j7oZkXA4hIDNZ28RIXT9fl4y/dfAAp1v/n0+JWdoM9G5+6jVLt1wpXjQdrF70FiOUfnllVIk//0hqXACDtXT1OSw+m/n7Gd5+gXbtMgub5IG+VB+r/oEwweZysAAzWYHqtiD2IEapoOGVzBiGiWuPyhs08bweDtz4s70X/9AGDI/SK2yQ1drMdXo/650uw0XV2tSrHvVwFRd0TNzjBzyOsRc4b0jMXUrpfReKIyDGe6m+kRQEYD4ux224ruV4ySZxW68/zVqGL2VtMIYJHliDFSQC9BkWhNAbN8dkP5TfMsHKp4BK3a4BC/1pAQDfwVtYjXlQ6FZ1VejWMUStb+1nJ4WRUuWif+rrjz8Rdym2sRs/kE5NYyygvfmRHceCC/OLAGCjzT2GRqLJYxH+M1/ZTNceALRORCSSacKMsbwKVofCOk9C1iFRcGMpMjPtv6+CBpAeLb1MOyD6564qqXpJo8lzzkb40yXos6OfpLTTerDnp+klZpTnvwIUQcFv26xodueFTNrhENE4+UCpSK5gPyuFkdCSLcjiyad6FeQxTTpxbEZHcA7MkZWNsIOkDNHTWz73y6U0qWFZq7kozePwl8blN2hvN6eDHDHDj5ayAeENJPcIMlBf3hpu8rTHYJATqQO+3IdlRI0FtsV9ws9mfxflSWq5YfG9363Mri90G1OMpDetGPL5jw2drkNbfX5LeQluH2nqfVpjtV7TpPWXeP0iK55kxO4WRXlFt30kJvg3b32sdiiQs/Bka3JwQyxEl2lc5YFhe3diPV2jHEXWjWu9uZqGSFlSA/ep/euweaaGSZVW7wTVZDYwnZYX6d9fL4sNcogCfrXSPvMrSTPu0iWQHbuEuZjETtn2ujSb8XzA1mgheUDTbxh3PN9e4HEVQ1ZluS6tqjDwBTaLLWP5FVpxvH6LUs25BRuudVppY2oKI2L+KgaL9VEIcMr/+my81MWDyLzw+fTswePGbSab81LDIgBXffpO1sFSBYYsT9kKN7o+BJdyhiGNVfL7RaQhHIq+vXKMalPMizbkUUnXcvYr4h4uko0HCelVfGhpMQKGzjv2hr9MLndNVMXDTJRAV9cBJe5Z1YN+78cIk9m0jaDDr69Gl3CEIsAnvS+TopGMRWMvyr6eVQrwm/DXCOtOglrbYVNCCedRhyigsE35qxRzVLtq9Kmz+RC3EdZ8/Hwia3/3FMntcIRZ5SzPGEyMcDaVHj14tnBFAfmKxdqw1viyg8irSfI+Pe1bmLGBCJ2ObTevKb1ODVZIqUavuafBd04EbbxX1Dzu0jWWifn9bOQfH0oEdvYQENMglAC+975DHFwLOUjsqGKz60nb11aO6hqe/jajn4Gcwt49Of1QWN2P/OaegnwdYxOGSFZGTX/4rMZp8lBvAwE7U6VWyLYjKZxTdFd6HtowFiGxDaQZuOqLvi3bNJizywNyyxePtfnD4dKeen7rhYDQq3g3nDqwZrgc5jRcWuo7vPQahFK+z5oHlvyj5tX0K49Bh79fyjJpvzbMtvsRm1n5kQLhzfqfiTU1lskzlerR6TlGPwJSHFDtJtLvwXGnauu58= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3845525a-447c-4952-9b0b-08db6d0ea599 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:27.9857 (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: FlPRrVmvhEOY+L0pmzKEOifvbiRIShI+A7BV/IuAWpQE3LLBL4QgJiQzwwI7Ulas+sZa3El0T+mAOfV9y9GRjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708244918457655?= X-GMAIL-MSGID: =?utf-8?q?1768708244918457655?= Relocates the tcd into the fsl_dma_chan structure. This adjustment reduces the need to reference back to fsl_edma_engine, paving the way for EDMA V3 support. Unified the edma_writel and edma_writew functions for accessing TCD (Transfer Control Descriptor) registers. A new macro is added that can automatically detect whether a 32-bit or 16-bit access should be used based on the structure field definition. This provide better support 64-bit TCD with future v5 version. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202305271951.gmRobs3a-lkp@intel.com/ Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 38 +++++++++++++---------------------- drivers/dma/fsl-edma-common.h | 22 +++++++++++++++++++- drivers/dma/fsl-edma-main.c | 6 ++++-- drivers/dma/mcf-edma-main.c | 4 +++- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 51fbd7531c74..eead6a4765f7 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -40,8 +40,6 @@ #define EDMA64_ERRH 0x28 #define EDMA64_ERRL 0x2c -#define EDMA_TCD 0x1000 - void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) { spin_lock(&fsl_chan->vchan.lock); @@ -285,8 +283,6 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, struct virt_dma_desc *vdesc, bool in_progress) { struct fsl_edma_desc *edesc = fsl_chan->edesc; - struct edma_regs *regs = &fsl_chan->edma->regs; - u32 ch = fsl_chan->vchan.chan.chan_id; enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; @@ -301,9 +297,9 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, return len; if (dir == DMA_MEM_TO_DEV) - cur_addr = edma_readl(fsl_chan->edma, ®s->tcd[ch].saddr); + cur_addr = edma_read_tcdreg(fsl_chan, saddr); else - cur_addr = edma_readl(fsl_chan->edma, ®s->tcd[ch].daddr); + cur_addr = edma_read_tcdreg(fsl_chan, daddr); /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { @@ -358,9 +354,6 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan, static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, struct fsl_edma_hw_tcd *tcd) { - struct fsl_edma_engine *edma = fsl_chan->edma; - struct edma_regs *regs = &fsl_chan->edma->regs; - u32 ch = fsl_chan->vchan.chan.chan_id; u16 csr = 0; /* @@ -369,23 +362,22 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, * big- or little-endian obeying the eDMA engine model endian, * and this is performed from specific edma_write functions */ - edma_writew(edma, 0, ®s->tcd[ch].csr); + edma_write_tcdreg(fsl_chan, 0, csr); - edma_writel(edma, (s32)tcd->saddr, ®s->tcd[ch].saddr); - edma_writel(edma, (s32)tcd->daddr, ®s->tcd[ch].daddr); + edma_write_tcdreg(fsl_chan, tcd->saddr, saddr); + edma_write_tcdreg(fsl_chan, tcd->daddr, daddr); - edma_writew(edma, (s16)tcd->attr, ®s->tcd[ch].attr); - edma_writew(edma, tcd->soff, ®s->tcd[ch].soff); + edma_write_tcdreg(fsl_chan, tcd->attr, attr); + edma_write_tcdreg(fsl_chan, tcd->soff, soff); - edma_writel(edma, (s32)tcd->nbytes, ®s->tcd[ch].nbytes); - edma_writel(edma, (s32)tcd->slast, ®s->tcd[ch].slast); + edma_write_tcdreg(fsl_chan, tcd->nbytes, nbytes); + edma_write_tcdreg(fsl_chan, tcd->slast, slast); - edma_writew(edma, (s16)tcd->citer, ®s->tcd[ch].citer); - edma_writew(edma, (s16)tcd->biter, ®s->tcd[ch].biter); - edma_writew(edma, (s16)tcd->doff, ®s->tcd[ch].doff); + edma_write_tcdreg(fsl_chan, tcd->citer, citer); + edma_write_tcdreg(fsl_chan, tcd->biter, biter); + edma_write_tcdreg(fsl_chan, tcd->doff, doff); - edma_writel(edma, (s32)tcd->dlast_sga, - ®s->tcd[ch].dlast_sga); + edma_write_tcdreg(fsl_chan, tcd->dlast_sga, dlast_sga); if (fsl_chan->is_sw) { csr = le16_to_cpu(tcd->csr); @@ -393,7 +385,7 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, tcd->csr = cpu_to_le16(csr); } - edma_writew(edma, (s16)tcd->csr, ®s->tcd[ch].csr); + edma_write_tcdreg(fsl_chan, tcd->csr, csr); } static inline @@ -736,7 +728,5 @@ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) edma->regs.errh = edma->membase + EDMA64_ERRH; edma->regs.inth = edma->membase + EDMA64_INTH; } - - edma->regs.tcd = edma->membase + EDMA_TCD; } diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 316df42ae5cb..cfc41915eaa1 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -48,6 +48,8 @@ #define DMAMUX_NR 2 +#define EDMA_TCD 0x1000 + #define FSL_EDMA_BUSWIDTHS (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \ @@ -93,7 +95,6 @@ struct edma_regs { void __iomem *intl; void __iomem *errh; void __iomem *errl; - struct fsl_edma_hw_tcd __iomem *tcd; }; struct fsl_edma_sw_tcd { @@ -117,6 +118,7 @@ struct fsl_edma_chan { u32 dma_dev_size; enum dma_data_direction dma_dir; char chan_name[32]; + struct fsl_edma_hw_tcd __iomem *tcd; }; struct fsl_edma_desc { @@ -156,6 +158,16 @@ struct fsl_edma_engine { struct fsl_edma_chan chans[]; }; +#define edma_read_tcdreg(chan, __name) \ +(sizeof(chan->tcd->__name) == sizeof(u32) ? \ + edma_readl(chan->edma, &chan->tcd->__name) : \ + edma_readw(chan->edma, &chan->tcd->__name)) + +#define edma_write_tcdreg(chan, val, __name) \ +(sizeof(chan->tcd->__name) == sizeof(u32) ? \ + edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ + edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. @@ -170,6 +182,14 @@ static inline u32 edma_readl(struct fsl_edma_engine *edma, void __iomem *addr) return ioread32(addr); } +static inline u16 edma_readw(struct fsl_edma_engine *edma, void __iomem *addr) +{ + if (edma->big_endian) + return ioread16be(addr); + else + return ioread16(addr); +} + static inline void edma_writeb(struct fsl_edma_engine *edma, u8 val, void __iomem *addr) { diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e2fbfaf9155d..8ba705080f5d 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -310,9 +310,11 @@ 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); vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); - edma_writew(fsl_edma, 0x0, ®s->tcd[i].csr); + edma_write_tcdreg(fsl_chan, 0, csr); fsl_edma_chan_mux(fsl_chan, 0, false); } @@ -419,7 +421,7 @@ static int fsl_edma_resume_early(struct device *dev) for (i = 0; i < fsl_edma->n_chans; i++) { fsl_chan = &fsl_edma->chans[i]; fsl_chan->pm_state = RUNNING; - edma_writew(fsl_edma, 0x0, ®s->tcd[i].csr); + edma_write_tcdreg(fsl_chan, 0, csr); if (fsl_chan->slave_id != 0) fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true); } diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index 316e637b00c4..bccb5448e492 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -200,7 +200,9 @@ static int mcf_edma_probe(struct platform_device *pdev) mcf_chan->dma_dir = DMA_NONE; mcf_chan->vchan.desc_free = fsl_edma_free_desc; vchan_init(&mcf_chan->vchan, &mcf_edma->dma_dev); - iowrite32(0x0, ®s->tcd[i].csr); + mcf_chan->tcd = mcf_edma->membase + EDMA_TCD + + i * sizeof(struct fsl_edma_hw_tcd); + iowrite32(0x0, &mcf_chan->tcd->csr); } iowrite32(~0, regs->inth); From patchwork Wed Jun 14 19:35: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: 108136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184906vqr; Wed, 14 Jun 2023 12:40:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XLikssuKD0ez5W6XdT9y9+uuiWffb4fKPLtggsx+jHCD1n/yjtr7XG3phpfvzIwt85/ra X-Received: by 2002:a05:6a20:e193:b0:106:4197:b7ff with SMTP id ks19-20020a056a20e19300b001064197b7ffmr1891739pzb.30.1686771650075; Wed, 14 Jun 2023 12:40:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771650; cv=pass; d=google.com; s=arc-20160816; b=lVA4Tu/sJIILrkfpaozaZwMJ/08NXrqlWWhoXUlC0jkG5L42UvX4gvcWarnmkUkTIG uxU3Yp+2H9sz+aYV9VQFtAlECiKB/SDWQ9ePz7ERRw/mi8JFcjMooHDVC9WFH7l29DaJ PEKxIPVMaIm3dlkXWzKqI5d/PJINWjKhV1iEKPk46aVyX/bMCG58G9yCttmivAI0fEgE kldM4azn+wDy1gI9zzK2gjoF2pvOZ7Vz6chbpZ9aLRTNMn50vAqGSVINyA01VP7O5Avi BDotzI3/Uv7w8Ik1xKJG6SsAXbjmddBeDUh1nhfb6nLiIO4lrKDdNk2OTkaWNhkAeAch knDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PeCMQBP8k+5S6/X9HD+YRizczLEve0pLk7+72KdnwX0=; b=qfk/DsfPCAQod9Qd6RHdAtskQ0qfupi3zj7o8zRldHUrCYoPb3b8fZ4OjyXkzahr5a 7OnozR4kMaH2lGghNQupiAhN72g0AeABsXWcOC68rJTNmwupXhUjLSDZzcSQ8aiZHHSO oODuZS7Zu3zh3SlerRDNZLO2JV/LZrWYCJM08j9N6oc0ZiOJEF8TBIzTyTB9vyAl1znZ s7Hh0jb1aW77hMdFxjg4yS/Hph4maPtnwWZmvWie7gutz0O9LgmdLfuFzX2vYtPDI28e pr7V5ZJIm3BIedYir5vB9goW8D7ZrPijuFWolxb4uJ4BxhxRBru56LMxDYIIpfEaTdAR TASg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=rNQWwGco; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a056a0000c100b0064d41566266si11315493pfj.247.2023.06.14.12.40.37; Wed, 14 Jun 2023 12:40:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=rNQWwGco; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233913AbjFNThV (ORCPT + 99 others); Wed, 14 Jun 2023 15:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237237AbjFNTgh (ORCPT ); Wed, 14 Jun 2023 15:36:37 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255822116; Wed, 14 Jun 2023 12:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uj5vBA+5OAtDOwR++C/igVDRgL9ljuPvKJS5kB7T0epMjQitSTXEkKEYK/W+hWoG7mrA3edg07OzaiuEpcrQnWaUvTfaUwRjZWYVe8Bggg0gjmXYE/KNq0lGyYtzQScwYJ4GNdxWMaF+CxL9IXQYuSWrdu581JWTGSXkHBABTbAhbhksqTB42c0al9I+BxZiT5A1o3qzMVemRjlotdanaswAM6if+5g+EJanBpMtQ2xQd9DV3vEmqGOlxFWyDoekXrIwcHY/vyHPyA5ogJ6oS1/rUdEOzIWVUYOVN+qdzXqfh+DKXihLj1bY7m/QFliAEmenp0nSbXZcz1/SmNmg/w== 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=Nfj0hOfFmcP/Q6fTkZukoTYFCYGpg1sfvFBFzKdLMenXNqmWwAnVdk9wteiTDyMryaRvSU9Jn5Ig+hzfxlO8drdtrj4Lp8MARQG2HcvDYoPAOOc5zjmkUfts9o5bgYqOzZdf50Al1lH9XtXJGnncFlvgoCgZL7nz3ggXydKzVt4vq0cn1Q7bbrJkleIjC90lbWLrAqKRc2MzAzvYB50KQbK0WXvfIpg3pkNMt1onfXWBM9IA5pz8QyciZNSbIIsAdDIiSu+XBLrgEcoiqjZ2LOfBh3pprkbJurxksAYOVdgm92MI8tySvFVAxNTcG69c7JLQTNiILTXZoyfNJCTLOw== 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=rNQWwGco9OwiKtVa+IP7LB9dFEIvjtdyLyfNqbyo4mz8VjJtJwUCvdwx1zLSMc5uBRWykg6JBWbiIUnIAgbcSnPaehuuM++TurleyVtZD8PnSxmK0hloL9mMe7JuN1TtsZP6TWRffUzapaOeVkQhonnCGs3zzjIeUJkeGltMRfU= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:30 +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; Wed, 14 Jun 2023 19:36:30 +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 v6 11/12] dmaengine: fsl-edma: integrate v3 support Date: Wed, 14 Jun 2023 15:35:43 -0400 Message-Id: <20230614193544.2114603-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: ee7e8550-672f-4c8c-3146-08db6d0ea73d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AWbfe8MzS4kgV8NwWerJa6vCtV8y2z8mjQKT83ejjr5Wnc4yp488wvG1VwysW8m1dLcjzSgCVUf0jjr7WiHpC6tu+9gg2iGZNhe8xKwFSKteG1RklxgbbsZLk04wtXTCQr7e92AdzfzCpHzVgIvg9B55WeypmOfHJerhPHFOffHOy//9CLi2b5c8cWtf1ZB/lm1T2p3OU2UYSyVS2Hf8oIL2ra8rnwGRb5ERGS9P+TJm/P1kiQyA3WmlLMDGjyEElEMSTaWc2xZ9bCi74hGtdNe0nDZIs7JEIy55+3A55HTEsc+jBwJ3YspN4MS+FEQ08nPmPqXH07zjqPUtgfQEh+F3J66pXsxbbVE/R9oeBbzJBUrMx1LgWVcg1j+rLYZ8J32EJEUHhvgxYQ7LBBRmEcbr8UbZy/Qh4VUvPYUIHdhBK0wCS8rKGnjXYbA7sUL8FaB4dZO10qodrEUUO6OHjgt8cDGeGjKZZRYZ6W89bIlafxWvj1HM7/Nlla29SQEUAQNgrwGgdMJrVUz/NgQUHDlwprj5tnqNV4AZqwOBXxBvY7+cFmT3qKTP42HlYMULRCFhbjSTEr3Uhjw/WFTM2rnIEuhI85leAH9N4qgSkBWORP0vFuVCUsuroUipGBLUZXWWlQuqAMEK/KS9Hu1AWw== 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(30864003)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +4kwLNn/jzC+gXPv+WPDxuak2xU7xkcpCV9fdq3epuyxPpX2fsj0NAP1HnuuivK8L4DAxPFDmUgWEGf8Q8RqCDWKxdyaE62oMobb/3WM7kiTeUTCSUYU1UQgVsrm9HA3yvTA5wJ828lvi0OzgNFE3KH+D/fZpcxtDgdEnU9MHtLUV60ftCRfqUAc8EMq9Paux2tqQKTDleNZ9YWKKjO50DcJoGVr6nrIPGwFxgkKTElqEv+m9JI7Q6HZ18IGBuYap+7LCxU8dRQDs2US8/f46nI9tuG4nP99qxZ0sPDFI8yDo09Fx94vOo11WbXgsCDDtAfBIZP1cRqYt5uE1Wubl2jySOXLaoUnUeuZG07Q0NItAxNmIbFDODf/7KCOiX1Qmv2LAv7efESps9hj9bFGOguYR1RyJ7IBPuuHxsWggTMRKhjeQqSfUupLk3GOy02HOnY2A9tQ6qIwNKu3RHnqEs1XLaZEgh/SowHfVvFUz5oOk+bL62a+wZsa5u+9Z5CEMlcwNPmSuV2oAH6YXgWwq/vfE3bset3DpU9vtcLjhRgQ5peFCIM/AS1Lsq5bTq7ulMD/3ya3RFrvUHM3g3L4naqEvRKnf1TepK2yOhDrhdCky7ejSjXLeR6fZvbH+tC72N6ppspFFHrfWVUZEAuS9jNnSWcGpGXlS9rnamy/yEAh2J72G37lBoMl1jP9r6p0J/6U3h+jwB4gwjr3QXGYsYptks5zaKDKxjhyqSrkWU4dlBD5HC/Rn/9eJI+gyUZVmhi6+dO+LD2scalC/Jqt7FkwqlD/Pa31bIB+rv/lensW10CH61pp2Nb4aWKgTusWqKHwqJnfnPkbuLea5NzUgGrTazEuWvF20RKLA3XCvoHkzICrButTvSWMEvFBVapyHtLIhR4q3IzkrT8nQIpgi0ZDH5G110PznschrYEqQT1KyM9D73mj3ZButxmk0Ky8BmGIwhCRMuNM8lqoLGr5l7dHYUEESVxi6Kcz1PPL2Z7ShGcH3cu4p5/6E5+5P7jrrQL7ET3Loku5g6WKFPGAsCOKBBeaqpEkZXWyco7qcOsh1nrH5vqh40KXUZtKz03oEcG8U3R0FcyffdjG/7DI0vGFKm1h78JFxnRAbNuO8zxwbWc8pbiqHZ2VwBxX8N8Zxt/5I6KHrXCMJjGePDSRIr+4xhidwE7lDxlpeObBz81RW02+DWd2iwVNLWWNWKOYi/chZroqzuMS3M81w/wj8I8XrynlORjFrylLyhuVHNVRwMZakThliGNbku2ZqZd64JkVlwL+Fd9v2G6UROmpayOGDx+hBJ3WxSy6gl90gVRsYKPW94hSFYyK/IWraEqKiK2jNFJoeX0ie/7KrfSEfc6kFqMQqXQkgko185H6ap7hcrdbDHlHXzqt9DuvulxLGlpRy8AwBDR2RRpT3pfVNj/rH1eIOiv90JKEFriHikNn6n5LOMQIplBoPp/qhMCp39h+YbHyH6h492qg2ENwcpqiudCj4YvJZoWl0S+qqh0Tbk8ChOwIcIVlAR8dWPm50K+YRdAGPkkfKAO4jaeuaf1ogFmXgMTKe3Ur4806rIk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee7e8550-672f-4c8c-3146-08db6d0ea73d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:30.8800 (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: 01GYwNrpt8XEZRwRd2Rgwc1cFFG21J2140XQ5eZQ4ZxCgURr2b3TFFjCIEO1Cueik6Kd3HuZqvGURgkIcY6AGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708269881587122?= X-GMAIL-MSGID: =?utf-8?q?1768708269881587122?= 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 Wed Jun 14 19:35:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 108137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp184939vqr; Wed, 14 Jun 2023 12:40:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4W9/Of7p6XevZ5J8dvd40jVYQNZ2iFSeQp4ULnTXfJQ3i+ceaDqj2QIFuEqHFHcvQBZkzF X-Received: by 2002:a05:6a00:a08:b0:654:3dac:f107 with SMTP id p8-20020a056a000a0800b006543dacf107mr3404597pfh.4.1686771653675; Wed, 14 Jun 2023 12:40:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686771653; cv=pass; d=google.com; s=arc-20160816; b=oFgHXky4tpPq1UbzCgif8N5/yUNbaS4dDxA9/6VL3uDY4rotZlx2gto0Nyeg+aj6NO 6026FN1xZs+pqndEJ8LiTU2PpiMu1nfmCO7xu7tsh+CcxNPZ9TgwEG8ES+bj6NK6fPeN 4+qqteB5bi31xpeUqzBPmWYNumBVMTaMwpc1/UZpXyRPhYxaPSmo9I5Sfmy+tv/UNT+V hyncRs3C02QV5/uuazk0TNYAtd0klOylb70Qez6QvZXZKOnRyTxVZsPj6K1IV86I0dxz Ooy6M72QxuoYpLgC9s3vEEe32hoVUEvvvgrQYJqmN6gjEE03WwSs0XDRAGIGudzuLZO5 ULaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=114WxCPFVYq/9aNJyvsoT+DqgQkST53BKA2/YylCI0U=; b=ytD+dBJSDw9quvTS+RulNp447kMmiSlH5orqT1YY1xDUTvhOnxOtTv3rpw+YLSnqw5 eBCSgZUNkul0bDbMdPj3Apbb1FctinxNe0IuLQwo5wMew5/V9M81osoapyWB444F4dyC ETZfast3INEqusaorXWk3sippBIKzEmeAybhTq8AtYeDBeRFeu75vsgAPbTaDeNcyge7 y7VAdU0WMO5row+UrxpogvPQ+bb2WqjT7ZYthV31+5pufWCmc8PUmlTcJl28oy4gu7sC eTVq4nwBlNX4YywvjtDvG2fEqe73zGzy2P1ED/FOzcNnGt/7OKVnfgZZCDyHxTChxAJj GJbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JFM6cATv; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a635110000000b00540ca2b00c6si144943pgb.733.2023.06.14.12.40.41; Wed, 14 Jun 2023 12:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JFM6cATv; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237148AbjFNThZ (ORCPT + 99 others); Wed, 14 Jun 2023 15:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238164AbjFNTgn (ORCPT ); Wed, 14 Jun 2023 15:36:43 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BAAE268A; Wed, 14 Jun 2023 12:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FMditC5rSAywr57d43fuQKCatxZCBFGaaWZ5lDbh09vREWLZ9iY7dCf4b8F5wf1+bx3QCBt5AzjieuHfh9RDdioaTBcrF+j4uWdy6IGadhcSqn6F6cgO9Q4bR1ZNVtbCgCiRLyHFYZ0nVIRDfO0TnLergQ4lSyUbge4JyUefoAnknWvJkbT0+GhLxt8zdNDIkq6qSaejUS2cAbhv9SMPVWsyxE1sqU6fRX7DYl2ViBv98WouILJtd7lZX7mkNxffzhPlTbRZuw4Mq6JAx7669Y1Z1w/+o+S/db7+Z8wLEfRedULecjKSe0YP6nmSFUgdLKXXIJKwgdaKUyvfei5DzQ== 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=114WxCPFVYq/9aNJyvsoT+DqgQkST53BKA2/YylCI0U=; b=lO0OiPw9G7/a3uYkKjTf0SvEYSJCVep5KQNilD5bB/PzoTK7kPN7oYDXf2DHwlfHVSm+ys3Snci+ftH4rZFKowr1D3oMWZlUJCIf9S7B91NMJnzRB14uOpzYnj+PDT3opNUBdD3pL7MCinvfj4/PHjKm6pYhWb2l5c/5IES0+U08r51iCunC74AasdlPET6TXLGrg839Ruzy33qkhNpLm3oOD1xnHpmpkrDjQQ5XwWP5DuM2rVzC85C3oGvrZVIFSfhVrJjCRszu+EIK87Sa9jXYe+GcFoudHr1saR/EPEbg2uMhAAV2vFjTE9PorJYPesFws6vpsLfuhVX4CWSEtA== 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=114WxCPFVYq/9aNJyvsoT+DqgQkST53BKA2/YylCI0U=; b=JFM6cATvldSzAIEBDkQQKrS2Ne7TjvwUuHqNDkY+3taw1kfjcQU5bnbFMRC9OCXDLOlErbnJOucm2KxKXrdQjQ55imoMqg9819L4MtMb86LtCmfA54G3FJSQiW5NauQgMNNYNvjM+S2Ues8ZOZa4A5VCWD3QRlizNypp4zhjSYY= 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 VI1PR04MB9763.eurprd04.prod.outlook.com (2603:10a6:800:1d3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Wed, 14 Jun 2023 19:36:33 +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; Wed, 14 Jun 2023 19:36:33 +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 v6 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Wed, 14 Jun 2023 15:35:44 -0400 Message-Id: <20230614193544.2114603-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com> References: <20230614193544.2114603-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0051.namprd13.prod.outlook.com (2603:10b6:a03:2c2::26) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|VI1PR04MB9763:EE_ X-MS-Office365-Filtering-Correlation-Id: 11d733aa-ce2a-4e2e-6338-08db6d0ea8fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GVSjlbMk1e0HNGu0emhmTrWak9L1dT8oPXKzqGLC0UvqxwrtafPE35EyWDloKdFVjaWT0oFRcqn5KpA7HIfT4V+MQbaTd4g1gqqOhBY3hkE8Zr4VzMXn86CFsEoSpCKJeP9NlAoute8wSpcz3xEKxw6T4GtbXv2hOen5Dtdl3K5G6hUquZ3axRn8R2bMhf6O0LO0jOkMRWmqYcyQqvXZ6fkSru+JhPoFBW1QP1TIiLqBlkY+gEbYZg5ezDPdCZixYgVObhBI/yFZNjlec9CJKbqkH3BlkWo8a83nHLrc50sxsbUo0CobsrPSrBbXzwpdIFXo5PycyhWgBuhQTXhmSOQfZBMH4VpE+Fc5UiU2lpV09BppX1Zi7GRi61eiLx/yF2pHzp4ZUjXTJ0YVS9PxIurc7AwHL6Ds/i21QMwzr489xXXI/N4Q7CZeVYnt3a8FsCHT6LW3A70KwiqxXsvKjU8e/fyuihNh6kADLa590YipCci+AbXISnITS7SxHJg6TxiAlHVwtXBGbHoyH5BftPbhBlkhwKks2s5eThh3aqN9s1sQknAydyRTYl6vv4MIHots3dziJiSztOrT7FsA+UuuG+JGII+3aPTA3yKrUy8RE/B0Yp0usu/ZJGloQLAy 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)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(5660300002)(6486002)(8676002)(52116002)(41300700001)(6666004)(8936002)(66556008)(66476007)(316002)(2906002)(186003)(478600001)(66946007)(83380400001)(38100700002)(38350700002)(921005)(86362001)(36756003)(26005)(6512007)(1076003)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /ReIzDPaEkeEyH9sfSu+XrKADYn/9b2tNdBjkAYnuI4WyQkCqPdlGGhcQGb5vMvLzFe1q0sx6RT939jbw5GjlvbaGQKu4E5rEQmWZn5MBqeBAndIfzs87K0Nry2A0Pcg9JZV/hEEmcWqsqBdCKvRHr+CNP/2pRy6HhFM9A2jOkjnqSjPz1O3Ll7oLL4Yrijl/vEyC37PJllZkrrwNYhgdL8Ni9gTFhGd6dCiLSDskDSULQ7OHfdW3XxIL8iHyo4IXEchF5Y0AzXxSbmzpWz13oCpns9VMMyC4uJr3jnyBEhDk6sYp0YW/2A6qbyP8Vq+mwIkl9b6yfgsBhtIbPG31bfScc4aVWUPjStfMboFdqbqHFcK0aP2O+TOFa0ZRXbr9kMfyVJz6pY1YRaNdFcHR5q5u72zqYKRFWoKA4nXyu2LLCDhmqngS8MuBTfG3q1dCagOj+qfLCbQYOC/BJSqLkevW+Q5VP4KDgm9Uutohu3CyzAqa2ThAoapWJVqQ3QpNNjWIG7BBLDUmLOVm5vW1WIsXzpnXIVUfcgUEpQZyoxVvUPISP2Vunr9K+IpKvIsnYZHs2keoM8C9Vppk7MtsZ5m/kvZaNs+xKsrYcGg6gFNBC23xY1zfVXbWA53vIkcxOY19YqICmC4zpDIy4Tx5quBW6nbeU1cCV54TDoE8REmurgbqeGtVaeYbQ/y3foJP3iE6TbDpeFmddm/ojhE3h1QhFYptdsARwNjir3LLowUE7jSb8XXePoIvi7fz0+afdMoKGLPv5SjZZg62bntaw4SZiBy7FFr+u2E6zBC6gsUUJrHJr7LO3qhuOAOR65dSBZ9qBKnyeeDwJoLrxkA16Rs1aHkCLY6510ikBw43PXgHI/sX4IpP2cvWlx/gXeKN8Cq7MrPrPOoHKDPQgJvjMq0uomL5/DZ6mkWQZfhXTd50Twea+cUW1vOO+jqn7CHP3qszwGKOjZ/pBdiMrbnJIIBfBDqtETIFUtKGJUu+7T1Wqsh7CYHDzGHARc0mdJsQPX6AU/y6WjBeJ0of4fC1bpMpm+hFEFRPQXDAEip4gzus4f5fxH/JEyBhtOgz77LR/+ASSgS4CbXUMyybpreEunXWCh2WCg0GCT6vxD3d0DQ/rQSbFi6KqtH92eNVMHUlXVbTIFSGsmTG53LFLhCTikJW/rJEerKcG7G2FHALlcXPjC5Ii2Ff1lzVaOtq+Zt/lp3pd05HrGcTH7AcOf43wNN7qLBxmdrvcxj7Knwej+YzxA3qVKrJAS1oDto4bYQNoXcmTJK91AXRwWJqAaSdpmUAJNsDCkwtN2JBishRwK7ncSBvHROv6sgNlGgL0PVRHoztV0uoEyLKmcKWOWawL/WCd5DfAsWkGJfuiGR/TKW+IaRmGGivZFV+am0sSS3J2TVaL2GFq+KN7QOlK84l++KzTsevca+73g7feKbR43lfS0s5g5ge5EEFtXDww78bm/59ZsnxgkG5wqtevGIfIhIGdXkHiMtaHC18SJ/jMdca5nrn8G3bXr3pBFlOYRJa/ZQxVzH7TQ3q7GsOiMUe5M5Ybt2flfAOTCb6WpdS98= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11d733aa-ce2a-4e2e-6338-08db6d0ea8fd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 19:36:33.7111 (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: iyzFYGZDOu5SFgvcop8hwW7evPJuoaxnSyD/LLcXnqUw5kAZ6ZpCDmicDIT3BNxfRAW/S/QHajHH7kyqw6UFMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9763 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768708273630671686?= X-GMAIL-MSGID: =?utf-8?q?1768708273630671686?= 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 | 99 +++++++++++++++++-- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..de8c44bd8a89 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -21,32 +21,41 @@ 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 + minItems: 1 maxItems: 3 interrupts: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 interrupt-names: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 "#dma-cells": - const: 2 + enum: + - 2 + - 3 dma-channels: - const: 32 + minItems: 1 + maxItems: 64 clocks: + minItems: 1 maxItems: 2 clock-names: + minItems: 1 maxItems: 2 big-endian: @@ -65,6 +74,38 @@ required: allOf: - $ref: dma-controller.yaml# + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 + then: + properties: + "#dma-cells": + const: 3 + # It is not necessary to write the interrupt name for each channel. + # instead, you can simply maintain the sequential IRQ numbers as + # defined for the DMA channels. + interrupt-names: false + clock-names: + const: dma + else: + properties: + reg: + minItems: 2 + maxItems: 3 + interrupts: + minItems: 2 + maxItems: 17 + "#dma-cells": + const: 2 + dma-channels: + const: 32 + - if: properties: compatible: @@ -153,3 +194,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"; + };