From patchwork Fri Jun 16 15:34:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438000vqr; Fri, 16 Jun 2023 08:48:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71wyISkyMjmXqxnw+B/6Xzt/MgkXF7lw7CwZQK3dFkbseIxZOCir3nyqMyGk+Dbfr53Q3q X-Received: by 2002:a05:6a20:549b:b0:105:4206:7062 with SMTP id i27-20020a056a20549b00b0010542067062mr2769311pzk.42.1686930486279; Fri, 16 Jun 2023 08:48:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930486; cv=pass; d=google.com; s=arc-20160816; b=IV/meqnjw1iOdC19Abz+btDpuqw2tsr/qWaSrRiGtsYr51uV3JoyeWtfrNFe1E3DNz Hpx2Abz2pYO81Xdc7twJ5O/hSMvZv4/v9LO7/oLxdFKuvR/UEA4xPWjXwqLaLRIIrUhE miIsaqnVFtSAolNPWsSY+j+ou1P91ipfbBXznujmZt5BIb7vsA8NWTU/faeLxKwiorkj OrmzzKH1bVErOe0jyvRPIl6KIOXSUoFecaPE6MmSmWvyQRyQjNPLicvSgs1bL0GKswQD ZwWPWvGAS2ngSHNaX7gpTimF4eypqYByoOe/pgl6adGFqpaEnHqlAGjiyxPfYL35czYl O7ww== 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=OPJ3t8iuLx0B/Z+yyrYBFMB840pGhToqiXmw5RxK3D8TLLGLPOjdOu/54glH276Wqo y6VRib0eskR60B69eqtx4T9sGuiShlTPHANloXS+W8/08m9cgq4hUXV6Xy6jsfm638EI UPLXtsTmO+2ndBvA359eGOF2ks2VGlsVOl2oWdx+jdZ2EnGOYnXGVQ2aVw4zvqv/VP+I Z/ohPQSIPGheRvfgYMSWlKbjN9pjm4NhhqxeIzqILznFJsrNA1LC0+qlMXM3w76RTAka x4zYm1bKQw811jzgY75t4DzculVFOktMINIl3I8YjX16OBA6qy0zp1BY9lJcWjuIft8j Criw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=qeRKCRIj; 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 v135-20020a63618d000000b0054fe4cdd1a7si212860pgb.716.2023.06.16.08.47.50; Fri, 16 Jun 2023 08:48:06 -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=qeRKCRIj; 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 S1346024AbjFPPfE (ORCPT + 99 others); Fri, 16 Jun 2023 11:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346015AbjFPPfB (ORCPT ); Fri, 16 Jun 2023 11:35:01 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2044.outbound.protection.outlook.com [40.107.104.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F4A2D43; Fri, 16 Jun 2023 08:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kojzKMBhD/0VINxI27+lKOaxQPOqSbpqtHMnw1Mpt5ZnNcs5zroaw0g91A4/r/TISEkWtmrxQxLbBQIYd4ZaYCciBzuA2qoGite4E5dJ0D55F9nLPB0QpD6sUqhUJ/Cmqdkred1pUQYxfCik9y0SRLfR7qbZHNI0rhJTntKptvhbAGF8ghaqP5x2+0lSrnRq7rOpNUi7T1PEkwGrxsFr8i7oMhwx40g4YVzAoA8EX+PTyI+eejc34fWHFVw+ucwMMaja5HRUP13dmkc7TlEsm94V5ighK5T+DdaTRfvBI8o/+4+v2BU5KGX1Q3mR8Pg7ceX9uk937WVn60Gl0WvtqA== 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=ceUL1r0QOP/uDmGsC89/J6MoNqMw/WpXOuJbS2YQVnftixCEOLdm6P2TUK9ZzH2Ea0serfRezfkstmfAd/74MFylumPZfkyDu+G2kkGZV7hI7ZKgc7ETYsV+qbB6Ci+wcRkkOeG6fkrbqHxWrL6yx2osiNMi5RQveaXoUitxI0BmNx57DkJCvsYB38UMGVjzWWWfgXV3nwowB+QQzO40DFNMLlBpxjOjI+OBTLVJg95tyUK4SnfoZVTAXvZBV8QhSAD6bY8NXSU54jAwBGQewAobnl+aJgTAfkoaJzpmWSlhfkaDKgsNt2KtgxgWyOTVRiwJx+INGihDZ2VPRtahWQ== 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=qeRKCRIjqFvOhrL2dLbxQ2nvy3mROeuBTN7Fc3wxm3wOPZYI04GTRWLh/p5mMQrpVEkHMIha77CnKrCADm8CTQoj45VOOEUCt7GekTAEQ3c4ZEy7ErjY3DTYX5qZ72wr+G4b7dvVupRlNu8L7Z2Byf9eVI0Srds7bQmOdDkkazg= 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 PAXPR04MB9644.eurprd04.prod.outlook.com (2603:10a6:102:242::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:34:58 +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; Fri, 16 Jun 2023 15:34:58 +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 v7 01/12] dmaengine: fsl-edma: clean up EXPORT_SYMBOL_GPL in fsl-edma-common.c Date: Fri, 16 Jun 2023 11:34:27 -0400 Message-Id: <20230616153438.2299922-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB9644:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fdd037a-bf64-4c7a-7342-08db6e7f3e18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tsDaSfT3gdsc6N0t7z9/ZbcHYu0TgAheqPy4Sf/flMu5HWJPnIhcNBaSad0nKfvMr/homf34CgCa32tnLAZ2JkoCsvpdUAd1U5Fu4oAk5OTuG1Ws7JQ1FFUCsQzXnCJ6DSCGFTjHC/mElRiR/yl5tTYF6GI4IZmkrIi/jhSG6o8+OQjop+4yRxyLlq2ar7FnUbUF827CCXaXgUR2h7KLiQNKux0jkqcyOFoqDONqwnGdDeO0mhk+A/3Qd6Wys2NHolR6t83zJyZ47kSDpj6i/PqZ7ips1dsf1NQH3hCZyDMwV28MGcNKRpJB0MTDfAe3dx0wqIsC3KhQZyrK0UtkzLo8Pd9uTbyegT4rwHhpSBfVGh7LU23KlN2qZq8ypRbnXi7TPjSjhVDW54BP+AGiSCWPgVEUdE6ddCvSbbz1nMKGFqawKoQOaLDWaIXlqRN6xD7Dlf+wK+aHw0dlIh0EA2yOlSodOWYfbKjkw0j5GR7ZmYyHZYQR8ThRJc3T5mVSpQC8/NF+/cl6dySdvslGwPKICZQx0zfiDvNVl7TTn2n+enpOVI5xEhQC43gkN3hqUY3lPojMgNwZHzX6IsBFn3iRFj5G/a4WkJol3mG8Z/FpCI8dFgDFrRkYxm70t+Qfuvj8BXaiSmbEAOA2r1lv9w== 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)(346002)(396003)(366004)(376002)(39860400002)(136003)(451199021)(186003)(38350700002)(2906002)(38100700002)(86362001)(6512007)(1076003)(26005)(83380400001)(2616005)(6506007)(921005)(36756003)(316002)(6486002)(66476007)(66556008)(6666004)(66946007)(478600001)(52116002)(41300700001)(8676002)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CnoTYhwtz5Ix8P+VMXzQBxVtIzlhVE6Cmd7de6di6e6yfF+lPTl3JosZaMCskO2PUeueVE190AIgVGsDQmjCQnPtpcjlf0C9E2rrZ4AHOfkCt1J00w7BS8T/203UGQj3SWBwmWDJjD1Hn7g2lmFQQSjoZ9J6WUZ+MTu4Ynf19ug8rILzIr75UKcCzvgQjqpAJNjyQ1FPukY4JCK2KC5pW7rm0njuFlA/hpyc7x1BFZsZY8fqQ3ryhBqK3PrIsSIE2WOmATwrnD+gmIH89U6LQr8DApjkRWIQf36FJtLdVKV63y1EOcQ5LUBCYnjyeLImbrcFaNwrZm53tKVwWXcTI/P3mrMS7klPt/qMB3CiCysuImfUmdTCNPPsTIHKIIU3B6LdO4SUgEv+t/IRdjzHHWED39k+5xrfbeVEXm0ZVRsZhrQXEb5ph9GTZv9bMYHHKwtUdIinPb0sVMtnr/CFSYqyFYePmd0kBq4OZjsy54fyoiViy1wB9JqU55xx8gu+QukSGrFwO2yl7jyzEhs0XdPb6yJCqDcVHfMFieVm1EICWpGxJ3umcr2xNj6n4/DIPlqEghFCNeohulLNArtr4z3Hp/zabWsSqyCNYJD3BQnAHJpdgAJzz+NqxaUV6/KMW/rYkF1pbBGhAizpNqzG6nnostfoLI0Lcb/z90qHnyv9W/ubgZyTH1BVMMxX+rKCmaEq6CBBJcAjtex8mqfn5SlzMhIACS9jH9K965kZg9fXDM2X+kGhVxfMxHxGpwb01W580xmf6KIei9xaVlBiCcjyifPMsovQOshCJP9CLr1wQpOOYmOWR8XLt2zcZBnhd3FbSS+I9mNo+LYCrPFmNkgj7y5QX7C0ItMI0eAiet4TYEYGmcZkOVO3f203Vs9ZQjuThkSNmSzbtRUw9l/IfRkwqOvqixXZWGZCaAX35d7/ju0o1XWKtOp0tOlkUgJOpXWswWcMxwR3MKYz8RNGIZQPUdbhrPhUBdKfbXzP0Nku44OzadxVIu1FAO11lV4WxohGgfeOpScmC3nILeEf5tWqcQO0/xecdsotfFbfkbc1v9X2L82499GPMrqMWrjrdptAw8GehLmM9nsg4QUc1SILbPSS+55tTCZY1EVizwYEyp5OWG+62ZWFz2K3sQiu1oaZgGnvibpcwhhKhWWaoDM5KkJN2DWMER5bTrnRcOQun6voShyOINRMT9o0h9PgPFx1C9C0EdWTjWWcJCSHJ3N73Xe2AUiabNfr8EwlPzCNY3AYBCk1yBrDLx//JnOVNDFsAOeJRkbDXuA8A7kxAuMLC7M/yEWuXqv84oS+Iw+DNoxEKaqmZg0R31LK9CqDomBQ64SpEIwabqatibyOpV/Dga/9VWBKJXO5HBD8nV2KZSYsd9y2zA5mNIK7M7ml9beQvCe63CQFqWy77mjpmvnckjrKPRVG4otnJceCCgLwaXk6BtVkTsP9v0EW1KS8zbWrAn0HjYOEUCCOvybM15Fx9ajNANA43lzEps34wVmAKK8lpnwVsFNCYkFdYoL1NapX9QIyAgD2sDAWM+PYPnx1JcvMmxfTXWP2lMaglZk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fdd037a-bf64-4c7a-7342-08db6e7f3e18 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:34:58.6313 (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: qUwClB6AXRNZ75OmQ7y8nYCmzyvYhwno34dHMt0CoNE8ibAMYLeS/VRbd0IA+Q6pMveDAecxdN+ZWqH4qprEbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9644 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_NONE,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?1768874821379656178?= X-GMAIL-MSGID: =?utf-8?q?1768874821379656178?= 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 Fri Jun 16 15:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438035vqr; Fri, 16 Jun 2023 08:48:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4eW3xAEWiYvc6P7vxqU4CgKNs/WbYoxw29vVLOXJAc8Z5hT46G2hW/yWEPbYJFKNHDO1Uv X-Received: by 2002:a05:6a00:1515:b0:665:bd58:c948 with SMTP id q21-20020a056a00151500b00665bd58c948mr2603598pfu.8.1686930491072; Fri, 16 Jun 2023 08:48:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930491; cv=pass; d=google.com; s=arc-20160816; b=adbnhZtuiFXCRUp4oF3DvQ8etY85XbxFrrvLjlKsFe8Fit9w936T7P4wkoE1Jtskcp AJ2/+hyUWKjtnBTmLUK8f1RhchCPT2R22Wn/+aOclSa114bTjKPWjDXwyDXaBvIe1Hub JPeh+mLovT0Hj1rtMJiL5akQ/8/aLCAK/C6uOTkoSMxSfGzFnf56XvKGj+WmPhDkxEhH eAq0LGZGHJ6D8ELw0T+dSyQIqtE8279rSIAeLKJ9JjmV06FabHVWb3iF6Uo0gZKx361q rTojTauLvfLeH0CxPpdWnIwJ+cis4+BcAWaD7R27jjVQ1FTg6XT6Cz+8i5f7D7NqX/KQ OBUQ== 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=TAIBzZh+pmNqUXMCOh1zB8i27aaDItgWuFILz/53e3d4qDZi4w8sPVjJhstYUbjaD9 7ERLyBe1DQHbH7w2KXRei0t0F7GSAZ2uHuMv/m9ixmioeBAsjqQsKDi8u/TnOIv0BlM5 5K14zT/SJczIB5yCl1EjDKbiRBBG7fmcXMpJgrJkJZ1KkOR3WV9eSxQto6p7xcYBoB0V OWNqDbOkBE5FvBwbSWNoynmgHfa9bl5k1aOnVbhYXi2TkFAZM9A8gzQLXevTYnfNZbmj bp1r6vsvm/BxappOGyxmWbNuXS/SkIl4LSE5Nsm57SeAuTlbGo7XyU12Ul6vMPJ/43dS Dtew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=iQ2YMtrT; 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 t3-20020a639543000000b00543d2bb4297si15085980pgn.743.2023.06.16.08.47.57; Fri, 16 Jun 2023 08:48:11 -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=iQ2YMtrT; 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 S1346040AbjFPPfK (ORCPT + 99 others); Fri, 16 Jun 2023 11:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346027AbjFPPfE (ORCPT ); Fri, 16 Jun 2023 11:35:04 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2072.outbound.protection.outlook.com [40.107.104.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4D1E12B; Fri, 16 Jun 2023 08:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LDVkV1rlqi2KxqEQ8uQpTkhxmoKppcq+a9n24ixrXSXPYKeYI291J4XoD3XIRwazGmSVQgodE6rZfP0+u3FhxYHNbHzc+Eknz2Dp77XX0xGWecxG46sNUmkTJgrWEjgOk9APU1pDLl0TWKwnayhntjnE8VckJmcqpXbgOpsldszUHCB9nP7IzKbeyFbx13KLOLe6LNjgSvBV5zWBwBQXYnwS4qt0hxXJ/t5bVfyPG9owRGTLvhTYEU3e2jIOzR7j1JGmJyuauL/6d9OgRb1lerNCn21CQxBykaZYbOHWXJfh/NzunWLn4+v3MGy+5KHi1hG4ZBaot5e/KuUfQ6HCfw== 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=m5lbo/sRwnjhmgnT1ue5Radt1LLXigCE7WWZVsTBBIfCtg0VnIYzQWoeEj/y1SEnr8fMtLA0svBU5ZHDGnQ2KgwbRvtle64Y5V8PfBL8nhFrMsU+yMxmG+gpGHIbuXZDe/4cLMC0iFoP7iGyXEZ8uoR0hdueSrBQicKOHVMCsDUBpfUjwxytFv6jWofAMNICKPdlSFbumfzLmWzC1bvNlRldf4QFIjgWBz5nR2jrTEGOqqZa9jyBWDD0kA0tfBL/+E6HNAzVoKCd3Rx2gRUyTJVlaQbqRwCrFvbyO852zK5AnU8Xb9rpQwAzDskpfDYhO2LmVBeDsqNNVEeeJA1j3Q== 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=iQ2YMtrTbcNXjbavUw+fI8vFGFYEfTfXzMfWD1+aCRfhZqIYA+pmf846lsIdtF+i4bJEn0Ab9HorpK0pFxTQ4gWMs3K0H3MgIXkXXYqyzyoimwnIik9JltfPLmQY7GXECovP+ULXnIUqprJPIfHuNhQu+ZOxyPEHdgMuSZE43S0= 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 PAXPR04MB9644.eurprd04.prod.outlook.com (2603:10a6:102:242::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:01 +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; Fri, 16 Jun 2023 15:35:01 +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 v7 02/12] dmaengine: fsl-edma: clean up fsl_edma_irq_exit() Date: Fri, 16 Jun 2023 11:34:28 -0400 Message-Id: <20230616153438.2299922-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB9644:EE_ X-MS-Office365-Filtering-Correlation-Id: ba7ab457-1e0f-42e4-a764-08db6e7f3fb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Irl9V16K0otnvX+WDmL3EcBbPryBsi6zJpFAdJh9oP4xUADU6xy7mUjAldndo7ixUqWLGSiD2HvVvTaZnOFfadxfK5GC2tlKD6tx3JyxydCAnnl9wnOMcEfgwsvhYmPzYJb5OT+kTZEHkW39IDMhf0aiZJs+FImASZzIaToDyISHw0EYwStb6z8g7zHtMTvsHWEqtcOYANj4vaS8SzdTKLEcaGrJtVHdxkcox85ev3omoQQe+6N7U7KXN5Id4xZPIA0NaNhKwSYDzp0AJizt1nSJaUIBlctJi3IGV3bIneUUa9elqoyraojD7F/Dwtq/4Og0PlrpbcetnoUWZMrrXAF5T4d9+oRg60aPIlMfs1UcivSnaWInAwhEoYejy6J84tDfm+SFR8S2UkT2TWqBibpRUJwecDqBZWAmoRQug9ewhoVNeaOkMoZQRFTyfEwagxqMWLApFKfoZ4+kB0G9nTt60mgJe1dgXfaf26CZPgrzqZLA+PDS3fgqIEMPWikAS+78t7F7Jlob0BEoeg0O/VbaR3YifpsSmXMgoStbJmV4q1/DGxIMwYcMBzeYlYOomTsxnVRUipQpvCgdbNhIPVzHCiwCgCskA5+EKnbCPEo/eFCXU3Gw7bJQxRRo+/C7mFhuA/8ND86w+sMpu58Irg== 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)(346002)(396003)(366004)(376002)(39860400002)(136003)(451199021)(186003)(38350700002)(2906002)(38100700002)(86362001)(6512007)(1076003)(26005)(83380400001)(2616005)(6506007)(921005)(36756003)(316002)(6486002)(66476007)(66556008)(6666004)(66946007)(478600001)(52116002)(41300700001)(8676002)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8Lz8HLf7QURGzVt0qduMa9TNy+4n0hmwfLtD5wZwV3K3jDQ/qhO9PwOmjUDlXSX9hjUsVADxfhdr3BDUoXvfMi6+lx4Kqk2MuzvYeMmerJ9RzCd208zrNngkvlva+BdMFt07cBAfLamOpHiuOcarB4KtsM3WOOqNIxitm/hOlhN5KNFi6XCC3vAZlS0CjhRbEbDSw0kEN93FwQoJqSjgnmAgGInT/a7Y3qH8RVGaG6JXl+ep/PLs45HhtKto8KtgNcU104MZ/JuKS5xZOdd7EV1Ess3tv12E5hmtWJ25zBv2xGOWaACLojmKZH7roI74XvPKq4hWPQ/f99R0uvoQOhWxPaPqrCkoxUoTe9OoHedqfZdnIf0BWxlJNULXfoVd5Uhb14XoM0RQ8Orr+JFqPx30Dj3DdwSPbh1ZwUendi2VKc/Nhe86y97L3udQpSfPAuA0Q6l0ZTLJd5dRfe0EgkWrKvvUKxGKqoAuU8wtNpr6pwE9nKI4M/muCRquqj9GIAkJFWtk7Xu7q7Wo2WnhWTqgmg0u4kqCgizRfmSo/foiVC2YYwMvRaYmAoPrHed5fvMnSuvmfQeyfc6iR5W9kmOzw/7RLEiJ6fpvE1FSzljmOeEZ29BIm//4jDIqf5L9VfJdThuFj4MPlAaD8BdVSrSGZNyTaOyAxn4hthE2yDwiPWoF1xLwaQyPymP+qNxTiIZqN9BFXCVa3Uy6Co8AdK2IBql5DNakvrvgo4zhQzH8T8D5hBegv9kd5P6bV3W4Dk8kFShBJHayNQSQhaltvIV49aYR6RzHfftlqUSlqwLFg64YmdQKYHXAar5wmGb+2AsvvMJz/ofBObjUZIgpeXW8bqgFq+EiR2FTFdAOdSP4qCmjlGwKJhJEQmzy5+HFNTr2sV28/uL9oOEBpHJrBAxjmajLgGFmgX208X3PkNnihx/fO5x6LkCCm6tjkRWTXmQl1/J8SnbNWzBBA4/Rgll49EUSOflaj754k7/IekiCM5pAeADCStMIBPkeyAqTjuv898Ki4iZKhnjsQZxFjYHiZgNF3SJK0AAnjm4f4i92DfolcfatPeoTz553TIshfiLRhxe5gqJ738N19JXcZ/H5REAJ/+enJ0ZV2sVeWACi9/Rb4VBiqLSoO+WYm7aEqSU84UMkegcvdnGT2mO3IuuB2aZn/QABTv5Kz56yBam7eIAu7LCU5X4qgVJ7TLdAULXi6chFfVv2IXki8fAvrB/F8DfeXg+54BXzkTixo3kZk11bGv5QTPCuKXh8yaBHWLHZd26jqd+v2ujaq+Zsc31qYxAG3x4opJQRrdewvBfI6RFDRvScBodYGO0lKIZObJ7IfmYHzJEXIoGByvVnF4e9wkXEGd9zbWmXiQ4VSpOYl0l7TkiU1n7rlaYW8yljwKPRGpR0QNxFIScQHtyIoL9FYaKAj712G9MU1b54rEdWj/fzaj40h/QM6sCfpKCh3fVOcUBTNuWDW4dAjjLOCXqh1vvTdXflxoILgovOzAfbt3/rHoHEByOmrTtbvYVl78El+a8ZXdMjB4o7Kpppn2PQmH4xzG2vI0ll9Cb6Wlo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba7ab457-1e0f-42e4-a764-08db6e7f3fb9 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:01.3870 (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: iTvq3xXvR4ZsmgsiQeyHsO93BHN2wy0veH8aVzRyTnPwopBXABzsNCCKg0HqLIJ612qxLicLUnJJ4r939lZ9kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9644 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_NONE,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?1768874826726255231?= X-GMAIL-MSGID: =?utf-8?q?1768874826726255231?= 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 Fri Jun 16 15:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438066vqr; Fri, 16 Jun 2023 08:48:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xQntdC5t+WLrqf3//pMHkcc9yWFBwZ0F22IMJTdLE5fcb6mKZI6zZ2slNqwuFzVp7WrCp X-Received: by 2002:a05:6a20:c1a8:b0:10f:3fa0:fd8e with SMTP id bg40-20020a056a20c1a800b0010f3fa0fd8emr2575081pzb.27.1686930495149; Fri, 16 Jun 2023 08:48:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930495; cv=pass; d=google.com; s=arc-20160816; b=XJ+r8mBDSkiBmWuRmpaGPzlA94kwa7mWIAXoDDzvZqb8uKaDigfxwaXm1yjv7bKAFE Un8I7qzJL/e93iuAgupClQLvu9EBn7CUGjwFigl+9HC+AYnKEaolWFXxgvOPMF/L/leh YIvuT7SgbLbvYM/3nocS9JPB93MurrxDBQBNuE/Ir6HRC0kmQd+1fwRSz80b1Jasa/yZ BF4yKa0H/gA5ldXRRQ1iB01ZR+/1jE4qgCqFSEOoUXqB1MVVXewHfzyeao896FBR2YML L5/YvvEzJDQ6z0o8rc8s2p66lmSn/lD6jQsjQtTK+JImJVQwMRwwihNmGbpTm2UoRpOh Gvbg== 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=eYUTCJZ1R14MoLLCBWFrRdYLD/s6EtHQa5ZDJy1CvPT4KwkcRZe5vGZVjrfzLckdkf xEfJg+Xa+BKC9//8v9QFR0BA9p/jm+q4pkz9t698AddD1p9+97zUSy0EAkCKgGC9w6Em U6okMeS6dc1Nhogr8MA7fWo0CGAdowRUyzb1MKs6MaCulnOY96QM8ee3nqSkovPRL8P7 LIl68X3HXuVgB8mDymHZ+dPWacpSZBj2W1yTwByo5KjQspc6v4Q10dx0rxwc1upJgBbW NbhHEfn4rqdvZ6QSw2ksqX/f8J9q4J9n/VnlSzjmxs5ENvgn2V47GBXzva3h+kNU1ZXx QOZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=H4HECgoM; 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 n2-20020a637202000000b0055379a7131bsi1449130pgc.428.2023.06.16.08.48.02; Fri, 16 Jun 2023 08:48:15 -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=H4HECgoM; 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 S1345854AbjFPPfP (ORCPT + 99 others); Fri, 16 Jun 2023 11:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346015AbjFPPfL (ORCPT ); Fri, 16 Jun 2023 11:35:11 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9315835A0; Fri, 16 Jun 2023 08:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hI+v5nETUDfgHIcyeLvwAKbD5XWHL8SS2/Ui//pxsCAaswUizrsBhPOYjsWzv/0VT2i2gQSo7gLfetJUA5qdbmINeCy4pUJja4ackvzeiUw6bMeAD6QstKH+wyDrayWd8K0zAA5Dy7Wa1vs130dSER8KFeHIgVoVBc1B7mAef2XKvPD/TP3OVSBpc40E6Q7/FkRemWIo/LfHGq+TC1T+Tm8wRfpr5YDB0wV3WB6mJk4XzgpP9UpOKLjlurn7h1cDQmZhSlSMeOqHUAejAHVfLFiJywMGHIyEVgByVnp6U7H5o9z4yfS1btuQoJGnYMGZicqkPufU+LDaRvrFCbRLKA== 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=Z5N6OOn9TzrJTGzqO1bHsHx/Kdl4QGasHQ9uNMd0VO4VYVqIEWubX8aFd7RnaibqV6p0wzT4x2aM42RuKFm7nwE5pzixX2GaLptk3nq8qCLPxqugmlpdEF1pyufb8cx7fo0B6kp/02ajBYcHxSOYkQEHZn61M9L95pVE2KHQsks4VJsCnav/cIFSNzAlIvYpkLVxD8OU/vMItrUAnBFV/IfZfYt7v7lnGO1D9aFCVK/b29Abbzzgrz5lQjdN9m1+RWpcdUPgeW9ZgQS8XbO4tUe/KZSYs9uKUy0ZaDEBvdLKZFRo+h8Kt7cpBTPnSayAEyeW/AjObVZmtHqYAfB7Mg== 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=H4HECgoMZoU+OicUH9V5oLyBFvdS1igiBlEZiWbo+9SUhCJtZ2NeiUYLZTO1UZP7wYyg3+Je1UKibXYnwcez2pFL+itQij4prcgn9BqAlOhYzmxHw1nk1p7/Af0b5KtX/MF/4IOJnp2PCGDuLyYQK/IhIp0IBCFcjVqDTk0q5Rg= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:04 +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; Fri, 16 Jun 2023 15:35:04 +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 v7 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Fri, 16 Jun 2023 11:34:29 -0400 Message-Id: <20230616153438.2299922-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 27e86d94-b88a-4299-ede7-08db6e7f416d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SCf2zrnbiOrqqSStCKqOj8dDjnv9RVZMlehuo+nrt0LzABxWJLAqNh+v+FbC1pmqYfbqadIbQqdyvpJFlES+dffzZY7Hctq0s/m/b+eXky0f+FkoIAI7yLGcc9fMPbOu5Xu3FtQL3PSUhmX0AxNDRloVOpEdDj+sCrNvcnHQKH0MX9DduA4nc5WFNjoWsu4vYXsNCrd9lpl0LnixRVHxGR18w/AjhGDRcIFIh7omnHip1yO8llAGGmqLNxcrLhntnVvKvOfAUxjpxmFD7DRCQ8NZagwjYWfkodcMaEIqrOtgAef6YHZUr6kYRouGHjETDppp8QznBV7/UXje3Wt8JTift5yxZ1V5RsYsiIbxEMr7aY0wrjWuJiPG9yZVm7R4ujtC131wBk7I+twTN68GO8sE0wwPmKPUU6U4YC8w+D7AUR2uRMY0xaMPebyrHX0lpDbRLOYz3jPj61F6IctSwkAkcI7lCIoAPW8Eaa2AauU7mDoT69h3hI/50Ep/4pTa91pNNbDngnz7BQ97PpzZdrhOuHArSrMot4ciOYwXwhB2yLmfzoGgkZudMHyKpKJfapYsln0joCKzuE+HoTct8snEcCouKCN+P+d+LqiJAJgPAU7aMKU//TsHHanqrt9Vg7gieFx3PQxI19Pt5LHHnw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xgMoei7UTXlfF/jOg3+wRyvIdNsSXpA9KSa7kPWTi7q7nkrU5ma5Zn8q0XAincX6KsSKkcxLo1L97L9qzcZzvEXWAz7BAV/nMUYjH4vX1ZSzOrIXUBl82//2C2vRkdir0TWW47x0eYOm4pjffvSwg0w5+ppazXqXujfR3gLtdqVk+w4sQHrIy1MEz+3HKhVYF127s6IGtYeHrC5F5U1hb9+315/RrLsE9mspMfDPTg32M4VQ6znRc+ZzeyEz8hDLFjkarrVRlfF+jvL2DVXlJxXbA79fpRgJa9GkhXZ6pFwYcjm/g+nUwF+HBGeDG0S0zPJOJLPmnJHqXXUT6OaCk+5I+7VkXzlCMNx1vwv+ioX8w8uEq5THErxO6VkN7I0+RirSpF0fSsj4G87uO41TEjhYyrfWlprLfOCpNNL2p7u7TBYH7Dnrhn7+3I0AuqLhRJDdK3lWGD1m2taohdOQmF6a7u5SZBumRHK9J4oajbR6JjytRB0e+1D2IysKNb4i2eP0ZYRRCVCwZ5aXMGItu90DBf/ak7W86FEmZijAbSgMqqOUE5lCcDcLlJMw8GXh2uAAyI/8e7gqhj/vy/ZbFR9Dr3VxCsCIm6wzPJqlEM42w8Cjhn45iaJHsWpaXbMss5FrxM6kGew0QzJ3HbpZaMSjwtzAM7jl7qSnXGJ5EQ8t92bIoKMFBZ2sY+GzyQL5aQs1LS+ZT/KPw4GWNVPr5CRIGYAy7TB4qV+xFHaG7DWbqVRVeXNUVXc9b9d2tErUdhjv+j7ejs8M2Kj/E3B7L0mATMfib97JXQSY8DrJ4k7H33zjbJ2en64xmHpL1FU4yw7uwX31hoKwNgKixyEZ1df5I63KpeJVuqVYnaSmyTm0ahE9R0p2juHqWnytXKcP03jUTcUNVx7yB3oGHt2SiGHDsova85Xdw5/YHzMYOrlqz7veC+11RMZbs4r04Mz2+MJb0OciAdCqk9fyqAXFWekzcjDAMp/eWp6o1cGd9/U03XIoCcBKSAX4mkn0o2huO8hOQz1aqlDT1B8DpucnJ2BxWN8rm11yMq9BNaTANVN2Qa0B+JZpfRgO1Gm3MgowBm8pzXsuUOEyilIpbqOLMeT8LO3MqB3M1QVn56kOlzDAAS6p0PQkanFiFHV/1AwhgTErt9jI+cRBooU+IasitzJjq454iqJkhfMIJRZLoFlcZwYDFX3QkJLVMko6XNUt+ejbC8d+V5KQxSPb2SXrEhajwqOfF5s5soEcMgc6YY9LbF1sB/NV9QTfwVWnIlM9uuoSGsQCTEAuYB9Pc9ot7ItX6v8mH58ihwCuZkDGEFe6A3yrlZGcqOfGXeFstTEHaoIx2z90PtvclyAJw4UbIFB/iSgjsdTBtct5R1w9H+dnbrpOdr+QJlCoFGVaotJMmi0VGKBWv6XS4bYqnld8veF3L8qN1z1zFv7Ieo4/f7xbKMLxH3mDCG3/Xk4Bcjhpq/ma2pUbJvSHi5A4Jl3ZKTJaeOYZsz/GOcfuWetRaXgf70zsiIONegcRM3TZpcHPj0hudzqvy1aJ4RTGJS7u9Ox7BkgAjOXRzeSLBz866iM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27e86d94-b88a-4299-ede7-08db6e7f416d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:04.2421 (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: EPYewqSnELxkdWqDnlZovac/2aHt4uTg8hwy2pqSTSVBQcMdvHV5/zDEZo3TI2Xc6apSLQHFkzd8AmIogLIO7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768874831089063058?= X-GMAIL-MSGID: =?utf-8?q?1768874831089063058?= 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 Fri Jun 16 15:34:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438191vqr; Fri, 16 Jun 2023 08:48:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59ZSQ/SPMGmDBQHo5hZo24cXQdf+ppMFwwwFNm4PN2QswxWPtpilGM3mv4BHWlNKB+2o4o X-Received: by 2002:a92:da8d:0:b0:341:dbbf:af5a with SMTP id u13-20020a92da8d000000b00341dbbfaf5amr3117029iln.8.1686930506977; Fri, 16 Jun 2023 08:48:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930506; cv=pass; d=google.com; s=arc-20160816; b=wM3Autuz4T9O9/3vqGMJU3H3GVSyC8pKdgG6cXkcFIM6PglaNNBwjjJafrZhKZXSpC 6FwXjpTgDuoUvoiuQyWCI7lrpWydVOKRo3Ps6yfxfZYGAm+f8eIeaRtPGWENr5u/VJBn emC/nVlS/qvETGVqci2RYtRvdiT/jvTm/689/zOpDVn506jAuEppV361ZGt1FeHj99T5 4tNXXUxAcEy9Dm0hYTl2+G9/4zDQVGgK5KhtdXHWLDy+sVQU58+ulg4iTJwjzjBfVwGw GJCY8DkB+0pbg8Ub/uGst8IQbgUqG8lzqfLFzRiIeSiTxhu25V88ckT+OEULEuQLgoTS MDiA== 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=p0bvyKCf+jTUVLaKItnhHjDX1uNp1C1qRJgeGBFj5zpcji9ttWEkjbDh3JpGok5Lxm NWYgRy6zEbzeg6TXTFdEi9OkTQdJcfVbXEPcU6X3pbiJzssWZN5bJr3Dt85PO99qhZqP a3L2LvnYL6exz4PoQHJ/UnssdV8S9D3N0haxOCqh8z2mPbGhywneXuiOHx3sjjLZcq61 fJdG/yHNhZFVoZjHKOlV79Z7lui5QqTuCEknWu2HosLDun9ljtM3GlMdZIuGQ9YbXj5k vNXVyDtov4lRWW40zoM2f+JOf6K5Gt/bwU54WfFl6rp19wd972/rmQrL9Ilq2w9W1nyx THJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AKXPize+; 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 z12-20020a63e10c000000b005538b4e729csi35874pgh.171.2023.06.16.08.48.14; Fri, 16 Jun 2023 08:48: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=AKXPize+; 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 S1346029AbjFPPf0 (ORCPT + 99 others); Fri, 16 Jun 2023 11:35:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345789AbjFPPfS (ORCPT ); Fri, 16 Jun 2023 11:35:18 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A82030C3; Fri, 16 Jun 2023 08:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RO78FdRPW+2XNwRWeKDLRsHrpssHRXS4HiTp3xXLYV5/Pb3zBQZB+qEnCiV8LJoYbCma88SmElQAnJ1uS6iijWMEBXqi5juvH3Sp1qbCZyD/Y7Au3NNu9EXHskvoJA6aZ3m989EPbuchDsPcrZMcaTUbSFdWUwktXAja4RKxOHcATaU5VsC/ObhFv8y0zMCFjI94l8QIMeaApOYJgWE84KdGzx4HU+Ub3N4ipvpIsO8cT8iFwckmQK+97miwSYRwJZ349QHHbMBbLnleShgVsh4EYrJa+OgIg1WiaNgDEy/CGfPyefO+NV4eN4qKCXwOhYTnDUgmejFKGG+YBXWeQg== 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=BmKecR/98jJGzCeD8JQloMFAHlwcvuvlzUR0VxzcW94pzqKXZtWIcFRE/1zodici/h2d3WOMEZiAmhgEwfNiUnGx9WjDWxa8ApKy83mrTB6XmaMqKCG8zPLQVUov2pjGRSTY21IEsAwxXbvvpU67h5Tw3/10+4T94F3EsfHMDKfpSMpJTfdzE3SrXzRS3sN0nWYUgdLlKhEwCW80mLBgBZnQpZuNcTHKMd/YfLUe9Nn6n2V87OMhzt8G1Gq5DOvgzW4RtqjRhXqudjuB4G7sMpM/qmN9pL7jbhgo3d1wxEUrlnfBu9feUKrdEGTcJB9e77/+GVW5EY1nje+RYoXSTQ== 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=AKXPize+Xwt03GQR/DLfNvrI4uZ3lz14y1CzQRrfMA+MzRfgt7MJ6bS5mKBcs6W7jg1mDnkzizpZlHtpjmp8uj3S1VHRUHOCKvFJipgOVu4o41gEiVX8WuIfhb0u0EuU8gHujz/bxPoIEVWk795LngNXgF4GkLwnmGoCJP0/OLw= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:07 +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; Fri, 16 Jun 2023 15:35:07 +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 v7 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Fri, 16 Jun 2023 11:34:30 -0400 Message-Id: <20230616153438.2299922-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ef31637-f875-45a5-3472-08db6e7f4322 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tzyS1fVSRX1zlYnNrT75PHD+RLcJSdoG4DkouJJxEGK6bB/vu71aRQEAJTZGvyo/OxmLIK6gsFOVew0VgLeD+2mGMpc3tRgtpjUY5CAzzmi5GoZRblCENle17lMAiEt4/DO+BjfJA/u34qK+/NaSvpDyddeX77qRw88e3vHBJtNeBp1UKdmsKoeja+pSBD9YK73rmJoPJsdn4bi8L7j37V2E9DwN6yZ3Ksu17OnxGOEbKwtgVjavrWQTQzVymF4tH/zihtEx4UjYxr3+qGKOC3H0zQHpTZCve9cdTNPfZJ/1DbEiQMv/CFlViUinH2+SAtdMK9G150QjicbuvIJUBP3cLVfehgtisZuoiS9X1fGPRo7JVEnIj5EKfB8KggaBbQpSVAWCK/zGbf33lfOlIVRyVPWREzHfnsc2uZ6olG7estSb6gV1d0ZlS6LqU+ZPDp+7Op28cBL3xK9TTaIvvUTynFdobGY+EZOgCl3CPOhZLvzEWSn4NPSsvVlXqjZv+noHEOFwPVlMGdHePeMp7rJolcc/5IBPxMs9DSgFvwsmytWu7hEhDX3GO2yJ9EtZl5q+PRY08LIaC4wpjuCR8+K3np1eROZNlHLOw3Kt4xErP5iOMIInQbgeICtbs49CVMD6OTX0yMoBr5fS6Hlel16rQTUbE2ElGPZ0YxZt1+o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: epQLXtPNJEOGvQ3UNALRhi/pOt8sF0uRqOQaKTMPXOdhV+6WsfBSLGQj5m8TvgsNmz4OQn7bKHI2krw9y8YJaJBUJVuP5wzR7ZAISnP4O9ZxvVNxP5x+PFvSqtoBom50Ly0Pqt8xaQM9TEgYQWabKtLAdZlqqLZrSQaV9cA4mpQcVGFItXzEyp/BT6cqyI3Zs5WI5t9iXvRdD4NFKNlI07lvqi+3tHSPHE2yA32yac60sd70TpbA8hgcl5hmxVjAnSmx0zShOXbMxVdtULdvyq+1Ufmi99YaOBKUZHoERNJYg75Dls0yo23Nq9AQ5A4oA5O/yqxYWDQ2D2YmaM3mfP72uFTusJqePfFLbGgiJjbr5Xxc8S4VR8WJwEzeiymqCNZ2C+JB2Ys7QXTSXoZUXjMBKyQtICVWxN+7IUgbhItXSd+DQI1QoH6mdu5jQnCAnO6tawTUfUWhMWTh+DS2v4aX6f15Pu09ve4CY64ipaPMoa9BK6KqHu9LA03mg9cDMZqLDqJVhmMxcfNlsMYLbZCpLqSegZX9YdpA+riQWJYKpbMcnwoJwoFwc70xk8iZ4XBvAgHLo8ZZK/Mvo6U6DNujb0/GmMoKqZ5VtmsF/+x7f5I7NXozXIK+miREOiSE5clmL6wEgbod3GJsgdlgny689JZcM/6H5GQdbm4mCxttjmukMkCXM5aD44U68fgZ0wL5z4Un46ezajwmqaj1vGG4uOjxJ6o+YFLljObUklblYErSKjdmFk0Dg1MUNDOAA57AoyP+ouPOa6FpRUajDfANddkDcMUJK1MerGBonfMZ04S+o9PfU7OspoM6CTPMz/pPsBxXtW5s8L1SIA8irHn23CLbYnfn2ptrUsrM+ldswXtax3i4LTkmASJwXRRxNId+8llBsZDpD3CMJwo7vxZEaL+9pg3T3Di11MtYLQLAmW4W2BvwwzG/PMQX9Vg8bElK9Ripa7oPVPPIh07pYWmNd3PSIpQoP8hZ3Bycu1E6leRjxGm83NMOBjPqdbY1kCbmYNmkkBGXX/aHtV2bxlEO+cU6TTJQZNfF5CoTsZ1uoxkw66x/e7U0R1CJ1ZlEhZ9ANVhwSjOEkSsLBTS4DKzGdo4RRDmT3HdwuIt7zgGedy7w78WJBwsLlOLNU4PCYOiRcRoNtRPS8kStOs4vwFTPBT/2VjOTytulqWshFa8F5Rktb5ewg+u1pYj8r/13N06XsFOi9Bs3gPVDUtrpTH00Iu/vHhiL2F86Jaj5gDdMqs2aBgzE7yNz04Hu9+LP8Z1kjKf2it4KQP30uhp5uunwHF0HWq4FNBfXXFElNC+bHcknIPFqFnjMNA5VU5ySgpaOOVmAFdKAim5QkencL9J9N3evWPhaJGFN0jvysBIp9jhU8OSnVOaTH4PnbU0JRwwa5bKofaJKYSQgnALwWCAr0X1awmxRahGTT+733P8aGVJbEcPVucCxJ2p2xXJP/OhGnTV7S4gwtKHoMR7QVsgJfgcMBGOpvtcyeM6TbE2r4vo/XY2a6ohKln+L5/+FuE2u+CqP0Xpz415R2rVcfgyoYhx2bqnxGSogJdoBDa8= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ef31637-f875-45a5-3472-08db6e7f4322 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:07.0842 (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: cxmJOrK6HLFO1zpO4KVIAPoGLpeMYfZzKgfufYGz36RI6MQG3PWJkGwI8j64QR2T/VMFqEV+MNTOc+VaW6o1rA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768874843356162841?= X-GMAIL-MSGID: =?utf-8?q?1768874843356162841?= 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 Fri Jun 16 15:34:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438303vqr; Fri, 16 Jun 2023 08:48:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58BID/AWpaNGhTYHwNZXbMv2yZU4HKGaIRfd7PnPxTY7vb4ZmRMKCrNUfxTzlxVFZSIk9J X-Received: by 2002:a17:903:32c1:b0:1b0:28a7:16d1 with SMTP id i1-20020a17090332c100b001b028a716d1mr2439253plr.10.1686930517430; Fri, 16 Jun 2023 08:48:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930517; cv=pass; d=google.com; s=arc-20160816; b=kfsvwdU9FFZZVRNYQQ5iyLfVhYA9BXE6qY9zsjVd9/9udit1W8xmkU4pZbhY5qx1zr 8aqBf+utj4Wt5+BfrVygej8/BTQpQgqjKYWGMfL05K9u3B04i2NFqRPdwMWmFcsOv/nN u8FqWfcHUtnR+yjYCIqkwzFlQe4rKTE8bX9pKhFQVMLraXAbCxppNMiPnnPLxaIlwv+F pptuYYO27+uGvbKqD84S6l317FvItWi9PdOmHwY6xsMJ/SIztiLPtAeFgjfD2RCN6EGE IS1vIBxYHki5tlDXc4rVF5353SWNcPyMw0tmDPcJanT4Z9HhOTpDir8Dqgtnc6b1MVpV eiww== 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=AtwlL8sGegY5EYu7Nd80vhiLmv1gdSfDuA9Il5qkfXFoccy3h6YbqP/SJ7q7S9aWbA 08fohiGkatibjxKvAIxzLYJAi36L6aZ7US1Vt8+VdBN9P+Fc3vAN8AkMeUZob+L2Icg9 w28F+wgEb2uQxhbf30o+aZCPmfr+Ct+gIorky8OV7kUDfNgA71u8+1P+rGZEjzfkW1/Y qggT/kJBXNCwiU4NDWB+hRHAVUF/w9zMkvCvwmIX1RkCNLrqb4sp8CHM/bZx2LTNldX3 5DKzg0i3xbIW5AoJcMFjJnEAo7CZgseNHccTfti/ANq84DOc+TxZ8OkkEp9i9ITDYfbA R9fw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ajvs02oL; 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 iw9-20020a170903044900b001a92e587f72si7678300plb.413.2023.06.16.08.48.23; Fri, 16 Jun 2023 08:48:37 -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=Ajvs02oL; 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 S1346047AbjFPPfn (ORCPT + 99 others); Fri, 16 Jun 2023 11:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345789AbjFPPfk (ORCPT ); Fri, 16 Jun 2023 11:35:40 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F194A3C02; Fri, 16 Jun 2023 08:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDu5hbnpdK7vsKfXnrImAR9QFG0vUwOc/xcPQoNji8fQ0KNT9BrizZNL3TTBk0K4FLYX06YX248DAKdVyrArTNADgvFZTgztAY/8o2It0WZD7rFv/MILQ94zEZaFRYLVn3la7Lm92Gm7jZ1b2CJMBLzXXSblKY1yc1j0HjiVm3+9XRRpZ86ficXrTy67gr0j3nRKbbJV7MzyvHyozb7mnSCZO04qShD2rB2yPrtNeE57CSlU9XiqMpmvIGBsICQINjR9WNGfOy8ymcepFdbf7bWC/l6JB7y+Vlb4p3lzi+98hco9Cu3Jh5JTrI0mEoh8WvKg+t5mR3g+DF4lrCW8tA== 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=KPavZnwxOdZiEd1KF3oe8lJwc3kKAvt8ikT51nS7JFWoMPPBHOPNPW46WoqgN/lOrr3fxR6cbZ+VcqyEzUJSrNJ4fsLKQDH+mzaC8SIkhz5OzOhNT5BQu3jPcuts+wRdId/9oMSOpNaBqakS67IqodxrSlB90xxcdmB8ace6LDXQuP3n81tELDgbBiSjtoYBNU71n2qcs8zm6/OIYUKf5JMfJFJbGpYr7g9N7dgHL//o4vS6rcF0jHsI7a+ZTvNSZ7q81g84g5RtKpx0l+cktyT1lqpSD3rr2gIeUwYQxi9tREyT5kYMkrO0R/IrTeJEaWY9xJksds+/dVIvpHV9SQ== 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=Ajvs02oL0JliayseX4E2AqE6/skkTAwVPAsgAKQAu0xOTgnWt3lSAPIgfuP0MDkW0h15K8XnNeFpIYzXzAe9pyANXlju4CVFIDLW4io+zvF+zlabTfj71Hk0Cb/30vFlvIKB5di6Ivc+vHUxUUATH6RAZpbw1dpTkddI37OQX1M= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:09 +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; Fri, 16 Jun 2023 15:35:09 +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 v7 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Date: Fri, 16 Jun 2023 11:34:31 -0400 Message-Id: <20230616153438.2299922-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 81e7a1da-4083-4bf5-cad6-08db6e7f44c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rX6bzVGrRaFIv7jWzZAZSVcaFX8ZtfxMklje/inKBkqpy+Jv7vzX2xUdyqcBvnx98Div67gZ71ts8uk4+0CIWpshI0xhMferKpUba0ph4zUGiCBJt6l3KQSBzLtnOoWUbABZ2Jb/nRY/Wb9CFdOm0fief4hbOSv/+lnIafjIU+31Rj4UHilRBX8L4yPJzWnmvzzScYGll9oe1CK+qJfoSAZwpM9bhqb+xw7nR8Frf4nWbtHTN9/j/oOAkT0EmvycZteAJp8d6YAx5wXhe+iu5d/OVYbTIOeMrDEGry0/ruHd6J7OBiA8q1gnF9pUcXoXnh5dj+rZWg71wKft3tYtX/yZjLNBHJY1zfeFQL2mqcGTYUxWKzJRN+eP7b1nFb8NHGDzqF6xbJkkUuNc2gbfG7vwtuDPIWNRIvnRjAUE7ur7zUxxLovDNhB/rPW8RCP5MUaiSEYUFTuLoBQNqVH9J6ED1yLF9UUYiXLALCcUrphIKU/LEFdA/jXtcsP9Ndwq46m/FfcYjHtmE8WB6fGCk2lkDOR0qYpogwWLCcDl5EeR7evNhXRedOeqakk4MnWONQWRLED3Y1PG0bFgidjdPc0FpsPxybZgX0XIR7pyyNuO+m7V0ytd281NCFnblx9zVE9E6e3lMrBXQ1vWg8kR1Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z6vTg6dJaxuLyyjyja3eMey53FLnT1qFsBhWXcIzroPGW/U4I9AZJZx21TfvBVuZJzYpZhi04fd9UWKcCuxxfhMEZ4ofm8fCn3eVHneNrTtinrEKGdJ/+kNepknywHE2wjofRMy6Mecka8R/QbouY3Ms010sAIlk/2DZ90gi6F0KcTx0AvvpGbGF+MpHaVrkjYPwV0D/t3OkTGMrHWCc6mczUyfSEUZedQ0R8sJqF/7XfOM0Wnb/JgF4Jhk6wIKAEPhYXUm1w1IY+vpAjA1aCbn52bqNynnBXLdUNplzWLUf6+3L+QVJHiOsPeW2Ps1PDcYU54jn6Y8tYjHsrctaUEJGSjPAQLpFE2swW03WwQllPjMgLEAs6ay4tMFeWihMQcj3p3Pdsk5ZGPHIqmrW3OQ+ULC0hHusN3LPXyAD4ieCY209i4C02kgc5YwnNzRsALdXqdvoEoBwtPOOyWD/vUec0NoTCITn77WKg6yZzFXnihomXkeL0JV3jWY9l2pIVL8TiabMcFQJI+78gRnoT6PfNhziUQ7CTDlpQIP+bYJz6Zkv2RCg8RjhdngKxurLThsyXTJcw9xMh3Tn9ih91jQ0DVQnYQBxU6YBdetes3Felp9QW6eOJOLPI2h4v4QUOK/8BFgB3XsUsndd/0npLtKUyMVY/YFSeYe0ndUCthEipuUPQSyEIwafymTAKTN25tkJL7D4kMA7Zd2drtOYisqXktacu5kRaG8p20ZZ5IUITbEA9YCC7s+dun9QvsEn5Dfmcbp36cFj+zSVF6UQSaW9sFDl9e14qs/Gbcza7vVBtq4icYbuMyiza9qZrB4VhavOJxMqrNgQ/xaKGSoKeq00WStHXkUJEmu4UhATHAlNGlxaLT3aFAPzWBHnbvf3Qwpj/KwG+yrU/tz6SnRHsFXxY7ZUohmmB56PqU5g5zau+eX9eTO4fQ+h0CTQ+5icoRiT+ufbh1ZDxUNO+tdZ2S765QRTx47vRFduMSSPeEZTbci8iZMx3vdFXYzOrcTxCPtf1vZ+aNiv/kVmoYtedzjmAMykGDV5H+oflm7LmK4VBhqmHqh8fJelunI+LhMZx/GmtUICRG+ilp+QAZjsm+ZrmgXKjYdjyZTtNiq6qX5aWoH9odhMbKne36cPGqsxTUUbB1iIlqxPLkmD14xuFKJYzSE2qG4RE722N+5WQFVLDi4rvGC+awHmprtNHOje3x3xo+XqygSHgkk76UzVhbIoXT4PK/7qVnxRSxwFe26L2/VTOCWCEzKga7XwZHUJZuSwjCkcjy2+Yod2b2qvh8R351OIggpJWYdBToeijTei0BI0+BuvUQUGf6uqoYz7l6zfQ0sDo/YlXp6jOPpqt8muPjpqY3nJJXG77YFVAA5H6lhXG5b/8VoUbjYM9QEhtNywMFsRF5e2j359fMHEXazJwv8jGZsJspWQvldJ9tVNSIEIWWUh28tB1dAelkfo35OyHXFfhcun5kKHzSk5NrC9SMH6mLy8FkxvMI34CCF4+YpXX6QmOQcg3bzUF7rIuQxJ1a4CMpOoSJ0SAY+e0EWAXpVkNyX/oP7VZInKdl8= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81e7a1da-4083-4bf5-cad6-08db6e7f44c5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:09.8366 (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: DKE6bHi5EhUYBes/fX/YcWGa56M8anZtHVczuTQx0DR+6T0tjJSRQRuL9PkuIVKoAeMhQ40Et2PUebq4ntQBFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768874854235134957?= X-GMAIL-MSGID: =?utf-8?q?1768874854235134957?= 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 Fri Jun 16 15:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 109222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1445370vqr; Fri, 16 Jun 2023 09:00:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5C/FNB9j6YNlyvOzY1n7GD3aGYvtboidXWV2BL0MO0lpLvd4wKqY3SGgTrDOU3nFLU3Azr X-Received: by 2002:a17:902:6902:b0:1b3:d608:899a with SMTP id j2-20020a170902690200b001b3d608899amr2030895plk.68.1686931258023; Fri, 16 Jun 2023 09:00:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686931258; cv=pass; d=google.com; s=arc-20160816; b=szqZOu5Cl6gfLKvJAUOROG7bqbwq7cGdEYa3H+O7wU4l4qBbg0DNZIytJs99DA1PdG /0MDAqm0kZmBKIvZvSZkg2V12FCfLmzgDaG7FPMpWqkYevQtLixT0Hzh96elRoij3U1Y ntFvTkKgAYCcRxNSMdju6s7gkHUiL1v4k9t5l3fCOucoKgn0Sgea7T8R3OiEu2c7/8oO vj/6Ityt2J5mV6saFEH6jroSLJ36MR9fjaFULioTIPtpK3hPRgGvk/Mha+8nXmBU+UWA 44VaM0fhlBO3dltxvGRYuK8uCBZCMnuQjsfAwnhI3DppBB7vQoBleDAVmbmno4rQ00uy Rj6Q== 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=b9bZe7/tIxRhtL9uqFInxtfEu0JgaTxJX+g+BvG/ORm41Nz3Na/IeS37J57DdQXZup sWB1kHvRrXdEC5phFPITxYfyYEciwUPWNkOphTJzuCTsQLGT0TN39ZuXAg7dbnFbLJjx exes4Ajw5nZCyCX44dRI5WR7FpNyzgfVzDP0+iyvXOamSdHwZ8c4fZwCeVwP+Svt52ms PxX3MGYbpVmRBdbnh198KjRkepBfQ2WEAduaxNL/QBAzINhiB2zCrZOGykALjMyutA8Q d/noFEbrZv/LMciVDoCN3GNYWenHuB2XuYUXuA8bhK7kCuvdb4pA4wyW53US8gb/a/iD kfJQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=GmO1orl0; 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 u3-20020a170902e5c300b001ab29399c72si15334442plf.502.2023.06.16.09.00.44; Fri, 16 Jun 2023 09:00: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=GmO1orl0; 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 S1345709AbjFPPgM (ORCPT + 99 others); Fri, 16 Jun 2023 11:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346073AbjFPPgF (ORCPT ); Fri, 16 Jun 2023 11:36:05 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDB935A4; Fri, 16 Jun 2023 08:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SbKUncTMSk7QyYlvG1Z352o33C5iyBSh1cf8pBeLvTzDfvEcT8G076hfG2HnIGmkrcwPIZEVRyyKtuTVTWiS5WeabYcILEbPY4jSSGdBPMgXDedJEEabdxijWd7InVKCV1rVfF2Q++3a+eLjq4P9qno1wVfrqlvcztzfg93iSxNGB05z+Mpe3+m+B4KTqktBkoJvtiieYYJv1k0lU6wo+FCckrGU9mBHbZQeCGlHNDuIjLRQGIgP7rGbidxWGJ3ZNWC3ZTU4paevtCjT+gXiZkeqcsdqYL22wQqVzs7sSrZAW3hLX8iPZaT6OiDbOFnc6MOmWElmhGh7eXJmlgNGTQ== 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=fgylVRpHDTE9jZitM6umYjtjscRIdveXgU0a+e7S5U1AonYGecign5IStdLTvDtqeZLYyenPYl/BhjVjl73RZnHoDVaravoUF90ghql1DN/nbSvTK3uIMfjXV/Rhtae+g+l1jiSNewJdxhNPIWaH16/taNAhM7BWltXsaCDOsZMMLJ4ZyinCKJjdtn1TV7hZUPOdKvIR54pvR+vj4C9dQNhaHGbGUTcy5SAoHZhYNLKz2M4HZ6E1N6J3Vvclz2E0z06MsIT9u0qC3fSXhcnrcr5WGiJnuwrcnVqPEURuDAYQD54JyVqvAI9n4QXX9huVALJEgPhhRvC47iLqjrUjog== 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=GmO1orl0d/lAAw8EgWd+psoj+wNR8YSNMn4D4nTjtTqI1ScNPRzZmJQASNXpPLivR0M1lw/JDBDpj+2DBp1Oy+ObqJ2bbKQ3rZVw6VIuVRnHFSJUrlXeqXdovbFHVzRwj4OtAyiy8fhn1pR6JrqBo+VmwsthkY1yiioE4Lp3ZDQ= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:12 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Fri, 16 Jun 2023 15:35:12 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v7 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Fri, 16 Jun 2023 11:34:32 -0400 Message-Id: <20230616153438.2299922-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 185a13e8-5dfb-451f-614c-08db6e7f4669 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: InVgSUxRDqiULwONQZDyutMOvepxCLUcOC3824BJJW1xsyq3UN8p9ZwE0A+RlpDfs+UAetmpeDn/uphMa036eaf80YDMbpIK9X8RzSO4GCLp8rV3lq7jVA3Jnef6NyQSqpJmaolGhpRp13FfArVucjaMfWj0eQtaP4JGhbPCz888nibHbYFjvJZLr+yfBepn5DPDPb/GHtudyfz7ngUU78u7A+WrHK9XDD4jUavaM0O1AC6fCYa/D3m/MiWtFZy4blu+JU9yvX2Qs55tWFSFog6D1PTzb6XFVtaAJbpYOxj/oyhdOn4fkzuYnrNC8lMYsKwM1/GBNwCOetQBIutnQo8rTT02YlPrmCqeCGUz0KAKTAXLlxoACJKMrD4kP0HtbKZa4sTZWdM0DtJiAPacsEpszH4vXG8bTTr/EZshjWoEfQHlT1Ut7I0nt9TVGAXln0AXZxO4i1QFw+HL96z81i1KnE6z2pRZ2okyjc0pCl7UOvnLylYrKz5IBILbb0UIfCmDMknYZNd22KmVJt25kHTSIZMkp0Zss2YZV/PUXra6ZMGWccym/urK4SwwJ1xuQoPoyJn0o/BEBp/cN9Qd8I2hfjIT62FqFnsnAz6UCFaSt2KKIX56SGhxYVCv3nFk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2oUEd+gxf3Gbq//lNqU0yWlpvVKl2Px/7r7FCpWO915qwbqpmwldP9YQ3+ah1iQTSFXaaUGI/d+WMNBR2Z+v0TmpxmFA99av2mMcY8+lw7Ec2eFJEiOGX07rXSlpLvO1K5YpyD/OngQTF00eiuMOWz5aZ+wJq+YP16/TZPNwbs59eTudGMXeJY0UT4FePXDxHTHiNbBUphYG7jAvwtYrQILLFPAlO8a7JK7scW+IdqkIBuVLFuKx1EKpbNVsuek/kFn/J5ewD9q8h3g943JL4JfcwAn/anl0mom4ybb9MavXJggb2AVG/oR40YkF4tAUZYLr5LszT/SAPFnldq/YcPeBuQoAf4iW9MJVdwSIziOgpFvjrORcrMDt5Ml5Lbu7kYs6CsoY0ruHlSBy2ywpTlv6KpDoBGX3brdMyjPkBhzG4fgcwkPG3oLEaB3qJHKf+BoUO8UfxYxT5nqp97GioEV7LAAgbKBG2iGhnMCwPtH9eUbC2xQf0XIbbqMrdh9u2Mf0wS+4lG7hOKmWnNBXtFhu1KKUuV/HqAcGpS2G2RrXPy7ATSWxwbTarp8AKpkzAInw2QV6bACtlJ0decdh6POlK8lASUZQHoKpBinrjSrFrMNia/O/18VyXgaG7CaWdE8JQDp/GDzl1TWSqvYhQuOOpSIWfLoQCdGD9CRFcszKxrJmN2mBnFbcuhzbPlkdkcAOQCi/IniktmHdVQL0/Fn0voVE/SHrCD/J/nUVpSFZV//dsBRmhelmbloI3RSi6ZDe4dKBXEJe2ket1GNkSZCk0xqoBqHNY8NBP0woQYTeovOv+VHGedzfE8ocWfPlLWqUS1pMA7jK2vrCz+hdO6tDpmPsq7ZB7GNR/rP2DZmMANEPRQ3Lw6XuShDZ3QbGqkjBl5gHZqIVWu1tUCLeqCuLiFmNVqAi6wK8kwH3YDt8TMcUlpuFdudFl+MQXOaGKvtzzH6gAMYnHh5dLe/Ox3ZYWecFed4ZNQLf716xJU3wSHu2UYO6/M+Z4Vo9EP95m3tIeHJ20AMLWF09ITTNmX+DU/QJdgZfYFJW1LMDroD4fSctYTM6at6jt3+HX2osCsv06seOVxIcn6ktr41Zcgg+cXImKFi/bxlA8DrG0/cgOk9aEAzNxemI7My4Ki1DH3qobJBhnAnonclzjs4ULfp3XTewBYW/Jk/c/i2kuDxASekhye0Ch5FWs3J15sbmBPDuw6bRSw2cohuXiFeDfSgakhARlRX4cKIga7mV7bPDu9ocIErqGY15074abBjYDDiP7RcFV5Y6IDWRNIFjI6sn2vQ0csLIyy0m0zVWmBwxCaurg8+/WLIEj0KLsXqqSZee2sVddiMEUh21e6XYze+IQbvlPiByXL1/UiuxieBqzO5uVOsqJiEHMtfPVGbebn/kcPDScKHTwxhTBp1mPheXxxKkvqheOA9OVbpTs70xJaO6YhNBhEEeI+5Y6LnGWhJwQApTneiySp1JthNE9Tmgt5v3Zdh+kOH4GiOMx3+7/sZzxxu9mLgNZGPwqid69F1VjZAKf431E8WqgofSVmIM0nvsUfscVNQk+TOH89RnVUrXY+l3HQTSLxM16CaD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 185a13e8-5dfb-451f-614c-08db6e7f4669 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:12.6021 (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: oZJ3nyzFM0zNd/Tjwq5MdCI+MC98mlcKT47zwnlFkXAKsSTUqy6SUFJE4kG36juBhzKe3X2QNkOFRNzNgqvQIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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?1768875631024575678?= X-GMAIL-MSGID: =?utf-8?q?1768875631024575678?= 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 Fri Jun 16 15:34: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: 109216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1441390vqr; Fri, 16 Jun 2023 08:53:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45Q0r0Wq50RD5Hb7IYU2wXxITX1FPg+05cEdQAEy/JsHL4S4Zlnt2Hr1x+CSqdS3yStuaX X-Received: by 2002:a05:6a20:8f19:b0:10a:e177:9e73 with SMTP id b25-20020a056a208f1900b0010ae1779e73mr2895106pzk.46.1686930837103; Fri, 16 Jun 2023 08:53:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930837; cv=pass; d=google.com; s=arc-20160816; b=d2dhW8KXqnSkNTrYMqpW6fnQ9iwa2ELwpMqutclL3hW+rPCYRQqXagMYIRxbdEcAsJ WYKbaCJHHHYfMx5jB4TAVGteMdL1fa3wi1OIxtxIDPk5Kwk5zjJrIGn8UiX/Tz3lSyDA jx+TZX+Tccjx/DaKbesXZ/aAA9dy0vTZOS69q1aB5blQQ/tvG0j50VIDNzOFMbqs+FwY G5vx8p3gK1/x0OQ4bhTebJfFSbxoOTWKG7OUC1n/j32KljKhDAdCb/cKErkktKc69gTZ f1yyZgxcuTeM62KAUdHkZMktPrN4+7VgR/q1tkf8DEe9VF03Bdm8bv2D4QST++GZLiAo 91aw== 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=Ni6fnAiFO9HnMbELYm+KjAL/EowE/KVYqhpC5jzWi40SAZR05o7LjxeSSX2AMSrgq1 D0vgg+WSORE9EzzvjIQdUi+JXK/l9acd5mjds3lToZvJyXcYQ6Seo/RivOzgZdvwJD6z 8NQckDOFcslEjEvVglqD+WDkKXDm2Is/4egiXDTxAmcncT7se0Bomhuu1Jveoox4JRFN jSBzFNWf2CSXTlJ4YaA/1uWK46jPJ2dCoRO0z8RdOexHiEekjxXvICAuiQ/fiRGppS2H geTBlF9exs0qqrshQoNekcwVTCj52v9PTY4qUXLAZzyEeiq9pGd+kyL/db6m2G0BYhSf h1iQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Pgxo+K2G; 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 d7-20020aa797a7000000b006666b36b0desi5152346pfq.361.2023.06.16.08.53.40; Fri, 16 Jun 2023 08:53: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=Pgxo+K2G; 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 S1345747AbjFPPgU (ORCPT + 99 others); Fri, 16 Jun 2023 11:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345783AbjFPPgS (ORCPT ); Fri, 16 Jun 2023 11:36:18 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EB3E35AD; Fri, 16 Jun 2023 08:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JYCm/MHKMSgvpiaD9ItGyNbT6yz7CGCVOgDnVHcXBxG0fin8pk/MPBXHxA0gAGY1CBL7af0qEX09iy+gwin8VhYyRZvdzbdRInKPib8qujAkrNFQB0s5Nmr60YcggRPHyVkYoJ+QJ5oE0aKcb4JohJ1WhTEqPfMwEdHY49Qvjm8PLvbopzLNqm/zJ3jVQOZLAFDA34+0eFHwp0k3E32/nkKHDLCyM49qgsFiEMuiKFHlaaOmuOyzB42U80PRp9aWLM1KGDWlOnuGaJxVQxxkf0hdEbQDSymZ8lBaFPf3V0BqEplY5+ISe4bDQjYHcoIyL81Mvv9xE4w7I0qEfgsc4Q== 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=SvBm3+1OmQKKxw7IFOPk0oOx1qJB8ginPFqNRpHbr6XBCamDJ6O6ZiVd2sUSojc/qtz77uosBkSYkQ5wHbK59kF0ibAkN9BFPHT+1HBbN3FS+/eq/T86GFhD8gVDoTOL93KMM2mDpfA0t2KLmiBYmu4JICx6Au6l6J6TWdOilHpX9JIdCXz+w34a58wj7GkoS2KfmgR/1u/jxniRq1+m52KVtpuu6XLh7+ghpvbvdT0TMD70z4yw4LTZJ3MmKM2O7R/s1q2lkOzQpWT/uYC37cRelkNFiiFreRDr5OQX4HkOR+jH7mVczWuIUSpO/O7+4CkLV9MYrsFLgZnXBw86LQ== 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=Pgxo+K2GThxuuTmHWLp5z/NGZ/ek0IpXGP+2F3H1MCNkkaCnFoT0ZzsfW0H3xota9VyaOivZh0EBNMsU77XWTmdXoRcyXNDAjsNr6cX48ibFxFOi7WdefagQtO2c79nG4hLfvXt+WStH6EBE58VjJEVVL7Y+0Jwa9C5L8Rdb3QE= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:15 +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; Fri, 16 Jun 2023 15:35:15 +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 v7 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Fri, 16 Jun 2023 11:34:33 -0400 Message-Id: <20230616153438.2299922-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: b485f29f-3ac6-4191-bc47-08db6e7f4811 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 76GdBLGL8sYRu+nCLjII5jMessNYU81Ig3CA1OeRcJ5i3EGY9TbESMdrX08tyojkYSiNrnNNX3p4q9Y+oIvmRWrw7+aDpGLOEg72f1ggL/chxbHPr24AZq6K5WFynSsKi6J9w87VtOcNfG9YqVAu7QJZvgnQEZI8Tb44uOTkFKSTznWgaS8/hCdaOZjC5B4/7/q/6o93X1sosfQE0tLkxrUYqCfCnvhioxXibcAgyDGvQWGP+WkhKFTAq46RNXQK1Tar8Kfx61dHKlq/Y4YoPL/axGDCLwZ6ImsvbIpMOjh8P8kuhXPpg3VWn2YierYyaQ4a2g+CNM1TlnLjReuLTTBqvJCn+dhii/2903HjH9hgJ7xDdeFLmEzqOGELyMhLCTr0N4bdzIoWfpVkck2ljgjLx1LbAiBY+lSObHSlOOneLVVIeLMCqdpTrQT7rDg1r/JtU7rTQ7dMam6eVhWzuzgB7Ldh6Kq5ankpBS8PJ4Fqkqlniw6q0RyRhLBemBK7Xt89hEz9wmJGtnOKN4wMBJOqq6fkiMNgJgC5DKEQiicJrjzqzvqq/PspeM7lRNSOQgqnjqMDJOb4WntELt3Ld2Z625hp6SSFgJAUPMTq2j5u9vU1RVB3HVqBYbXl24RojWsune15aRB6BmxaIJDgQQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qQXyp5kY0EPwFm0ME38sE93GktVDiotvl+wKZ3JefnnmYbI+NyXC/NdV8xEm/R0zx/4ja3S85d5zJhNf+lnrnWIEDCjN5z9FrFnHwqY6kRedaYDrrHPfuuPk626SRkuo4dmjoaYg9y7h0IVGpF8zc3vClLwkU5ysn7VT3i4ZL9d8fheMSBnWkJ7zamMaYTZNmuOMborKm7rGYIysutzMV3x5DPsMhu29V3RluqOn3pSqKOBm+fuO0wPfFwBWagR8+QRvVm6wpnqIIouw8TvUEuwCPtZb4ziarIW2pXraRFE5H7vItdlJHDu2+HMfYB4k/D/idM2iyDx0fStA5IVfegFmX5odsBGIyGYez1udYvN08iyH7FPAPACT7YkHAiqMTu4Ym0FqwRk/Zs10208FckLm+Temh70StGGMXVfi/FLYBjUnjMVqT+eYxZbLFCcHui0t5eFSuuwvZrE0F4ttyNEh9sE1zkPtDJev+w2/vtQUbCP//TJKKbVRBdRv7YBq8iMBr9bfYLcYmtPT/PA6P4qxwOdzMwZtobfpBCueYFHpM51GzgCPF5oN6kdyh452z5ASTrffV2Q5T2NMIBaFIRlGGXfCUa8jC+uw/t2+dw8g/n8ekgF/KkUKi5Y7mbuaUDPixVp8KMwbTHLY+Gmv559olxdt7EIMayw0lE9NEzbQqOvrcE6oh/DjLImdDLuuBm2tuJv/mN9KmdiCJOhAAhYSDgM57LbFT8t7BFkf3IBWO2UlONL8xS6CldH6nhC1JIW+mWMlAFalzZW0FUHC6E/WuSPx5/nSIcujyaNa2CNAUKLmFSiXSJjcukMHgGH0RTzOt/M+h8wD+cjeOvIlzuAdqNsIE94zURYmIroAKXv19/LJdmUji7AHzJbc9Oe5OlTTgcD0xCzFJa3KgxachT5iOUoRYY77RKg3Erm9Ophlh8d5urRVYyNDfZntKq4RyRK+HTwgEvQJ6KKSc/ONgnIpWaParqMyBVqPd7Vo4LZQlYxl4Z3poD5EsmsTrdblymWtZGMBwsNY+wHwODX6vGnL2CEQK6r8MIkTDBPTokinmpwHELYxPSKmrd2NQsiTgt3Wqq6t77mJ4fBV6rZTG6vKHUkY/N8uWDupj7F8eZUZ9eCn2YjT8VIDmZMJXDLnvPprqynqj75L0Op8USMbrW8r+AD9JE7NVp6rk2lWkFkX9XHLCvnBJXZbcfemxEMV00LA1CWd6wnamwbBpbNmSCUWLckWGLcd3YB1i6YTIg5ZJKrjSrdleHewQUehz6Q0pVq0BaIPq3XWxN1zBbA7RhZWjJNLhv3gPmAnuJq9sIFQaoPkvs6T95CazZDqVzOqX5h7ikkHNyv4V/jUg+SMqVIAdkXBWWEI5smLdVWPkZ1E5GtEbgPMtzEuhyrWvAPQgBuGvwIs63W+PUMNct7tPM6O959WKdocKz2Bevc8MYEOeyCBidH7jxvNMs3od1nqgff7gGAp7cqwzurMrteL/3SxE8FMM8V49wc1/5mOz4EugQ2nezrwvJgDuRMVZvOBrFInvBkR0fJNtkxWpUok9Ywr96Dmis/c6SPWG7bvOtcdIMKMpwZ1K9RqhRdqc5Cu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b485f29f-3ac6-4191-bc47-08db6e7f4811 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:15.3538 (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: rSqsH+TTzti+j5OJ+58fUCHm6SO0ga+DO6aey5cfDl6X45IZPWJIvvvzh6K+9pmyMipdbjb9OV2DZHwqhfNKng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768875189798220427?= X-GMAIL-MSGID: =?utf-8?q?1768875189798220427?= 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 Fri Jun 16 15:34: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: 109219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1444297vqr; Fri, 16 Jun 2023 08:59:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6eXImA+ZfAZW2uXIFQDRE5HEc9zILEnBPau2WYcHQUt7f4H5uTwR9BhkENkuVzxcZZ91oS X-Received: by 2002:a05:6808:14d0:b0:39a:b787:1ae5 with SMTP id f16-20020a05680814d000b0039ab7871ae5mr2996584oiw.48.1686931188484; Fri, 16 Jun 2023 08:59:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686931188; cv=pass; d=google.com; s=arc-20160816; b=lnyLnsXv0Yf3uuHSID6E7Rkhwg20Ytx3mLtvI6d5ApvYzKhYoB5or/0rMNH2RN7iMV jj26tRYfboPu2pLuDNS9+oMmg+vI+gtqv2JigUqioJJg7mN8VBehPHvdQQKEOfm7IkBX 3DdjGyX4gkcPbm4GlkYBaKNNHrRjT/RbmWEcpCRLpGETU2Wm4kFGf7OrIOh+PZKRjMPF 520yyJWmp644k2V9z0OGh1f0D7jn5g6Qd96KpxGGNq5leodA8VsqJKDLhqwgvACKvEeK +x7gw2uEfVabVgcdGldjsQgilFmNR76E2X9n4GRmUdIw2LHu0yO8BfruX7VHMRum4XrZ m/MA== 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=t4YtntOrXZQ4E126SWstI8Oy30b88PmxDTVmFJGD/N0/oBJfS0Y2CpjVvv7GXyIzcu lyzVsRMw41Afd/qZtvsOnQBJvNYDgcd2CgNn8fNvBC0HKQIdC3BYRzwt0z9jULOcpAfb Qywz/tE3e/olpPtx/fLhkMJ9FBACsaqiJISiW0z+ti2ZwullZokO4pEWQKG4fx1SsUmX Dj+RmegEJj0vIcy3jFrtt/yxUZHhb0T87cjoT/+hUD2a85oEcxU+4Es1ATWTr5R05Qjf 0nb89MXFxxXsBcl5q8cEOUFNvaw/RbgarJ+kywPu958ap+gnTai+FKJIUFyZJPT+OnsY Bcjw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CJcQNTMT; 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 v6-20020a17090a898600b002564edc1320si1911553pjn.51.2023.06.16.08.59.34; Fri, 16 Jun 2023 08:59:48 -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=CJcQNTMT; 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 S1344838AbjFPPgh (ORCPT + 99 others); Fri, 16 Jun 2023 11:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233765AbjFPPgf (ORCPT ); Fri, 16 Jun 2023 11:36:35 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9FBF3C31; Fri, 16 Jun 2023 08:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AuRU0EXATR/0Ck/N/Vcge8T/+qgFiYW8gcS1yD5INcCIXgDsdSYo4RUb/G4oNfR39INnFyvc+2qfNBvjcRi36hhHVJrd6VtvNFErDPv/55O7ygMSlACxPjEVEOp76gQH0EnLEu/WlldM3cpXE+ky4HALVwApJsPUyzqaxRBnW9A6kAcBtjtARd02QxGQnhIyv6vd3ETSJTvBLGkujS6/dlIHRMb9v0fwInBLLsIvX0BNV0UeiaQALflF6o1mf66lNQsagh1aBBoE+KTaHiz31tSHbYTdRwi99dlyK0j1Rhpf33aV1W3YEL7ogBAcQud+28QBx0iHlH49ikIQIfOuaQ== 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=WzQptPPgwJGfsoVBQsf+jSQSS8aVtQIoBARY8j6nN2DtFJJ0t9YpTYxjk31CAHJiAgLt8Ip9Z8MXkddbprWWwkPQX0ULneTydCv6npxigiyYnk2HW5dCo3eUDWDy6TdLmRcvUaI/VNHr4CfNyZAVF+p5ikj8ldDFIluQtb8JBi23PNepO2YDr1H5CN/kGNCiD6Vfdviq+rRlylluNXSKM2xup8gvkVbbIbjgK0CL5NJ9TV8xCPxSVLGkXNH6BUIxEq9NIxscwFPOguysDg2/oclyg4nQ2WaaqdHu2O95dF6LnRniZXEk5jGod/r6PwLX+X5ranEI9f13mRwQz8eSBg== 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=CJcQNTMTrUsFcimHHXU30G3SCngtCpng15E42SWQiwm3TyCKnkgV13qdDTaYMuRm+VSm95+vCz0wrWqFfRdmRat7m7tMFDNNtWEic+Zlb5g2YBlxyffp5QWIVTe2ujuh1+Ax0OcQ9ya+9sC7URX50ihO2wvq9eFhVklO1yKczss= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:18 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Fri, 16 Jun 2023 15:35:18 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v7 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Date: Fri, 16 Jun 2023 11:34:34 -0400 Message-Id: <20230616153438.2299922-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: b92f94bd-41dd-4e85-b4e7-08db6e7f49b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8LOqkvey9xQ8j3Qz7vYJ4w55qfS0aP6jzynCcbpOjqo2WI2A7OdC/brtjc7Ywxhk7vhAKeVmT4QbjYrNZydHDpg+lYhkmoCyVGqc3spLQ0xE+2h76MeuhxOjoebXehrtyAOqbCdYHKutLubU1BMv7ph9a/uFHRKmRJe/HiCcouGhFXtyimLnLRMIC0C1tJX1ijcqTT9KS7dl2khPUBT2SKH0IGBVeoeK3lh6V6VBrkavvaTv1M3b41lttPeggkPFAPbXTYDVFx5mWnUFOtxD7OQBLD2ziZJu81B83XINQvpqRYq9X4QgUjThP35yBJuY6moKzWAPCywiybay53uVhIG76CY2NXHOz94eLtHbTFO/pBujIu2qDOpnEJwF1C9pgCYlNuQbWrRtrshidj3uZh2y4XrWH81wOqgI+2zoQdKfiQpMGHEb9l58RQpBL/JaEk+OB14XyfcifvUn/ViUX1zHCYv3tKZrV4ISAcvaEE0oxrLbJvc58H1Rc302W2sLtHaFFLErtbTN4MIjUWPXFI5exCRfehpdSYPWzL1rhb3L3McyMd6F3BEuC2hAsW7EfJG7A6GiON0SwHpoCblW+ytl2ABd/xb1yHFggEhm0Yn7ALWQtTeMldvi5E2ZTA6uUvvItlbfiNS1KpOI/UAZxw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lpywZzstlmufl4S3zV8hnMAKbwDSiDfUJvg1SlPoTFe1QTL+GlSfOdHhT0BMTiRXW/5PI1iVa4Yj2Tq9X6TXH4whyLvvYOnE/S4E8o037nGj7KxeZX7yr+aL2YrAx+vjFMI0JoZkvkefq6YAf8EUnpgz5QzWtm2F0CIaNCT72hAFSPIycUkOR0lIo4PxF0tsEeMQHd3vaa9J0D9GglIa3uuG9iDiL8bomLDJMKjDhmskLMufYvPqF0DeEzr7FZc/3Dj+lw+m2Na0scdnNNxSSJ8e40jqkEEjYG67YyFsBfpwIYJSHMJP8VXIIr3cgz1XnHcsrA31d+FXJF9a0RWT+XZknA52JxbbZreGnsyzJD24hMYRGlB05WqRBEQU7lyuw73wd8IuoAZUQeAwS8mX9NgNN8hV/O4tI12fK9mJ1D16YhYj1MBa26S/i2/ouJ4J1xBiYXCkxHSSFHMn8hXkFgd5r+earWt3YtJQeMTwTYqzxZuH4oUkNqmuIUEhGOwWVIaI2XvlAUEimbo0sLaDAm5fQxKL5d9aYJGihJSxy8+/piOR3W3rJcZaWJA14mMuDcCc3g2E1dK6Mx7cJDMp+nRy7cH043e8nQ95vrkzROMkITvJwGlXqffi3vQXKz6YX+QxNye1AKeZxh3SCzi7lotaQ0Kr3Jl7rJvwvmSWQ+OFVdHhb2JWRRqBYNPdC1bTDxcyXqbAtKaZRM5AumCEBM58HnCrQEFr5Lp11upJ4kl7yuDItyGqWoJZ//j81U3e38hdRiF+VojZApFr59cSPuOu0YOSeYZwFjTTz6KvnY1wkJYb6zlRoYrPUi60gmN4enqZMBy/ND6iEQywLQWZitE2ttaXqazJj/zlvge8TCz9XZsI6AfJsXge+pBk3gzi49ueQGlODCp4One2Dx4Ipr7EY6nnJ16hL8LVmggGC4S26WpSLa/GACoHOiyyB35sCxrfNvaXtR/6IaivqYIOP3GlNDaT226qx4PjA+8AySmwM8Pk32k5QqMrDHRlZqu5rwKqZZnVAVn5pGYvtzy3b2luGmhZpW7rvQjxyt9E6hgDCfW4aKCUpKk64z4GJ9jdGWFVM/QSkVw6uORUCgoPfgqXQ1BrvmvpqRxwkfHITGeKygjzdWt+LjsVd432Zt/Nq2F8ilgcvfI5s6ds0MGDOxvPyfaOzeH4Ca2QESQ7HSIBFHIgwtgyY0eLSXhCTYmu6FaL7WRNk68rkq9fXklI10p+YbiGPFcRpIk3r2nepQN07sOY5p8w8vv2eyr9vs6/FAm6JWEX2oHZsSk+JIBuo8H3TBBH6uAFIU09FVvdJfjHYKY8Hty6UCx1M6UXBBs9LNXqoNeuZC7OlNYtKJO2rePBDNCDUIj28UN1H4qzVrxE/vY9ANCSIAj3t13Pd9A48I/tV5D/SMk9q5iFPu4MNIlP7y6rZtlbaypwhzxuKRosZQDkj6y37MdmLwEaH2tRrSBsr1/Qx39PagMEbsv98afvYXSnrvr8UYMO19thcP+ZQl6N3Vc1Tk0GcoJ5efxhXUYOCDEvreN7L7FFchXcMpX4341LNaU2TElSR46xyDyfDxUDtzA/pTCnmTVHlnTW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b92f94bd-41dd-4e85-b4e7-08db6e7f49b7 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:18.1018 (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: JSPdHUvvGHrEUxXVll62Tw75WpA0xyo6JeOnr3WyxgMrY9NICo0/Kc2e+fNT09AENReaAoZh4Iz50jOhtp1naQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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?1768875558130394546?= X-GMAIL-MSGID: =?utf-8?q?1768875558130394546?= 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 Fri Jun 16 15:34: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: 109229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1448114vqr; Fri, 16 Jun 2023 09:03:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52YZ+g3PaNpaGsdgTkJNtpsIoNMQogET9Xzlb3NImu6IS+/NOj6SWP69QehnMLUUwRr55C X-Received: by 2002:a05:6a21:329a:b0:11f:2714:f70d with SMTP id yt26-20020a056a21329a00b0011f2714f70dmr1439260pzb.9.1686931420455; Fri, 16 Jun 2023 09:03:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686931420; cv=pass; d=google.com; s=arc-20160816; b=jNHrYq/OegIoJN/COdVlqeRQqJaWI4RxOdEqq8yOig6Dz7JFNbpSibFIlHfV7LyKxs d7mIf6pXfQKAuST3viELOne0y4M+3pggo++E/t9DcK8BXbL9w3w53DaLSjsYKoHMeP05 kpcybCa5DeI7lg7Ox9iPvPHyIB3SU3FFTrN9WRDqDQ+P7UgnX7uT8xVM9nIghQN0S7N9 ZfhCin4844fgCrMiWSLKioRKHJ9VRLP/ALphBFxJ36+Ex/Y4FCelqfAawzeeyLhaXuya 3pAwyQW+XIF8DgCXV9XLCi56BY7iwaRPD9oS+CYDXM+ubWqhpNCT6C0vqb2zEDtBH5a4 csTg== 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=IMpm+YQtLiQbws1BH6ExWdf7Jyc+TeHHF5IEKhrkk/qvXQkOY0tDlwy29LuM3qA7rB 6+XPyzUm4GAC8KOal6Bc2ijEzDtYp8amO6S9MaTDgo7aN3yA+xHHXCAe5XRur8yv8bNf LSDdBfPIcvwprB8klLWRV35XXDCJaN5xBOM9j8cprmbaVggyjlPsXmFO1bZg9i4kxGQX EnKkUvCrQtcrfw/5lcb/XmyIruh3Ns57TZ4f43WTlsLLEhzRJgB5wxuzp4hGcoKmCWXD jXtSFlVGLGQRmRzr48xYTMNITlvv+rQlmwxwRYy8mvXgTjqtxb68aeqNNcgq3WOWsRdV 7Mhg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=FCh76l1e; 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 g17-20020aa79f11000000b006645f87dbf2si11865700pfr.223.2023.06.16.09.03.25; Fri, 16 Jun 2023 09:03:39 -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=FCh76l1e; 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 S1346060AbjFPPgx (ORCPT + 99 others); Fri, 16 Jun 2023 11:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346070AbjFPPgq (ORCPT ); Fri, 16 Jun 2023 11:36:46 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7AAA3A8D; Fri, 16 Jun 2023 08:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hkpx8cKljSlhzvmdmNByhK8XZliebmv6FT1QykmC0/T7Jqc1cyji1j073iJ7SKgw0fYmZTMgUtR+vTDk1Cyu0daHdf99seGwgkz9iDRtNhwZf6BO94coCXSyRVt1iKG639xT+QRZOiG2dQxrLIexD+ZNyVk4oF/1cQJe55/Z2JOBtR7MwK3a8Ymnb+ltMhfKvGXHcEFLrgXm4iqCakt16NXwZpQ/9OKwOiiw3x5jZ5PqFnwr56ER4W+DsoefXHGfZ7j1N0Df/lnVv6qUTSUZscKNkVRIOCqwEj2Zp+RhJpvBcRkJdG2pPl+dBWHZfLzVOlGHoDLUiKfuMo5N416FGw== 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=kqiFGiCq0NUsSBDbqrK8k+mt5j76vHtqGRfG2v7lhJeJYpnvBXrypwKWwiIjHGZYzADzOzV/7PWkppHbW05aHmKATLi0RDHjmn5a2cc2mY/iEJdeInMKoVG5S/2VdTzVCeu4NUhBs0L2xj7ySgHySvmtE6GIyUrXKL6iedWHZbb/nZQwF9mpVs56gkRTuONwI1uahN69ThUTr6oM0rLHtWRVXf+4jZ3fLiom8RgV8fxaixTb/Jl8aoDunQMnyVfnro1VjTmHK6tVUnY5VZPVxrGC7QpQXxBtfgqcSAY6iIRJyGjEWGouR0QC9M+cqKnzLe8B3MfnhhY7fCEmc8aPPQ== 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=FCh76l1eGUYS9X5ewCXDYlPbQYVBB3/OFiYZcCO+3zxumnG6PexnCcFnS+II+BKPdNOz11FBtj0qvayllb/rKu+EUkVTJLwR1EXf4NocWGyVZplGbxL9tCSFgFBfNPN8uEeRXJbw/4BUcXJD2ZeTEHYsfgZH+boN6ecn2wku7OM= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:20 +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; Fri, 16 Jun 2023 15:35:20 +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 v7 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Date: Fri, 16 Jun 2023 11:34:35 -0400 Message-Id: <20230616153438.2299922-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 4873edea-fbfa-407d-2461-08db6e7f4b54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xaPTIIY/oXFmUAzJO8xKjeV3l3cCbo/Q7XjPANDKzC2OMBpTlemWaqsN8UUltrDhJDHJ6Bk3+upXu/yQPlCXehfLmdhYRlo5m4zu/3R6rtyvn3dcOh1Gk1UAq36FzcSfdGeqtLuIRwzY0zSTCSOLwZ8a+ut6OrC8FZTV9oVkQCkfjTEEWM5RsG6TkCIS0s5C/4pTCLegJqP+KO76vrnGGQysowhIdQYnqIZdrnXcZRm9l7nZ/89euQvjqwqrYPalQW1l7Y5zvwUuGK/4NbugdkCfiqiWmUkpkIBLTxqqRbFjZtvB5PYPYrjXgEUcnGuXXq+3f/x2k8NiNqSFStBw3v18Pd20JuFvU6nfdVA64OEctMnRkFtLP8m9MBtGXBEttE4iK5lELYBv6ecTroF4BJnxYmh9TdyarS3b7Sg8h7qrZk6sK6yaGpK2JRw6DViMSJOArWLosioYYbFgd4rcRgYu7Lzcw9UzNCkkjXqaYNMfmn+qLYiw4UXcBYMEHY3SUcqZHys2NyMiLvAl4ZGI8ynnGQocfW+a+kf3s7VoAbk1T5G95m6iyjAaZWk2FslNzT0zyits1gwjyUs3rjf5Xc8kItnY4VXzsU8wGeC0BV3Y0fZOyGRj+h/xXXXLRtrkBbE5cOFj+jeMtqAe5LgrrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ss03I0Cn04E0CEqIGZ3GrDeVtzQfHPFuspo491rapU7aw85pPXaLZuZ3XRlcULJvP9eIax5GTJqBPpEcJf+BUar6drlMkR+cofx0E/1nwQXOF4wF7308KbM+H22Zzoxr9EBT4XeqWZuNHUCTz9id66Pu2weYrVsn92qR+ZrjXKsky7ATeYYzfYHwR/3VTacZ+qKT4abbK7ijuD22ekid7/6xHgFOoaQ5oHvrlbCk/TzJDRh0NhsIR9zcllKPCHFQ0Mdqf7TtjplaxGIm8uKBfo52y0/UK4RaCJMNMov8m4LeJQ76/8VobWr7hFhDfGFROI1jzrlTA13TYyh+BfnOZ1GduG4myu8rxc+jfhfBGIQLSZXZYJohH5JtSbS0/TsT9lH3pNzfP6W/Q1QxBX6jFhh/4yvD+Z8V5VOOKtVLJAA7RgejKzMfTlj4EMxgxlNs/M1AG71AdirpmHVHOYQp1luCzh5ctMLTDAsbO4FkXZS53JCvmViO6TRq8S8gN6pC/wMD87tFSPa69l41alfa9jm+kNqAD2tFj1XITHy9+8ll/41FEN14/wvX/gIVfmHSmCL0iAg/7Gh5Jul0P5TYvvU50rLueJwevjXpy4PzWiyhhY90xIBbXTabfvvJcKPVlNOwuzICyPCVXPXKgq8hEAGfwFnpBaEhwTM6aD/B7n6ycIM9Ii5GaIJcV+7c1UVosGoSnSyHcHiAWfi6J7oBPvYYS80C1qa3PbSgkN9McfnVBguozxjpgbrUxrjmLJrNh1sgt0c/VaZQ3peUz2rizqB6E9jcbBA2CIo1VwiZUWaQ3q257IRb24YsHT5a/nqI2F0enFRwNSS9jSSz6oNYztFwgmjtv9nZhAHArGQm+rHXkjH2cgrYQsDdzNRCgG7V/N3eDXiWIOlQt+3lb27NtN0RO62ekUSJvx5u7Qud+aK6TyQ8GMwc8oC1y0OjTCWRNZccNHjt0bDNPrlaM2TX3gOFIFuupnlZKdZownqXsuiQw9fpZmd6iLvEkobNhrkBX0GlYqqNTGILkd9jI889m+Dajkf+jylrf5I8BnTfyxczInrKgzlJ+depis85flzPdMphoQFlzVnTA46RP4vdGtYJs3BkLiGAFkBKhZXYJnR9fwNE4Nj6vMsu1zU3gbZFw+9zNFQAvT8zs995zvLGK6Ix6EBl5MeB+UU93tonL91z0Sx50OXj1Ucb7vGqyQoo+S+RJm9U1rxrFGEuIi5gVdYYySFjB5rBa8PptLMxMRaTxZBzYaRRIngDa51j09M7xEuaPdtB6j9pLJE4YIN7alkb8cOBcoo0UpDPpoGJRmonX4uAJswbwurGG0TtWYtll68pzMMiYVgDg+Gr4vjSHmVUUQapA+klao1NmhA0HPAVvvpI8NfQX4YwextfvZO6YTgFfmU+qi6/+7UfdRiuvwW+NptKTCBd68XeLi924dqnU4u5CRdDVBLdoEy9OLkbRTZzzm2RVHeDf24/K2ZihOy6TBl+OIz2CEUUbTO51kMEOb4DZFASrCPgVxK+U21HmJhU8zM/xlfLglq3uVdfVqteRR8LTtIHHD6cGHe8OJI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4873edea-fbfa-407d-2461-08db6e7f4b54 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:20.8409 (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: GNOEkstwVxuOXhWwMGUwoujR5Hjmm/jZr/XWQimaGWQ0cqiOz9FtsQ4Vbgx3UCJ9eLDZ4djbOyEpa2v/k3Blhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768875799921724330?= X-GMAIL-MSGID: =?utf-8?q?1768875799921724330?= 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 Fri Jun 16 15:34: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: 109213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438358vqr; Fri, 16 Jun 2023 08:48:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6143PukXwa70gsmG6RHm16XE/uiYNyoPKSbsnqglhKpsEuzOuvvG0PPbb6ZhxLYoblxRjs X-Received: by 2002:a17:902:e5cc:b0:1b5:1475:2f21 with SMTP id u12-20020a170902e5cc00b001b514752f21mr7592329plf.20.1686930522716; Fri, 16 Jun 2023 08:48:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930522; cv=pass; d=google.com; s=arc-20160816; b=i5ZEbCNvoD2YDeqVUmkb6gkzUO5QsKYbTTleuISZpMsm2mATPMDSG8RT1+6+q/0Ig8 oJsM+FITCujZIxrBB8gIgOyOYIhwyupDruCxxz59idrUgT1emLnAmqupn/Fo+RKNp7U2 ndpP92wA1EVvTn/qahcHoL2JUro0ojJZ7v1qFmZ4N/98wf17iPlj7LkEg1kORHu9sDuX NRtAoKxZX8NG4eaYKZt/6d0tTaAeOOsp5CUfjwuNjIAQ0j/oMNxDWNiHfq/i02qb8RJG 003rV4UpT+w4xcHjxP8JWyaGR2vX/l/jKtrkXIGy0bRcB0VPBq7GWReaJluCbocssb0m /S8w== 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=uZx4yrJC8PyxRcm2oL6C0QeTEWX0JtF5y+aYxiuMInwRig9hOlF18dPQz9ba3x27Al iK90t7UsDmDciHrsk5z/mTWzz0mnRyCw3sxkYM/h2wefgWkda+7DrB9/ZFkIs+MAjR6T b+vgM7TjocActWpDc18qMCZESfBGdUR+vdFUvfl9Nv99BB2Ob4HiDlGDJQv/Oa6o/nrM mHCvKN64vN44I6fWdgcJjYvYl9HOs5Uw0q57E5GWayfLnCKgQXScaCLGDSl1149ej1dw B8OPogMLGyBCUFeuOrzblTuGx4NWzP8SeFtVTvKn6zSTTFbaN3jdZNLuDzEpbxhywkYS /Wag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jP3ch+5h; 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 v135-20020a63618d000000b0054fe4cdd1a7si212860pgb.716.2023.06.16.08.48.29; Fri, 16 Jun 2023 08:48:42 -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=jP3ch+5h; 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 S1346065AbjFPPhJ (ORCPT + 99 others); Fri, 16 Jun 2023 11:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346070AbjFPPhD (ORCPT ); Fri, 16 Jun 2023 11:37:03 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A47B3C0F; Fri, 16 Jun 2023 08:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ejaJlj3xR+dps6WmueMiXpwWEONrxR4a7tC/FU9l3b6kU7zEOIBYZC/xeG3JYgVlIe/4WSd89P2wQ14MqdNayuyusnR3uEkKbFjuCsr4i1sENL4Wyy38U4yz6Uv2MGCimUFO89GA9CZMMevW+EjDrkTOy7h9WvuTYti94XJH2hYF2NdnGbwEcjLfultj8f6W1BAKQzcheDG6nfe00NG+8bhnzZcfwAdeGf92IvEaWdRgXP1XDHctZXbktX0APjySS1qnzYd18EgZ9UCyEfkjPoXb19VuAjoj91JK1siR+Wa9ws9+VH/5XurXjOHZND/Gf+3pjcYKuEeiWRa5+IrDkg== 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=GJ64CVVselD7dUxy8QCXfqFLI08bxpH8NHBOycTI9zxlBWYsDU0kSWvLeN3IC2xiMauvWfxYLY5ufgKD/3nNn1GVU9wmXK28XZ4OddyJV2A4v/VtSTSaL5BkqV7+PBiOqd+iMYCtXRQtFmIRNvi/Rd5+AUYYAlbK8RcWJfDK/WK5e9gz0G9DFZQ2dCOSUeE1mggoOAMyP5qZTcZ+aNfpgd20tyHIXqzzM6BpnXYsAS5rFcLAj8Vjg4XeoHy/KmYMSHS6/PwzoJG+gpffLwAxCce07CD7QdkC0DgpOlTqaNC3H406De79IfoTJTaYMCU0RuuBWHWbFrGWI87PWuBMBw== 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=jP3ch+5h6mDGQNj8/n4nosztz+sczuwmjr1zKyoP56XgjRwSKsJ+1BD2kYhNm2gGK7pS3t0Wu0Y1KvxbeEpkCXhpLUtReETNiTRGiQfBdnPJ0GajpM/OLjPD2VrNGIqveBiVzv1gf3eIeiJ1fQGbML0KR91a4I1hEggOBg581CY= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:23 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6477.035; Fri, 16 Jun 2023 15:35:23 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v7 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Date: Fri, 16 Jun 2023 11:34:36 -0400 Message-Id: <20230616153438.2299922-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f7802b2-e41e-455b-4204-08db6e7f4d20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BJeP33faT6vii8tWWnydh8f2BzQ0b7lyJCiTX7OTQVQI+Ndx8yNp8L5eF/gVBCAUeYUEmr1sXJgpIf+Rr5/nK4pk9Hod/Re18enpZ/dyGPhoNbS60nonqgqYnz+QKcrHTOvWGdLt7wmJ7L7ujTu3hWGuNuNg9K8yv80sChk4OAA+wg+NhXnvnhAzyPNgxIxkw9hghgzc9tT85vqD2YeTjx2rHbQt8sV3ApDvcPQRLP1ayhsgq+YVMjn+ZjfoseozwY1C+YPydRs2rd67OgmBx9kFtimANQkMZqOhJDefNzxUzLaGqG54BRoERx3az3MJTpY5Os6NBx/tjZndDlo1jsgWCgY+ZtP9dwERHSIn0Lb2Dj8T29y7wEdDZIKtLz8h7CjShlRnd+FT9+8fHiXi8pwDGSgWbpnaHEkGB+ZG3Kiep6VrzEYg+rb7ft0fCRW6Hi/TQRpagE7FmBeRS10gbYXbRtCmt9qEXlVxUgebME/VRryKnEtFOBXfsq4q5qj9pSyvZ8fHqP7l/JTC5X01TQ52RA9WrTBijtHm0mmfTQzbn4Flce56i+tVPU/tPmXyBpZ1+rmevoZeXdA7HoDLbOT27Wg+hrQnygZRCXHh0qpbe8r93wbwHVr9VPZSIxuJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(966005)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Me1gvLefRBRNp61LzEdO+9wRbB+PWsCLXi0gC2z539CKLPEQUGCPFc2J01DwZktxkWzQafH72rM3QGs+kyKtk0bBETSTht1LCJBK/2O00OYgwpMQ8Q+xfrvTxHWmNsrUsPVpeQzCvur+XHwFcnRDzJgMtBBctIlc83JSz5ehPdJ3oo98oH5DN6g6uKm8m8vwNltKu4lnCIRNZf9E5SCNsUkmWJQ+rQ/TuzQIfeRS7mR9uFAOPoyrB+DWg5zUWcdKgnSHkhYwPS+KkXTRTRbw/3zSPC03XxZQjRBc+tRTVxO5QwqtC+YdKTe1LayrVZEzPUuwqw5ZdgSo2AT5HPUQassi+DYYrUnHpqnYE+zARBoud58dT0zCBXyHXAbXH23N0pitRq73OCjg6H+pB2hk/bUfAN1HlPggi5UQ/x7LcEPIcztuhfEH2UDMwv272DnOKfK78IZEqSWrOA15iHYYJcUr/5rw9UBYbCxJ3zp+ggf2tVKnWE+VCpjXuQ4SWk8M1zldmeC4rVHse97OZR3xFNBdllmZzyEnTAUp42D7177+m4tVlplC24T4BiiuX7tuQOXlFa7xNplmjlLsCHtHaMxuV5BhRCLjIEo8LswBPFkVzcNwLdycxh5De/p5OwiIc3CyFvYStHGixeCbzg7RxRiMOSph1diRckmw0wlw27Htvp/tJ1xare2ckbIKnI14FjTJnIKVLscKnO0QN4xWkZ7mBYsBPDDPU3IwBzY9g+G0St7MQRws4597FxqdQpPMini8WpTeMEjkkvuliIoZhZjjEvt8y2U96Ldj1VA8GHqQBAAwxOHawzPuOGCqlbgziu1/HLsVmMDQxNgU7GTdYQIWS7YhgpioDYrlM+3tszhRBMwTLxxxHd6/TaoPOqODA+QCSzDxf7JidGhQ6Feu9vytgy4YUJU3mv61kJVaUHP+d8F16VtqLFkhH+YXVKLgxVMHr+0s7JaQU6AXIGJUgzWeFXWXRCPL37u0XkJzj8ayWuJQFmZ1+AtwDubBADu8sf8YCRyfmA4cB8DCikckcAdJmdGDt4NoKDO8rhwpgvtAIXVVTSFssaH54m7eDZouzGo9KQyxOKI5Z64HMZb+2GolRWkYYfxgZrRsPFZ5ceED0Ya8la+wDE4HkQlIUTfhvjFZB+1Mu8eixrbIiUd66GsvuV2GORJObPQPaNxvXuPAWzqS1u0ohHSQdUaT5TRNrtrF247Fft95UO3vsSAjkvDMGnXXPpY3N+ONqbnp06zCT8V2yuD95OCXWWval159Bdr5TRA0a9e4HgeYbP2sGLhIYA1BXyna97aTrUp5mD7jQYV5HYY9C+LKrhGPwQglAM4zfKsAfgroVVECfSBuwcekXxz9pXDzW5A3kVE3cyj/h1fcO5Mt9vubcxpBHPdZ84wYiwQv0jhR1oopd50+iF6pGx0y+v5UmUWP3f4cEM0N9sDKb/x+crxPvPxEKiYXLgXUcPxLYYChDvdbaceWVafELZatak41hEPU8DBHFx2lTtXC49HISrh97e+XLQ83tKAK2kz7UrYqVy+31wwIaP31ju/OVYwrzjtBwvmhcF4GrvaMroT8oN5pObue3ECc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f7802b2-e41e-455b-4204-08db6e7f4d20 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:23.8721 (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: TxHYCUC5Fv7Wg2hNpXdrLGUNkhLThExbssZncjgHxlmT6teRhNBvv3yxg5AnPn8EGXqV16YqcCwZyflSNS1eIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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?1768874860143322672?= X-GMAIL-MSGID: =?utf-8?q?1768874860143322672?= 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 Fri Jun 16 15:34: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: 109214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438466vqr; Fri, 16 Jun 2023 08:48:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Sd8JtoBPusYkGv+fZjvVCGUBHSO+OxMVN10D+czYIclQKKJwvRa8cXbrXy/hjsOX5Ryrp X-Received: by 2002:a05:6a00:1a56:b0:65b:38b2:8d4b with SMTP id h22-20020a056a001a5600b0065b38b28d4bmr2820779pfv.29.1686930531219; Fri, 16 Jun 2023 08:48:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930531; cv=pass; d=google.com; s=arc-20160816; b=iWGS6abbsJX5iqzN+U+ryeQAtKH0rmqNdktxV0m7peq5Zeda7bGlZuR/KTcB+tHdnW E2/kbtJbIf4HxNxR9cXWWXYEtpS0052b6LGqe+d7x6Pe6VAnTHn/peLlBU+s9JlLQjVy fmfUL4i6Vefmfz/9iteHMSTI4X9hwfziVLzoE5Vq8pycweX/aLJ8txY6x+aLziCV5PAY cbz1EUaNiB7IkKI4OBNZbKmgFemECa1OtbAz9GJh4wD421Uq7vAxjck3uOeSKzj1sV5p DHQwWnTyHMmhmfNb9oTh2wseH1/QDwE0HNToUFTLzmLnyh93mu1o/ajkWSCtkrcV54Ki BnlA== 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=oVRGXgkFn9GdR/jKOIEHjGZOcftVnDPqSRnHSjPamh+QAIgiUCyFwWrvcUWGkLmjrR EEHMVX+1VNOuVRwBKlRT3D3WEQwFUEHJTsdAmbm1TzLnBMfvCzBqeFWDkA0FKCChJIli /EC79uuKxsBqnSDgFcx1P98nCOUc9QDkBC+bY+YXGPVOqyqakRe3gHUqiDRNyOA602Pu tjfi5NffSoxaDON6swMAx4KXYz/LN3AZqYm0pSFmQ9WcIYbEri7uq79fFdZg+wOcktcc LkUsJlkqryD/M0oG5O0YxAt1/1vLOG3XqeBcW9UFI9M9X37wj8w9dyXlhc2gjqV8jzOW /r5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="Nv7eZ/e5"; 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 n2-20020a637202000000b0055379a7131bsi1449130pgc.428.2023.06.16.08.48.37; Fri, 16 Jun 2023 08:48:51 -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="Nv7eZ/e5"; 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 S245181AbjFPPh0 (ORCPT + 99 others); Fri, 16 Jun 2023 11:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346086AbjFPPhU (ORCPT ); Fri, 16 Jun 2023 11:37:20 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2041.outbound.protection.outlook.com [40.107.104.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41393C2A; Fri, 16 Jun 2023 08:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9TC1hWPaUz/ncv9Co9r9VLVhmgy4EqXxsV8ZBh/EbJg8KKC+/OdZ+p+iVP8P55/TU1GrJAGQW9NBWLX9NfBnUYjFnj2rVWJvHpaujgCC7jFammzIPNh9Z9w6Iban2L02U//74ncHS9rHd0iexA065ClnJZVAe58l8u4iMse1VrMXxEVZtuUPDThzI7J/AhbesG1eLaFCLaCiTPFroXeb85nYVBIK3m/7E6WY/U7HoyO2GsrGp12AlR2coBHx67BpVxdIOQdGPDcx2QFzwZmio06vXHPnnPteSjWONGNbGRVH3T0+b4FPzxEY3CA2OwvZgzi8JXxPG8yjmOEllKZUg== 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=Y069qhKpYLI8kyZL8kDTzSz9OqWUrn4iLcckH7fODLOaveMKSIAWbF5KMhL+e27LkGX1dXC9k7/q+r8ymlJqcSQqIKW8K1cpr3yed4a5BYdLv5shUIg5lLYx33DVSkuhn4rNmwO2Rzht8JF2cjl4uyNsUfWs67YqUax7Dn9KzPko4t2z/u0bs5cQ0vDiTvKjzsP+IkUu/yMMdoCNQPtbGxvFNlBcOdisjRWGV8eog1FRgVxY/2dsGgNYi1sESIJwzG+eEE7M16ouPW/lD8jHr1U9JqPkAk+seynMPeV6EmVlNltuBYagcsnHR6yyAbxALPX/+P/YbxZmCqTZCZ1Dtg== 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=Nv7eZ/e5sd+yVKDZZQNFxkJvT4UdGg6sr6kXx0e1ThqD9TCvL/+D6O1d+n0enZl/nHmaVbHOFv8SPsmNvttu70xI6Q3hPQrExwdeUe7DqIEGFOnnYSxUbJZnxo0YihYP32i9r5XsuV6jlbSrZI/Tw6GDovQG9vXwkkP8lCBJ/Yw= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35:27 +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; Fri, 16 Jun 2023 15:35:27 +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 v7 11/12] dmaengine: fsl-edma: integrate v3 support Date: Fri, 16 Jun 2023 11:34:37 -0400 Message-Id: <20230616153438.2299922-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 2794ab28-f423-4c14-492f-08db6e7f4f17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2oyp6BOLt/jGEqwwOicJZbQzuoAWinweuV8OSvrc3DO+a+I42mbXljnbTnu/D44mPxfWLsl63taNUh1leOrCRhtIn8W7EYkDlLh+xiVUfRNYGZNnyZKILfb49HGA9WF0WsAwTPMCiJjOX96m/wODblKWwQYHVYFLd0lkIeE1PkVgUyyaEcMkskI8Rrz2l9leQ7fYDHkBsx8qgsHRI/w1vA6DQzVZOzOFbEJeE7NaStgmZG0w46xbsLcsyYak0LQsokbIUorWqFR5JtIuEC3XlGjCmbBTouj1kDQHsL9xekz3QgSkeaURmUbLH/pAD9kbgrVpISSkdufEwWycrbjiy4Xkh+JVdEuAC0wszxQrCVGN7wB7CMuK8iC2ZuijFjlWJ3HE36zZSkl0pPgQCyMLXMpt8viTJ8HtND/AYvpWPYg5YHQVP0dxNMC2+SXj9+qWWSPwI1Xdkip5QAkQAlg0xDuz8bVGACzbj1TTNbnAxjFBedOH9eAJ1kqECvh4nyRwfAChOJbXBervq6sx5CbZ0Ik9dDx8LEjSUIMcB8ONS+n4IdEeqcOfT6yCFYYXYopX1Joy9Fb5PJ3L+hIUkIlqi3+NIBovhLEQ4fSksD7ke/f3h1r1VEC6O39wJYKmeql8rLdDiZeO3zn3y+pNAfCBNw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(6666004)(26005)(6506007)(6512007)(1076003)(478600001)(30864003)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DqLIajKrDrzB5kGhoA8thQkQEG4h/ainICrEPEvZ3d/XAFm1qktH63ggPPJzY1UV5F60b9OKc3jbicohlqAdbTU2HaXNIj2GnBkFbHmZygXc3zzGFEkZOjfYWJsExBNmwLsX1ZU0MadDmUJdQrZGzHY98Vu1MhAD7Sm8GUr9L1DvK4mTzlx+wTjqBXA8L0UeQHZESSdNVug+0PSL34qRroDocAZjMkC/Dsm74rjRT4t+JZ8rDPJLhUg5KOM34qhuz9WuI0ufb+Jz7//3HzqHmTzm/jsjSWuMgoJhmApNgK4A1JL+DpeX2Cr2XxKkdsXLTcXzkw7Qj6hPZsPTJEua0VVKN4nYbi1UxvOf+dflRAZ5d1mD9oJkb7SBVaJTOqSoOnb+dJ1Z4t6StRzgh6f5TQxyggmGzIJ+SK9OZFl6s6AkyGRz4zBN8AytcBn/03Jcf/3pf9DHEGd1oBN1eO3ZP97r9OSogv3nScqYEQR3r2JYXlsexlvdHwhP/DfemwM/JxXLuVjgLUybnwbPJEVVnTTCwFhuGXYnLsRrm/zqHiqGSIPxBy6v6BEOj58eH6ORdY/bfKMc5VF4QQtpfB3LtOc/f/GCpsSrEeRImbYYlHCJsDiVMdtETOYjNMLVmB8NBQVXY9YN0kaH8i3uOvB69nP3mi0WlSvRsSqb3DFBzdqH29IYYb5IHhmKkY2LKQjoPGVDyKQmgI4Q0EnnMNr+tLQQRTwgN7MiNf8ktbfd1nA0KvkwCBxpW5NGhNpLgO+Wjk2TYRcGCi01Rg3fxMpvlqnsVKYdJ+cL/Di0ZSPGB0f+PEPdIXJSo8FnNJXesKgxfMtwRWEsonyKaYDpbGwL0AD8GnW8j5hGKTUWUpLfYBBtrdtaDWoBKZfNgUJbNJTAUaCUMjb4mVAHEiosQKzfj9SULX6EXydftfApZMk1lDPjQFaZ9TXWRWnH68IX0LVf5l4d3pzYVJyDxMRjOt/1nKOrYEgvlF6RZtZhamUmfZYxMMVdIYHaYaxHxHMlc/Q4AnNh9SGaev7XQelI45NGkT0Byy/OXiRLePlgCylIK7cfqhl3L9Y6abXRmWae6t+vp1yo4PklsFYXY6n81i4UHhRgcFOUKw9zJ8fHJ+KPdcsOe74YTt/8afYhond0tGYhhZ2mABb1fK906GHfxUQafCeEB9pelXRl8zieH1HaMGdFjqwR7/T8pdVOtQBJbSeVgVW1Za1zV18lIJme5AqsTSQ4vKvvpWkAwDhh+YuQp8dtb7MqtAdX1lScKDx80FFOq6bwr1gibWqgoGuo5Zg3YPvdwHEA77ljuulp8hatHZSlE/UJoFanBUudvIfTD3g6rk4QLWqUrBL+ltdqo1BW5OMxxzi0JXngp5Z5xH7VdQ64olBAjDP7ZR0PIoOTF8+r2jEiLuUP7YTBGGgaj1iYj93pMc4aqgbKalkOvOwaZFgbenOTsWDHInJTFEZCdgBrAqPUYT4TmvvvBOi94bU7I5UjcNvspe2ixtCGm3JhvVdcZRtbZyhYEAVWF5gkKq8ItjHG7knMoV1yRPzbJHWKF20gOwycrpdlS0vvE0Tt3w4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2794ab28-f423-4c14-492f-08db6e7f4f17 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:27.3262 (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: fHd8JBghUVndnO17BWzh/FB691ZT/EPOop805jOqrt+CJfQ3q6C7jSKebucYAVR8klAvoSAQLXUfmCdTfsFQbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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_NONE,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?1768874868747098016?= X-GMAIL-MSGID: =?utf-8?q?1768874868747098016?= 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 Fri Jun 16 15:34: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: 109215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1438560vqr; Fri, 16 Jun 2023 08:49:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Z6M2q9XAvmrQYyyNH+/HtroOo17GPwJVu4KsDg0g1XP3QOTFY1Y1grEmVLHHRerlM8nuq X-Received: by 2002:a05:6a20:4320:b0:11d:5ec:f6be with SMTP id h32-20020a056a20432000b0011d05ecf6bemr3102669pzk.60.1686930543371; Fri, 16 Jun 2023 08:49:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686930543; cv=pass; d=google.com; s=arc-20160816; b=DKv3oYeopJCZSKonGL9ep0XHcgaM71azT2ZN7yQBMVAvhlooRCzOG6lCpoRJp20qpN z2qas/Rx31aqt/n5MEbjMGME56TzEP1o4IhPGQUrrBBMvXXQ6ZW7KWVHjgwi09SgfTli AZFS0Mpc2E1tONDq0C/k/alahY+/gIu0nMweG6hcCjb9DyzPvYUbsr22GTFDILM7muYK eMnvnpa8RJSDWI5BXVXAvkEapHuT2ZyuGk8QdTflrtA8/HO/DoLTBmXfBunljH3xeZ4u HTGVUbiAQpzy8RT9FJ24XJgLo+xq9IDTbIRaDjy6Ep6jw4QVuz2stmvPb32EPqf+xp6O bLMg== 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=k3KdPkFxbxRga7c91LrqNvK4Hz0q3Yle4Y9zd3COpac=; b=G0IKUSv4tLoly7Yq+1EfAMt6NZRaCTqQ9aFgYDrw5ED7JnHXKqap8biekm1Gm8A9tk a/VWddCnAywSskx2T9grnq+67PD18hxeJ7OKMxPptuTa+0QZXdRlXrrqMS3lilZRdxXA w8gi9IHF8uL3tEldQCo5ko1BI4excUy+8L3e+JkpsKIf5pqg01Fh0bJB/285pKJuVIFg lRnhaX5zwG0XA5w37KnBRQKP7P5UXYFMe7lRa64EyU9fY/MbzTnV5ntTQObYKLZ83Xsa H1rCAumx8s9bcoUfJq1gVyCDeHIpfWuaxovAuqYKCGKkEridIFUJEtTKQ9t/RYzrLFWT rKFQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DFz7TO7c; 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 w11-20020a170902ca0b00b001ab039a411csi9631453pld.17.2023.06.16.08.48.50; Fri, 16 Jun 2023 08:49:03 -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=DFz7TO7c; 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 S1346100AbjFPPhj (ORCPT + 99 others); Fri, 16 Jun 2023 11:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346098AbjFPPh3 (ORCPT ); Fri, 16 Jun 2023 11:37:29 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7FF3AB4; Fri, 16 Jun 2023 08:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/TIqBpURkn+vR3CSiot45a2yYU0Z1PFj/jAvWUBz5KGRPejUBsaclCwhzHlsSe3uapyJFBgqFnta9631eXIJcfazuC9cQJxnz5kGx8trQAuyDWTsXDW6VjCHy+kKt72uzIGonCOJKaWpXvRJuJG+fDFNq0IH1Xn04+NtAQaaoNPdKpmm2pppgDRUrlmV8vALtBkxCVULZJmu1CFsKTF+F/sTbUBrqxsXmHfMcCe4h2s1jfhcelYOvMm/xyhc/B5y8Qf2/ZBnTbE7UzwynzGBdqH/csSwwiKIp/B5xH78omx08FMvo5kTr/ni03eunOl4+EygOVUx++her3CnNS/HA== 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=k3KdPkFxbxRga7c91LrqNvK4Hz0q3Yle4Y9zd3COpac=; b=RG6eYBI2wyi3qyp2luxbEB+rXhM0W1lLrnej/2WBVlBomj9Dk4AuephPVjkK2j3Eqjd0LC1umvPsj2USkWMX+YNZX8YqjwTPhJ2YVY4VI5qcB1OKd3+jdKSBcTsmfSyykhrgTUxzTckeqWZ7x3vAlKyvqvYn3qI4MInu/EPOPJBqbPPsZz5vcWLtJ46AH53MHFYEjWxqfHgs/BRFuFdClS2FlXQGolRlnTT4oQa9URH8NxrvUm27haDyPrfMF5+2OtU7Kjy1pIzlO7mtovxFeqgtzRkQm2Zs8DRA2NVa+3f3VWNmf/68zan9AdDPUbOv1lFSrHuLmuSUH30Xq7N1ew== 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=k3KdPkFxbxRga7c91LrqNvK4Hz0q3Yle4Y9zd3COpac=; b=DFz7TO7c8/Ww5XISO2m+Il/D2RtGLgKWqqLhL6UPSf49tnNYiC+LET/SJRTMT4ysv0JbSLk0HwlZKdQsMrBR2UQG3UidlqCRdQmDpOL4rTLvh+1UyrqnLpLc+C18k1Ax4P7j46f8SZjaNgPX9jjkBAo6pLigc3vIqDVjmIyyPqM= 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 PR3PR04MB7339.eurprd04.prod.outlook.com (2603:10a6:102:8b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 15:35: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; Fri, 16 Jun 2023 15:35: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 v7 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Fri, 16 Jun 2023 11:34:38 -0400 Message-Id: <20230616153438.2299922-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616153438.2299922-1-Frank.Li@nxp.com> References: <20230616153438.2299922-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0067.namprd03.prod.outlook.com (2603:10b6:a03:331::12) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PR3PR04MB7339:EE_ X-MS-Office365-Filtering-Correlation-Id: 592b3c3b-8171-44e1-7b4b-08db6e7f50d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O+Rcq8l23u6uQI7J/oRDNeCet6VzYesO/lFH9FiOIaQ4E1JXJG5t3VETniRGWljEDUB5rT/orAoWeUFxqrv96tE8zSle36kaifVF9/AMc8No4OA+CGHyTv2Rs6PdjGhS2SOJvBBIvfVDv8JmnZChVM8L20ycNwpcswf5cP0PwshNG3rFkVwFFyqmCcqy3GLp/mgDfvgh+MCiF3my/Icb+uST/ueuv5Vd5C9rwKzudd3eww1x15YHiutiAgE+uHyshtUqRVdgAFSLU+Y4cnxdyZaHe0yjn5SxqLO1nPk93UlTVMjoLlT8ho+qfv6CwLOLZON9os0hr+W8LAFFYGQiqjpU8mR5BRxHKTsNvpdzs2E25kK0+QpZkYHy5gIPr9Es7iQaDJOY/tm0DLxImVD0TxJXh9rpAPlzzzXWnCboBsbv9prJvsLbOLNhCe/XSjRRIvJ8a1Q6MeAelhUyYk871jUSHCbUmfCkyAgR4f/EABRvzEPtnQ+3DrGSoc1SBwILhnJYKxP77UWPDqtFOp9X8mfIV44Jvwcr3/cqlJq/EcXbIRYZUlkFToKMzRyHoKPFtpXo6utvQ8U1hQiXTlhZjzRGWKsh/GcMp2USnSUFAQNy6RF0ov9IYMS6vdoWUF9o X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(38100700002)(66476007)(66556008)(921005)(66946007)(316002)(2616005)(38350700002)(86362001)(186003)(52116002)(36756003)(6486002)(26005)(6506007)(6512007)(1076003)(478600001)(2906002)(8936002)(8676002)(5660300002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +TfYzHgEIXwwfsCfS2yL3fG4xeQTBvfCdcLCIqz+s7LLD1CPVlz9ImQkdladQF0YnfxoW0GsCXqRFBUBa0Ztls2YgR7ibdYJTZ4acoMv8jnzu339J/vVWbfalCLN5Ocv/11IsLUMrMyFvVx82ncRcUujHfmw/7FPuc9MD9LCX0Chc62BHzSyqSw9meSEH4LM4Ys6KaaIgDxLQ1+71M2svwzg4136E0SKomK8VvEL31FHY5IjfqZsW740aw0MWof5fqPVYusWuoIpHphBYeHTnYwNQcmC+YnC5tobgC8S4/xiWzXm3P6rLLpgP5F1L8kIW/YElrvgxOPlRFWQ7/iPbC1qZZLst8yb3P77dZSbO1ENkQXLr6R/r/V7+29yichzjVy226qOFUmHanp3TN9nHITZExuBbthFs5w4h68NLpwgtCeo67zDVtPFFaJiNN0v3fOukdzyo9vZolrZRCJyW9RQ7qiHVbX3SPDWe/wH8JVUbCD5TkWKfgJoJigy83y5RnfThr2n5miebl3E7OOKrBvbxSxRV5+7PtDKH23xY2zlDLTU/Qb3jL3LPgh2tPNXV7JsF9pAcZgtzrPKK/xT7r8+cGITT9n546lKBWVVdrxyxEAUEJivzocHC2I7wWkZYsB800WqeRE5rVVRHuVkFR85L0QKq1spXQ3pt7cMNGRnYAkveEX2D1/a83o2bygIGE2CSxNfk7O6bxtNG/SfAwW20dIWJJ9GEgdFpQLYGlwy+BoV0fg0wYgA/iWVhpZG2LAtr4hE7IEWJwrxPu3RTwumWZBRZshqlvTBisN7V7FlGhNY7ZQt2c8vnFPuPbMFaygoqdPHe3M+Vrh2aj/cJtmp6/pwL+l32ioCA/1E3vQq0JjQxOeVCLqbhZZ6Q5Wk1hcOVorlbAlmkMZdWhFpvf3nHqPcMb2yhZ9htzINvMGZ84w9auePsEqdP8LKCZtvtsnzY2SRZXGbDUYKas+MXVSn5PawA3UYcBGzyxa7IGOH1fnxOC2dp5C8derIy/vj0dhIwpQvY9BEqKOLkMYNzZucj+Oz2aowDzrb+TT72S/STom7sxoJIR5K1oEodJUAm4dK8eSCNKTXwC5+tunsWaZ4wzDe/Cs2QE0hZqjCdQ2vQvyRfXzAsK8y92c2rteQD1+i56okqj1o7SF8+eWrwZ8GU+rQDIF6IKcj5tgozRqTI55Fs+D2NHz/0IDT3U/ae5aEFqq8JIwZpithX7zuVZ8Tk//99Ob7ECO353mY/6xvp0XVaYijP/y0hlgpCjVr+EoUOz98ylTQwgsfvHFNdaLbfssxwgedGNytRhQsepaf/yD4sFB3/cK7pIPhqrIVOC1D+G+FeEFB71OainBYg/g9clpDHpXmD5sZGq+LTwm+lZHtmeatjLc6gt4MVuj/SaUimOl0sV+2uoKkarV1nXra8BjewHC91xGAJohk1+1m7ZZRfal44SAZ1dSGOMMpPWPH9KeWTAoQar5n1qvJufBRHRzyH6ZLXYgPVBby7wF86QSHE4XBM+QA9lYOcijS7wX2lMq+nOeGC3DOumF9bA+9q+7d53Ri2mSL6nI+JYk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 592b3c3b-8171-44e1-7b4b-08db6e7f50d7 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 15:35:30.0914 (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: BAa2gM614DNrolBiui7Cy6hyYqvbbdREBOiPXDOHLhqrdrBcZ6jwSGx5r9wluf2BxapU6+cCErxywfZSh5vhWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7339 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?1768874881637197100?= X-GMAIL-MSGID: =?utf-8?q?1768874881637197100?= 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 | 103 ++++++++++++++++-- 1 file changed, 96 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..2363c10e0d1c 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,26 @@ 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 + - if: properties: compatible: @@ -72,18 +101,26 @@ allOf: const: fsl,vf610-edma then: properties: + clocks: + minItems: 2 clock-names: items: - const: dmamux0 - const: dmamux1 interrupts: + minItems: 2 maxItems: 2 interrupt-names: items: - const: edma-tx - const: edma-err reg: + minItems: 2 maxItems: 3 + "#dma-cells": + const: 2 + dma-channels: + const: 32 - if: properties: @@ -92,14 +129,22 @@ allOf: const: fsl,imx7ulp-edma then: properties: + clock: + minItems: 2 clock-names: items: - const: dma - const: dmamux0 interrupts: + minItems: 2 maxItems: 17 reg: + minItems: 2 maxItems: 2 + "#dma-cells": + const: 2 + dma-channels: + const: 32 unevaluatedProperties: false @@ -153,3 +198,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"; + };