From patchwork Mon Jun 12 20:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F285DC88CB2 for ; Mon, 12 Jun 2023 20:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbjFLUfE (ORCPT ); Mon, 12 Jun 2023 16:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjFLUeo (ORCPT ); Mon, 12 Jun 2023 16:34:44 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2083.outbound.protection.outlook.com [40.107.104.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC17910F9; Mon, 12 Jun 2023 13:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chVWX8MAtl60FaHQq7zVFDUjpnvNq6QJW7NzWtDAAq5pFPEebkIz/SlvZ0R0W2KoasbVzMB9oUEcEsWnoAkaykPWO4RItNbFkyxRVV3h6uk3I41NeZmShWL3mgJaB/mbCLm/GZGhZI8xbgZPhzk8iSN2AglfQ0XlRTxeJgEPI/LcjxcQdf6Agjo4aapxV3rOwBb63jhNIBbZFysmnDiUqUiLwh4BEF5lemgrC06g6ioMxx+PtvseKfMVSRuFR8WB4w2HauSWPJf1JA8hbQ/5AL0LNEDr5q3Yda9HeNNH7HTM63H2ElBgJRHQnhz7pIXzjDSWphpi2p2grz11Pe8fyA== 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=VcSArXlQvvCHOiuCWeKcZ41vdSpVAzF0XzOmNVJDt/rUcqMo7aIVSSu/FR/MpHsFI2xQWqglTFNzRAm18vvRRjm6L65d6xkjMD97v/KpWz/n1nIki/nSp7hRohCsWDv60bGjkS8mq+G3cV/z+jP5epNE3F9lgkUGWqm9GcABNaBGPUEsXo7PnNljV9byWRZ3BN+0MKje2uu3wZt/a1lXC7ArVw+OdiHeAd4UEbIb4NVAI8upO4LnaEiL9/68PizxB5c+X87V/MSgF9b98+Z3pcMhXWz1RQ/TiwnBb+hFwrhGESl3v3qqw/9CuKJpP+mgMrKKMpLTYJLcgJcehLdf7w== 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=P7IHflzZUqhIKR4VswW+G12jNgAKU3qk7RA9Rxa7W8YW7/DrASkouIdsruVO15xjaBj/yrKj2VKTyKrD5wbfMOsFD82IR2Sk16qugl1ZiE8sVN7u4cQfciSw25i5baZh+qwisj+1o9xmFONPQ8LJggZvWxAi2ObpWS2SurG8II0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AM9PR04MB8907.eurprd04.prod.outlook.com (2603:10a6:20b:40a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 20:34:39 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:39 +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 v4 01/12] dmaengine: fsl-edma: clean up EXPORT_SYMBOL_GPL in fsl-edma-common.c Date: Mon, 12 Jun 2023 16:34:07 -0400 Message-Id: <20230612203418.2017769-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AM9PR04MB8907:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fe9588a-a470-4ec6-656f-08db6b847204 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Rf65LNvBmdIIUS6mu1CRbqQQU7h/dyLQZYm9Yfcuq/scvPxPkhU6BxCn3QsB5mLEluAg3mFn/DyYrplXcNaDiu8HBX6ukhBOnohx6kkXj00vJuPHNlkSch0egAxqZd1IceeAGlVwyEOlJhHUrl8rswY98Qnzt1gfqdFzToc3dhcfMOCXUmKOSIOh0+VGQTBo6LtCtD22Ah/jXkpO2agUZ1y9/4TcpOI8yk1kuiiLsMr6fMbkWhASGedty7VGG0FKRl8YIUqOBZvHN1UkKT6EnJPIjh3a1htsdEvmOlv2BKo6cIxfEFjhSub7Q8AAx94lldvAj7u/E9DcLlz1iBxi+2arGcjg4aJOnP5y+u5yOuCwaOoP1Klyv8KDsbEdfiPHUEFWq972oKeTEklxfEzVqpJKocESEqUcFGEaA2PQTavkAWmG6C1GPuPGJEAEIF//M4IkUzKibtDqUaEAZrLrlnJbvwp3Z9/BaPx0e8PE2xQxs1/rVQOTbS1rPvCgPUWdgizBatgfTV27pAd7pfsdtq8ax0xBsBno2wAqy7VcjFeglqihw2sDiLYMdAIvJLfdo4YoeIPKbQ6+rT2mVpSlUiKctcMGgHQzZGJ6FMizT8qJsOfExPamCShMCWVm4w0bl1Dq08w/HbIT+6nHeaOQA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(366004)(376002)(346002)(136003)(451199021)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(2616005)(2906002)(8676002)(316002)(41300700001)(86362001)(6486002)(921005)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(52116002)(38100700002)(6512007)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uPokkCLT3nFCST6KU9FZmqfagu+ZNoH6qR5Mp02HQl/ntAp2DyM185fbGF8x6ruO5EhdTddoqWQ4AbSbQyZrfF/ZfUz/XGWsq/J2kx+Rqi5rEpZGsweJVaiJY+cxCHeoxmDyvfu5pMQHzOwx9YRIv1U/RAeWte6bbzsD62LfBNfbruYlXdCSgUD9CQIcaJOCrD+Enp0i6OARDoahuoIDnwFK05qTXoUsHCncR3+DfeBvW0gtibXSttb+NfdhGI2DERxVJnN9Go+NTVay3zaOspln1E5QO92m7hbLZSYr/alwekuMx6epcRfRu+PRijeQJTIzhp8gwEHE4d56f5Q58gJWZRjeHA8gBhM0vZRuTvbRmQp6Vebjt5hYFssruE1O5p1WZ+js3ttnioWOekCY+980OXDRz3dTTIx1+KP5myH854DuB0eN1fUiY0E/BThQvZ+uDM3gKlyE6aF1udUON5W8Y1EljjQ3lMV9NecXucT0pQNKd3dVqKrGd+kBK+JZUSuOjqrfRbmIVmahqNkgQ6E054wJWDpMChp6rTIc7JK30hH2kkTo6tuYmuRXsKXLm9Lwr17VEGbCItlQP03H5oozrNuVSUuJQMF+EM3To/KEOa1tKqZUPlKJtN8TgtWVHZIPxLIdm+2UhfSES+pnCQMjJAMr+Ot5N+GdhiFVzv0aD7FjFI5lgheVs7nH7gd6LGQ6JDpo/KiOQdeR5JnVnKN0rFOrx1PA2TjDALSeOgqvE41YsBekd0b+7K7XbuEU5GNHWxS8rxOr7RPJM8rIdomld1wQ1eOFlGgDG+QPDpDIPvO39CV6zMIK2eYhRCgWFZ3AOFjCM0TnhbDJOwYCaeJEstez5khqpa0jiRK2SewTTzUkuzAAM28ai216Tv0iwXFJxGMb22qdut0JNZEoPItMneeFbZC+8aOxpgafVNxk126fy/Qy/jIqbosV8m7C3EpNQfzDjqAJuyaxFF1BYuNks9s8kLnwETqCfMUmFEIZdfZFUK9rEbDG904a+T2mV12gOpNTmgl7C8LKhba3ZRTaR1D7/aKpVEImhUupK4GgmtQJR3EEzDmrzqdBbVkEvzBOB8ANb36Qe61bIX4kPkLMzIb4KV9sE6UyS0elA//GuXkj/dvHJGaY48KJawLHB7UTuCIGB8yLgsDZQhYE/ky/udHO7QNj+ullbbup6k3IPn0oXH5xp51Bhohg0hzDYoc1YIszjaXjZxjvrejxQ4Ks0gwf7avSS7PbCnxXrs6kFwENct/CpL0punT6ZG4+mWRRjqhSswT2wgHHZXzSSlgZSfYZ/YiavmVLk3lKPoOoR4tmgiiXByp7kIQsPpqOGAAqALLTq+peH0Nj9zvCKAxt85KPy1EQmbY+lOB0odF771TjhcMriPrjacO7BmmaM38Mlgx/+vbFnZESIjI75YCIRDeNpPoJUckrwcGPiZTqw7HSy6hmdbO0RU3LWBUx0P6CcyNfUzgi/sMwvxHVMkmu3EcWBWHLzaBy3Vi+GCrXYPi+yborW2qI6u5L6CVUpGjkwmQQL0DJzwvvUyuZm94QtQrwgdnN9FzAcFWtiNg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fe9588a-a470-4ec6-656f-08db6b847204 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:39.7563 (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: OyjOqYvFzQP1aCocwsCJbacCXofUe2g8veSU+3/IqTlMkkWTN+7OZVY4tTg9knVGQrU6e5AHMcreZJnLH8fg6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8907 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C245EC88CB7 for ; Mon, 12 Jun 2023 20:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbjFLUfF (ORCPT ); Mon, 12 Jun 2023 16:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232597AbjFLUep (ORCPT ); Mon, 12 Jun 2023 16:34:45 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2083.outbound.protection.outlook.com [40.107.104.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2E9E53; Mon, 12 Jun 2023 13:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IRGF3q6NeO/S6AVhIf+AvWPO1sNgVK6sm6va1rem9yUOexEmWKzzOF4XbhWfXOTmZMzAzjDQsvoHD9swYL1kfnjZfGnIWfNKvRB7VkCoRxxZxZzseSPSGs52u0f0xJK7Abf6WKvwGVqbY/GO5saeD6jUdZtBlWoclFwVLQiPWXN9rTlvUj+4/1nn4smY/o1LLLdW0b1jEZobHHUGmXkTJRMalYoF+gmNiLioGx/Y6wacDTylcbVg3h+aJbvQQ8BFt/QnYs8mc/nD0jKrTiSNBawwnlYPLE0FsLxp3hUyQUspraugs+SmAh6b2g5zzIIoGxBN9XpNctOEdESeW1amjA== 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=kGfY75RWVQVRoOMbZk0/ao5e5LWkEfqaAyVknMBFk2mowNdu2MInyW0nKexvBdJLxr4XDXXkRvst0Qk2oYz0ns1fqdBPjxLft7UWHuKTMnZdOlpL1huk4h4xZwZ4s1j32zGzqedB8uMoKDS48aOvn8pxDu4djEgxV4dQwCx9S3oFSAGol3scGAEP4yZSxrQ9GHVQaaVsQeuYmLv/o4VUN7Q9oGE0JKQ3Qaep4u80/LdnxxpzYme7J0+jpiZqmGt/Z9xiTxWNnl0ifKtw/9ZA6mzUtZywUxuGyB694k8NC8Rh+Po4h8ESdeOwarPIc1KGJvqKuqIXP+mkCkuU6cnJRQ== 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=X7t0ef/0+I00tFFygDpPcw4MFKf+8qHlp7G+9LrN1Z9QL+kNs9MYXp3+kyexNd5xmWZACtsJYgpZiDccSsFrkTQhh32hmpFYwll6e9vOWvjVVSF5Srw6DFuNFs+q3dtzix7vVK5GMOTFxWvkU32cDsM0Dh7nwtj+2lc2CgHeKac= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AM9PR04MB8907.eurprd04.prod.outlook.com (2603:10a6:20b:40a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 20:34:42 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:42 +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 v4 02/12] dmaengine: fsl-edma: clean up fsl_edma_irq_exit() Date: Mon, 12 Jun 2023 16:34:08 -0400 Message-Id: <20230612203418.2017769-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AM9PR04MB8907:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f6de7b5-70bd-49b6-6db4-08db6b8473dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1vtiZcESxeow/w12Kld5NXkODeJ0dz5Icxu9WH0oYvWNIHPkmPLYZMG19qI9yijoi69t9YhnimIzUhNOp44B5FM8rbockcrL1arcnuKM124+Db7o/rN9AM74IGuLnoiNckohdDIczlAW7TyVxvt3vpgpHTKcnxdkZaPebLUMuME/BSUzxo4D36alW1AfNaYIkYshyfnuG7HjSuniNWfagtd4I8JVomY77dYm6jPv2WEtg1w2FcG91zfuDb8G1y9O0B1tf1JhvTTsuKyoPmALe0h2BsMSkZffxfA02lNsMmNzqoVf19OmLbSIJabZCI8m2lU5anabm61aGp+VoOUIfxW0ebJ5ZmRmDYcwRsenWDFBbrRoBf7RD4Wp0U7Qjn+o24t26P0O+4nXeLMPlO83fE5axn8ysCjUhzvUX/yE1eql5mcTKO4aJn9ICWGtTbAEUJDGANLEgzFOYMRCwqBrznQAk4x4gLIay5AAGJ1P24+ZfgPPGg0FhP46B8gFGq2p08K6GoRyC/F1s4pGZJqcdqOlYZ9NV8tRK9myPv1kWeeI28UMb6w3PV3aqrNXI3Zn+ObidITAmg5U1gJhI4QhNKo9FqIBY5bwh4Zp5lJeFkGMLCasW09V7+zQxbllsFfe2B8iz4H4aPefcjTeBDuf8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(366004)(376002)(346002)(136003)(451199021)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(2616005)(2906002)(8676002)(316002)(41300700001)(86362001)(6486002)(921005)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(52116002)(38100700002)(6512007)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bANhtFmkz8h5bPQSGinBoO96HhhaqOo6Fs27rkg2Iu9HeIliI1zpGHW4HKTQMF76JfDYfPBwzKY1XmacuB2Kmivh4jf7vAnGe409TAL+jnbJxg69sNmRh/U5IxJOCEG6onDjel7wo64q8Q/w9Ys0nAP3Iry1l+ftGQ2OreBRkU6r5mvzVkyqOavWGqvBbm2eaVadQHHXErSkDn/2FIuzpgozRPQaW5Pno7LnErfUYk+6T5J7tohfA91uB4yuQr/UhwZnMpsGoisdfYhxXNs83SP/7smyMCdWty3qqZfePk4SF+lp/kqGLX4du+gt57PipYInXsFBDdid7AXRYGgsucS13ESzGdt7WuLAoXgWWGE4POekhSm89Shu/4ONVDE1YmXGEYqdf7l/YhOU98TQWFRYDF8s+u8EjCh/fA0/mPtF1COe+hN0yALLbed5BTjRu/bIYq4wHJ1rHZM7QL7MNjBF0L7iQC8/9RHoJHbJ77s1gBoen2Exk6Q0AP2ihXAAKMRM/GUujGrBv/VcLkPd1e71UIMkbFl8sx24vyDaNaNxvolcBaRDrNWPqdWcBD4QSMciRKUAOZSoI3UUgPBHGfTvOkT9gKN9yl7ig6YKYe2RK2UuFsGuJXs4PFZEEnwGQSJYSHYXbm2iokmPIMqKD56yTI6lGpWQ3owRqKSJN/I+7Z9C0ihVDawvAjO4TP5BLBWuji+yOITbsBnpT4rMn6+O+JCwwx9n2ioYU/dG4ddTsWDnB5oaroSSlaXoj8jsG7NOyUb1G+Up3pND+nuNDT7d5MoGP6d5W3rIHrtzBOgisPnJWZoW1hJE3f4rbXFQPCBGg8KVLZf7jdvyUXMSdjPuS/L7l3Buz12XGklM8nv8PiVHbNk7u4ge7bCGUGp9LsU5T4GOV64HXpBU7Y5uyWOTZT0VeGB0vUAIRcI54hEHNlxzX98nUmAAFPzvOvgAf+FxO8NGlT8FdGQh9yz5lAqDJrHvjYV5ZpN/wCXgM5WFRAt2gQLM8OzeNT+RLn0GEkgRs3IqwjCgFIglxjj5ehW2A+XTWAi0q1E9zTjTVz2dl3BFCf1Bu3MyDVpkbscuGr/sqs54Sk6WB31cCQRKIGmMQtCEeVP6Kyw5LsBaV+3DbGxM0NoHpIqePX+0rb1h5D7sa1l+b86yH35HpYC22/fYfnYR33giIfhEND7yIefRYvLfcMZ/4Rli2XCZNks6AjhmyovHF9zSxHmaTqQKh0ILDQ9JEoznbbRsmzNwIX7Bxr2Q3VA/Uz5Giil/s2XHn44tmgGigJn7w/ip2DA3rLwgHjU8j5cR/KoJrI5Wmd28+w4mUY5O5F1kDbPoBMJr8Pp2ZmM5MiWaU0CAmeGa4XJGbkJeRWfXbLEPR/PzN+nO+k/dxmO5AxpXRScgYbesT/wamOq8uPmiu5ND2jVDC0IGeNHesnQghIIKUHlhmTXxUSsYtqMdRhC0jp7vhtjyh1p4+Wd5PXodEsND0KoSTAtxFj/uTXHEOnwXD1t/tyO4sY9Z2G3G9qw/P3IoUto9ZNiVfCQMKmesYfctZuSFRxIRSmWPtGEhWJjE4zO0PLpKNBu6w5JIlTk8gQZ0cWX/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f6de7b5-70bd-49b6-6db4-08db6b8473dc X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:42.8239 (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: QXuuCXULRuwsuCUj3HwjM0W1Bg11shQDkNd9BmIulIZXfwx//r3MK/xjR7SNDPitcsxwB2IHqK4nJoThbT5Y3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8907 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In the probe function, devm_request_irq is now being used to automatically manage IRQ. It eliminates the need for manual IRQ freeing during removal. Signed-off-by: Frank Li Reviewed-by: Peng Fan --- drivers/dma/fsl-edma-main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index e40769666e39..16305bb9a2ef 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -216,17 +216,6 @@ fsl_edma2_irq_init(struct platform_device *pdev, return 0; } -static void fsl_edma_irq_exit( - struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) -{ - if (fsl_edma->txirq == fsl_edma->errirq) { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); - } else { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); - devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma); - } -} - static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) { int i; @@ -427,7 +416,6 @@ static int fsl_edma_remove(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); - fsl_edma_irq_exit(pdev, fsl_edma); fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); of_dma_controller_free(np); dma_async_device_unregister(&fsl_edma->dma_dev); From patchwork Mon Jun 12 20:34:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA19CC88CB5 for ; Mon, 12 Jun 2023 20:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236574AbjFLUfI (ORCPT ); Mon, 12 Jun 2023 16:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237496AbjFLUev (ORCPT ); Mon, 12 Jun 2023 16:34:51 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2053.outbound.protection.outlook.com [40.107.8.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E6610C9; Mon, 12 Jun 2023 13:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUtR74nhU1M+O9tAvKmgvdnIsT5S9K1PRMjAQexJa/KIWEKSqcIowVrTrKooKnnNq26996E29pqGhN6q71RzqdvSHDrUIldueTp+3E/l/oj3gA89ci4VWHBQlXJNCvSW6pjFPxuBYkYvZR+WFs6jdC1yjXUanV1btVYd3LssWLEIu6g5QXqMuZZ7HsFCZp0EeXMHHvz84ZUqGp+X/BmwoTbW57QseFwYuD4HQXS7ZoQFMMzTZoiUv0jl7XQfu+phmSzRr+2WAKRnq9zG0XxYiLsSV0qNe2QjszbMsjwbK5RXzSsVII95igiHvscCPonNtHzuc28w1vo95xjbkCpy+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w5Juf3kOYMDDqoTfA5YQdmkMKOm31LEp8hl7IUV/jfw=; b=KCjQekf5f+CHxB+inrtv8Ae+haig+cIh85LAudGrQ5SdBZZfrukXL5uy8CtuV+N5WVvAO7FW6Dt1jAzD9oRR2mVJ1W4cifloCdV8/AgM1elCF9nh949vkxDWf+V8M8N4SpMt/bmjMW8r7jzJXv6lXRTNoEWHJRkl2x9BBUyJWLO/1+gOja6lFX4qI/R1qe3etT7WV//i8eSnct0Aa1xhLQfor9y3ZON2DaMQeah045yJVMs2ksAlP9lWvP29EJvfsBEzTXCkHDROHzfVbSHhapLtSSp/kg5ZIEEYb/e+Lc3g517Tx3JQhjB/MTnyxX0UtYgy2m/2q7V/hSfU1ZYOPQ== 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=adiMalOg7xBPYUoL4XJDrjUf+/iWgv0UFqc/UvmxpNUXMTISaYWJAL61K4HgR8FCgfQboh2qeNIq12xQ9CpgRBrsIPTZPeAC3NZ19s2Ya5le+GrLzEutoYg0HRN18GveelNzCDgt626lGdeomQ1pQN6RcG8YFAfTc0dgKd0UqvM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:46 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:45 +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 v4 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Mon, 12 Jun 2023 16:34:09 -0400 Message-Id: <20230612203418.2017769-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 798bc50a-1f92-4c2d-0147-08db6b84759f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KLTclB9Ems7IXImSVZbJ8nud2XqO8C06DcKo+ygH/whmwD3nT0/UCdvhZmklauQXloGCvfgcZssKt97hqJVPclUQy/xb3U+UOGpCqZJqnjgT5eLzlIBueiSds/lhe8stvkAsPydfMsfv349kmWhSqaDSI+DD0yAdiu9tnzJrW9IiQKkjG8xnYgt9PhwGWfY2T/WGfAVFSXl8lypQfRu4bdAm5FWlRxNmLa/MFdmxSYXdJn5tEB7VIMU/atRlRnvqhrvGVXft1T5DCBprJpC4MZpH83eg6yF6rdkIuHEobpqwuVvfqgvnknXoLkZ/gCkoq3IbBlUJVS/7C+EBsyb9pFH+k6F+/GULpSLyjxEMZZFfQrv5UMbOoe71soP5FZpEgDoj7gJViqHvM74pZvTB1JT3Md9EJtu0Ka6tsR9H4nKONcwXOEQJbyRQu+vBgKbdt3j7sKWHZtCylaoboL4f7jHTXYXLz/o/PWcQGBF1WcGkCmzHRw/ZFwmQ1JxD2vFpV2X8EtJyhh+RPdNtoHHpv2xD/DWZtYVBww/rCDKYlY0J4RWpJDl+yRWQtYVHyQmxx+SYgdJFP8zwm5MFpAjGMoowSVizn7YWMRwzunr3rCRULkOrxcz9rnxHQaOuMMALTjUq3pZNNsZUWn9lwjwAng== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FlOEpsdPzi3NqAMM3DaZNq1ykxNEO4A9DlFMc6J8kshokoG4VuQ+RLMlULXem4k3YwqPvDftm4oI6Vp28xL4mzj6W7LdVqEuOaoGxOHp0Tv7uhgDGLyQSuj/KXQamLGdGyl7jYLiF40yMmH8Gqx97YcMHMMxsTTqRiafRju7euupJVThTRusB68XOYQ440v61dISPTX1mSLequF2Ji+i3dFCYLkPzMEf7CQ0ViuB3OoGDFVN2KJmvvAZbJmBEM2vNxn7Re4fKM8fLbnB4V12rM21SAThG98D2NMXAs5UDYhj/HeA0MC9zZqYiN6KHr8q1EzbWHynr7IvPkOb/Gr6aMSb1CJSHQ3hEN9wtStM2WApXfd168csiWro/exHZleNBGkfEqW6CRkfIicJHSnFdwIV9uCzw9tlLll6j+nY9l31NiYzh6qqExyWNrBE+/A9FQcLGMPc1smeuXSrV/vbZOGp9cJ6oY1nhuJF7Ehy8brRYtfhEP/bvSJEWKq71lIr2gTGvw6OxkdETHCoxs8hbPnVKHKfJT3N1u91Jx6VqoiJ70nmj8+1H8beGsIOxC/oIRvUObqzDI7eIGbW0pTAQIaeo3e56BTaJ8Kpe1TKHk742iEDWZtFKEe4IkgIYyXvQ/lxdOXWsm2lGVarzeKGVfrbsioTP9pg3Q1tZ+MNQUJDTl/r89MDDJTYk/jMISik2G6xJGxGF3qwwA7U7XtIsWDhcjH4i26YEKcWMgH4ZScuvY/jb41LKUOaBXx3UWo+MYsgZr1hOeivMfULkGID53RfgU3Hql3wFp3xOXzXSt+vQjxLnWN4NPVRA36LCypNJTdTXOQ7t//JVy4lSKvfp1XEgsQh0asyJO2e5djzxFz21ztn8TRUlPdjIWDIOsjq9RELAox4Dq3lrn7xLQ9qrqV4ULUzaGTLBroo/YIt9vWFHgyf8O3+vcmSFgBRcCX3jeOxEmX6ObliXk313+cgTBSY1R0vwoL85KGbBOOWQoY9xp68IXejZ+eeOctXHk8R3hT0UQshs+R/a/JH5vxrNEWK0j+wo+SvJBxD+ykURkveSuOh0SxSgcgJn2TcqBfSpc3RTIRpJJCvzps8XQ5ebtgsZb3DBRWtZhCEQ/bwvd8z+n6YRgFX3mviY1CQ5Jv2bjXWZliSkZY2wH4U+5XrU+nW3Ie8YZ1AMIxePCk57RK7Nh8I3pwnOrr/GCKEqib3rT8UYHn2xYpVnqehJ5N0WPSxvLrULDvqKZclQ8gxDzHstfRmknkA3C6h+S0CsPVrQZ6vs4ZZbLm4j8uqc1XNN+pOkx/6MUUpjpeYPTSHZYymgibhjoXda+QyOFc2xvHyXgsBgrKh2su5YdFPgqtcuaUGFdJqjmVTckbfk+b41U+XYhe5r9siFGGb1SAtisolJ+YB3r3u9q409xMzrJGwKVRXFEJ1Z6N6c9kRzb9x/0WgvMsNrWgyX36L+ag30eOoDjiK9fvW66DAfWDJATPxlAq4jqMtg8Gusjx7NNxXQzcb/deNl0ltXeb5rISUOk8ASw+lBX+E81B1GzZ4956Sdz7Dx2MpFTDsGuaG+Tw66zyt2CFdoti8eajxBTYG44kd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 798bc50a-1f92-4c2d-0147-08db6b84759f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:45.8441 (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: E3HEMhIJQYYUgcL5Y/sBg6ZJ32MtdKFPLrPn+NiLYUvCtEssJCdVbvkjjLFMx4W/hluVx5Ki3Ihv44xzfxEhDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692280 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AA09C7EE2E for ; Mon, 12 Jun 2023 20:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235766AbjFLUfG (ORCPT ); Mon, 12 Jun 2023 16:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237581AbjFLUey (ORCPT ); Mon, 12 Jun 2023 16:34:54 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6BBE53; Mon, 12 Jun 2023 13:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U8bh0q7gllpsW9PbhTL+Gjl6LrV9mu9vMG0bN+Ep7BCNyCp77pFfcQyogxsL8oV8+9wlUNp3Fqhm1G5HG3F80MzACCV7xa+YSR4qR60OoEAfBSDssC6bXQ/roHKhN+K6QL0V74Hy/Kf5BEfqdWZ44kuHBha/6Oll0XDpHKOjUIuYTVviLjOjUhGUrwjwnnXV7J1LDLjbkY1c4SA0XI7gZ9U4XJto7ArTz9yuyzbBBvaSfUxinwbXAdc2/6vL9+mW81q6VwFol2OlpwDUC7fo3+fmY+AUsbXHL8L1Sc54kZD6eW/zaTHKSp3GaNJM6sMVvI6/lTHoov/GCkOyhzBSUg== 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=Us9fpYs3Pn7ZyBTTnZyW/O6CIr/0vu5cv+fR+7YFuMo0OdCe8+W81MEmQj46GntxdVJQdSbzcu31hg9c7EWjJ7Ke0CPEuqGblZL0yDoNmbjBQREonZ05G0tu5tgAAlJ8CagQrzlfd0tjDMvKCxlNNwJnaDXIPEMt9OcIksfFNeAkY7cvCQBfmAK1fFz9FYUJ3ofetCAeHdsHxilsiLDJrIpEzv30bkngIKuOvGuCr2DvjZEv3RqmGR08dmeqCXe7E++S6aJcU7YBu3g+RT2XkkypKu8TzihOH+SFSGScIiAW5BA0iJvyYd0tSiIp+gDjZ41izWB5TyNCT2EGquDMXw== 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=p3TUu30VxybNwYK/wZyAvRr80x57wwJ+kw+lyQ0DCNORbTB96dC8HBd3DGM/UI/bUZBGRFrvCBavIyEf1Y+VzALUHejHoB/cHwHVMw15fDqGn2We73jVdQ77OMiZ/o9Qgw2pVfay3YjNNDIKkH+CwynIDJqLRArUT5ly+a5lK7k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:49 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:49 +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 v4 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Mon, 12 Jun 2023 16:34:10 -0400 Message-Id: <20230612203418.2017769-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 619ebf41-ed30-430e-1e18-08db6b84776b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 496Mn2yhPcX8b84zEWKFXkdlUCeKTbEtFlvp39vXyjEbdm2kBPolx7KrurmtrV5Uc3ul5LFHGLhRR7DzrtSQm17DvEGwNDrD9EjktDfTS3IaGtC6GFjCCvJkibSNqt3hVVq6EM6qXjOBFOD42x2N1LKA0gcBT2AMlJrjPL5Qj59ge39wuOaBpncAe5fAxn31B7p6yPUWf9CvruiiQPGMqOIoOX2YyHxYx/4E4sPJbUxoPrzt972ujpUsVgnyAxH0cH93+HEoM7XWNP1SsVncR5rbgDxlGMHcnmi/AULi22LM1PojMyjnUKQxWZBdt0L1FmToPdlaFW0N+USssOBM0vhpLwEaFr+d/o9/mbqxPwe2jEAc84on8blBDb603tiDIA1+emB/pjEnJrOEwp13avyKOOdNkpII2ziCpynnEg38aZhonqxQgk0F5ayIC9f3ttiS2m7qOJJiqBJDjMciceI0QCLAh6acmf1iykZwk4dR4f0ujGO2+ktHCt+3+EtG8ZFUH/Tz/McAJbN1s4NbPIIGUPH2E9KlHWwxOO0pnxru4quRk7vhIOPOC7ihei9A8jeGMy6iv6h22q3bJ0ZL0BVwj+WFahSVYe6AZhEAm3EyCkW04Y0m93wBl/vptBTyXOwoDVGmf8iXfJg8yw3XuCl0t4x8x3KX83tHg2gEeQ0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r0OWPnU7NfrmqJ/G9OTU85rNQr/5jJaWbzOy4zz+qP7TtiUSmNw0k7g5NJUYBiuAlkBtxIKg7Q7nInAuT1xHa1uzLMwM1OIsFKxqmSwhFhlDzSKrLyWLFij8w/NOR7zAecXS8zvMIruQ7h8hgsu9tvOtqtAOdQrhKjFmctYAFvNYaX9YsmOYbsoZxv05uu8A4IF+e0qgqWJsALYrgNlG5ED85svrNzaGwpxMAII9F6CvTcadmFkvR5Wv1ZfoxhLMGQ5dJjbF4Vgwh+fTRCfRQxwevG8myjsKghzQcDTneZI7Oo/TuuYRS9a52T89e2rkDfVEfckyYyDMASXYCqP9nAZ4vb7ZYimDIEfAYzLdHCoFamRmHYkv3sKiKtCg7H7lvpy+hnnM2sQzu7MfFbwZIem55G827bNtEAIENIIS3/ffVxglUl1+U8Yk3X7kICEbNrGwRV6J+gHq/dNerzi3jzP+Y5aTqU3bU2E18MLOkVnUEXgD5WmkASqV8QVqVO3KvsH7Vj9VscbijJ+Is3v+ts3T+mWn8t/Rb8HB1X6mjaEdo4EEc6yLvZePjUEMqWoUTY+u6PwWuxXpIFNDgmPIETEzFn9Cn/exrY+AhZKCkM8Hpil2SVZHFaBD65/cQOhlZVXtzlMdKpvzg7KsxArqTEmJKGAWSB81xuu523Eiu/+7VqLr1QQTo5Rg84nS4txpRNCYOQ0rdXKX0R8pHk7GxA2DRjhSUKZ6JlRLFjdqq7QbnIazD5mO903SwhlWJ9vAX4iKMzWN9O89d5EtFUMHQcWDdEW2JcIGfjSBLejlhajt3WO6EzqOk6hMa493991Ieha0z7eqq7ZOSfQI+645b7v/t0g18vbJ02H5eXZ+eReG/JU6jXp03khoiwQHStsy+DeJaLtCYz4pePKP3cT3+J8QHo6eX34v8nT1LiFFNhlmi063skhuAGdq3m+wEbk95fitOjCl8gh+8YU/iLmHZJWAZf+rnh3Fwm07BFG9g8xp078v5GeB4YpSqmoHN6eS2n/tZyKyRZIcZrerO7sPS7jDv6r62ED8ltqQLUJni2Gabi9oMytbxisXAaQwq1JGvatArJucL2Y5vt5TyYtU6UUBFAvlfAV3o4d1MgurctgkflAM/KgDFWujIuu3OdKBZW4yLNBjb2/ZzaJAxHnavIYSEm5eHt/ZGEzm7P5JXq4rlCAiVNe4Qy2a9doHpeDExZYzLUP9seWqIaWtJo497GOp4le/jWyO0n5yjMg8j+f8nNWFi/1VHqbmFJaDT6oq3hl3594LwhQ5La6X+YUOp93XMBUUk+UkbUnoBXmJ75iocX3ou9cgsLdVL0MCehorlGCLfRn7rypuaP1CK/zFmr0sqyjtGeqFvj/n3/pAoQo4TCv/ew1HG/mT9+bA/WXz+2TLNpsqWMuuqZ1qBsT9vd2bxKMhEvQo31QDvDwKgJckePALhu2+NHu1YVMxWCis7BASIGIWV1ppjlIZUuO6opiKqGER2qkrIon3Tzd4/YKSTVCUt3BkTI6AVYSWU38NbuYucGVdgzuxMxAKdCwiI5EFbijBdapyDJmnf4CfVldyW/XOQLUNP1tmrNxcVQnV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 619ebf41-ed30-430e-1e18-08db6b84776b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:49.3670 (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: qMDI7yTaIFOUx8ekromkjLL5vJWJALBZket+EHgzVyYkcgV5NX3PiLN3ZrR95Gsn+w+SrsktCjRyzHbv5sDDWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The enum edma_version, which defines v1, v2, and v3, is a software concept used to distinguish IP differences. However, it is not aligned with the chip reference manual. According to the 7ulp reference manual, it should be edma2. In the future, there will be edma3, edma4, and edma5, which could cause confusion. To avoid this confusion, remove the edma_version and instead use drvdata->flags to distinguish the IP difference. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 47 ++++++++++++++--------------------- drivers/dma/fsl-edma-common.h | 10 +++----- drivers/dma/fsl-edma-main.c | 8 +++--- drivers/dma/mcf-edma-main.c | 2 +- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 10dcc1435d37..9948babcadf6 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -47,7 +47,7 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); } else { @@ -64,7 +64,7 @@ void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - if (fsl_chan->edma->drvdata->version == v1) { + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); } else { @@ -120,7 +120,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot = EDMAMUX_CHCFG_SOURCE(slot); - if (fsl_chan->edma->drvdata->version == v3) + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_CONFIG32) mux_configure32(fsl_chan, muxaddr, ch_off, slot, enable); else mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable); @@ -682,9 +682,8 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) } /* - * On the 32 channels Vybrid/mpc577x edma version (here called "v1"), - * register offsets are different compared to ColdFire mcf5441x 64 channels - * edma (here called "v2"). + * On the 32 channels Vybrid/mpc577x edma version, register offsets are + * different compared to ColdFire mcf5441x 64 channels edma. * * This function sets up register offsets as per proper declared version * so must be called in xxx_edma_probe() just after setting the @@ -692,33 +691,25 @@ void fsl_edma_cleanup_vchan(struct dma_device *dmadev) */ void fsl_edma_setup_regs(struct fsl_edma_engine *edma) { + bool is64 = !!(edma->drvdata->flags & FSL_EDMA_DRV_EDMA64); + edma->regs.cr = edma->membase + EDMA_CR; edma->regs.es = edma->membase + EDMA_ES; edma->regs.erql = edma->membase + EDMA_ERQ; edma->regs.eeil = edma->membase + EDMA_EEI; - edma->regs.serq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SERQ : EDMA_SERQ); - edma->regs.cerq = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERQ : EDMA_CERQ); - edma->regs.seei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SEEI : EDMA_SEEI); - edma->regs.ceei = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CEEI : EDMA_CEEI); - edma->regs.cint = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CINT : EDMA_CINT); - edma->regs.cerr = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CERR : EDMA_CERR); - edma->regs.ssrt = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_SSRT : EDMA_SSRT); - edma->regs.cdne = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_CDNE : EDMA_CDNE); - edma->regs.intl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_INTL : EDMA_INTR); - edma->regs.errl = edma->membase + ((edma->drvdata->version == v2) ? - EDMA64_ERRL : EDMA_ERR); - - if (edma->drvdata->version == v2) { + edma->regs.serq = edma->membase + (is64 ? EDMA64_SERQ : EDMA_SERQ); + edma->regs.cerq = edma->membase + (is64 ? EDMA64_CERQ : EDMA_CERQ); + edma->regs.seei = edma->membase + (is64 ? EDMA64_SEEI : EDMA_SEEI); + edma->regs.ceei = edma->membase + (is64 ? EDMA64_CEEI : EDMA_CEEI); + edma->regs.cint = edma->membase + (is64 ? EDMA64_CINT : EDMA_CINT); + edma->regs.cerr = edma->membase + (is64 ? EDMA64_CERR : EDMA_CERR); + edma->regs.ssrt = edma->membase + (is64 ? EDMA64_SSRT : EDMA_SSRT); + edma->regs.cdne = edma->membase + (is64 ? EDMA64_CDNE : EDMA_CDNE); + edma->regs.intl = edma->membase + (is64 ? EDMA64_INTL : EDMA_INTR); + edma->regs.errl = edma->membase + (is64 ? EDMA64_ERRL : EDMA_ERR); + + if (is64) { edma->regs.erqh = edma->membase + EDMA64_ERQH; edma->regs.eeih = edma->membase + EDMA64_EEIH; edma->regs.errh = edma->membase + EDMA64_ERRH; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index db137a8c558d..5f3fcb991b5e 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -138,16 +138,12 @@ struct fsl_edma_desc { struct fsl_edma_sw_tcd tcd[]; }; -enum edma_version { - v1, /* 32ch, Vybrid, mpc57x, etc */ - v2, /* 64ch Coldfire */ - v3, /* 32ch, i.mx7ulp */ -}; - #define FSL_EDMA_DRV_HAS_DMACLK BIT(0) #define FSL_EDMA_DRV_MUX_SWAP BIT(1) +#define FSL_EDMA_DRV_CONFIG32 BIT(2) +#define FSL_EDMA_DRV_WRAP_IO BIT(3) +#define FSL_EDMA_DRV_EDMA64 BIT(4) struct fsl_edma_drvdata { - enum edma_version version; u32 dmamuxs; u32 flags; int (*setup_irq)(struct platform_device *pdev, diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index f5cf95d185f8..47bfef1c562c 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -225,22 +225,20 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) } static struct fsl_edma_drvdata vf610_data = { - .version = v1, .dmamuxs = DMAMUX_NR, + .flags = FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { - .version = v1, .dmamuxs = DMAMUX_NR, - .flags = FSL_EDMA_DRV_MUX_SWAP, + .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { - .version = v3, .dmamuxs = 1, - .flags = FSL_EDMA_DRV_HAS_DMACLK, + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index ebd8733f72ad..7b05e303ba51 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -172,7 +172,7 @@ static void mcf_edma_irq_free(struct platform_device *pdev, } static struct fsl_edma_drvdata mcf_data = { - .version = v2, + .flags = FSL_EDMA_DRV_EDMA64, .setup_irq = mcf_edma_irq_init, }; From patchwork Mon Jun 12 20:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C505C88CB7 for ; Mon, 12 Jun 2023 20:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237000AbjFLUfK (ORCPT ); Mon, 12 Jun 2023 16:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237616AbjFLUez (ORCPT ); Mon, 12 Jun 2023 16:34:55 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1187AE57; Mon, 12 Jun 2023 13:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zn7+RplSkIOJD2mVSd84vl6F4leTSNzIjSZ455C8NKEsc/XGxmDhW8ERbs/+jhMEZC9/uRqf/rgsuBWxS1gT0wiR9EJbCP9gMvquJXks9sOr8ENZd3jJZdU/gY5G0wEO4HjNFZcvhgyKTBcIaDXde9R3+HQXpgnHyJIsredRCwg/Ay+WfztwoR/nSEow3pLiq9C5Kt6dBNmpq8wsqOkj2utxPWsUHUqK/daXqt389atkwO1VaOObxEO3Wm1J/G3QwxV5m/Uv2VjUoftS8VWPo1L2kaPUTt1liT5UHNPdvP/5poHdU1pzdfwKtm4oECe8VxfxgoY58WL8c49HT+86FQ== 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=gpFgAmD+Mm3G/oi6mncHHqpl6R0Up0bf8HrK0OOWlqbNTPxAfo01GCVQGf5aSq9X7FWoRfoHCdmDjdOXfXnBUyts6tOsra1hRx0NSj2SICAHF7bRKqG0RS009k1Kc/NjSSQFPys2f/RZSm5VcNVLVs0Sdwr6BTLLEgcmj7fjVkaC1mt4e6U5rFv8tzD2AdTeIkknv9COrOLoVrAv4izhsfPCbujceufF8ExlzL5BZBcNGrwY9UnfJZM4qy4FxLSwOhFKvj1xKTFu5AePTT0qrfbNO8yaGBW4xKm46fD+9r+CVzlRN+i9AFQqt970ndFT3BvsUDAT8SdLAF84YmG3pg== 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=ROF735X/4mrBEkBKyeGwRIbqONthS7JZWB2kOEY6iA9UzpJe2H1krqwKd6ohVgYeYG3u+qM6nNAdi1sKNjY5sL3KzWPYI01NTdnZSAIoZTU7/pBlLo13A9ah7/inAGxy79p4mYj4XNrng5d4LRNGHa1iCsn66qOWyNanDbEeLl4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:52 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:52 +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 v4 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Date: Mon, 12 Jun 2023 16:34:11 -0400 Message-Id: <20230612203418.2017769-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: a24ac35e-f9b9-412e-7047-08db6b84798f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gq64IC07+vXTyvYgBAMh2JNBuPBNtiw+DaNOJaaFts/OkiPPiH6lAo1Id8gOYezYFbdv8SLOFHNKoF5HbZo1VlaJZDBwG3L60dYrSj0NSklTassGTa3bY5FeBZm2AJ4mtKT2l0xxfCS8XtK5h4CwXqLPIjxr+HXdqRYPXdxybRFDm45pe8J7mvNZREXQVUL310J6R28ESEeENoE3rQp96cXsfbGC+e+y1QAhEBVDMCk8g37c/9Olv3UcU3vlhZrPxNVFHgkEQwv5yda1H5UiWI+H8KNjHwfsoulUWdT5g/MwQ6AMrg9ZwX/c0Wgwzi9yfRtzTkwf0cFMwQ9RgqMNJ3gnTZvRWWjiv+0CEcVRQ1ILzV4F7xucD7SAxVLTuAFWTg1waZbCGiWhBiYXMeFya5BXA2L3n0bQBJqNdkRjEoOg3GBhw1vdn55VwJrfIOftXAwbsiAFz8/gisOw9x4liMG6foiypYoNhTurNRgoJk9gdtXTAk7g+OXkiOUT+NZbU4WaU93mqKDJhJBzizrYe0aZDexORGOa6erCKLa7Yr1u3sgF8ytgcUefp4c4/jw+sNgwMoximCwpv398Nkc+xI3arEfi2zKYS99vCX93camE6cjZlegxAKFDuVPi2ozfMt/NmdFAcZU/risKJ0/zQA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o/CXghlh9hB6gS8SEyWpFYj8LPtl9CUYmzrsrGgb3Sw/xeW4crdKTIPl6ANYmHIeRwCiyjRdYn+VgLNgbTYQsB6hFfUwrgMOs7NSu5YGLUzb6Z2cLRwFzvz5dF0+0b+Ld4v3b8PpZxKxt3VGuhfm835yHjQRVzSWhsW1wl8rbEiNiKJ9qZkF464Q3LecH7h6fviGhdhup+duDapoGbOcmnyYrDpPb2x/G8HOXTEu0q/d3mFKoNnQHjPGUO2xUvEZYOv+0vY2P7ZLz4lV+B3Fk+YqSoV+XTlm1WI1mn3UhyOKDL1jCALmEQPN4d/cki4dc5UGiuf0iBfk/y1vg6IFD4z+YOhTLoMr1/FdOa0xsFXuU4A04Q/P6AywSfYBKkGVPZFXC/MDd3RSZCEBnxwZR75selC5hghqw2sBN+tKjyL+Dw97KLzdeULokzKPmj/FCxiDw2WQsNZs0nYDvuHg3+62382QHPCOoF/WqOcQKnX+k8OrykyX9ZyiRwWMZPB1gYt1OhMzQYBjEANU5CkaWwjUHc58hY63VO8r74jY/exS8Dgl6x/tjLWLtwTQvnqNeTMjMCuiUJApM8yrm70dTYdGT/PgalZdiOVvunigeMU+v9amafL9gy6ohywjQPd+zkcCZ4+d6gLsnFPUxS5plMGXZmowdEtbFOmrxEYE+WLXofmgGtmRv6WaIw8zkeVtELaa90B2rfgAcrhq1qaJJf5B1lKybjQX/XU9Pc/S5VrytuPGT8RwjziydKl7EKcgsQ1YF4lanEnWJYzfA2Agk45vKn4j3xISMgQSyvFgcm6zQaeDkS/Wn5FBldwmxFLkgNpaZVOhzBjxhuayaX2hbVqMdEDDcauEmGKIzuKPwkn/ZIsFLWH9H0H56776acFTHWQpc98vDhDfgLDFSuCUIN1pC8nFaYjWH2NEQ7hOZtk8jnaBV07mcgC86jcXhIZJXe5Ra1XKAwr/PzaFQGBegEMsEoxPApDEACQwhcLB19floi8CLc2U3JURMwrEi2xiquk25B57HOdAbYLcQQHCfpE2QygOVQllDj1zNXYZJt1PmvhJEI8LevOkurwQUJnImh4zk2qPrBN3u9n4McVDoRnjS3Ie+EN42GVToeOxjfbcuY87pbNaE42s8RGhITizyjxpDVNNf6tOyqd4Lu3PsGQ62+oF+Mg6tLJDwuajk2F+VccmA+TUQ3ZgQXHsF6ur2Y3DQVAryp5CtU+HEIMBczON2Baa/rI9wIlvYNxhPTlTRfrPBVbLA07T+qgLYgLS+vHCVq1RjPoK2+yQR3JqrKpgxtD/bo3xOyk7CEI4kKsTMw9TO6CwgMGQcwIY2An3CLEw+jIXWUaJQRNZUYXhih88/n3Q98ZkqiYNrjwjwX2aFTyAVYjFE6TdC07J/0NWpuholQhG02jev0Lk3Wg+93h4FMME1qppvaoRx6TsULdTJbAjER5U1Su1VmdE3y2W5iZmAUPmI9d6AYjjChrC9p/TWVv7b+KOJ1Er2Yd4kt8jI9rXv3uKivsLaCsGIK7Ia+BBTzvmqmqf+HTfvbiVMHKZNHlpCMBc7jZC/gHkJAs0xOJww1Z/OX5INP4fIeM7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a24ac35e-f9b9-412e-7047-08db6b84798f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:52.3905 (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: rDRrpMCUSM3PGEaL5G+ESQY1kieXsdRr5ueW7kJqp6hzDdezslQj/+al2xF7vEByk7orcazA0f/B3qpTrj61UQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9911AC88CBC for ; Mon, 12 Jun 2023 20:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237414AbjFLUfM (ORCPT ); Mon, 12 Jun 2023 16:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237683AbjFLUe7 (ORCPT ); Mon, 12 Jun 2023 16:34:59 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2070.outbound.protection.outlook.com [40.107.8.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4212E55; Mon, 12 Jun 2023 13:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dsWnYkisdcPKVqLsnijBfcVHvOEvijvXQcs2g5QbSlRssvx1+/go+S/iUkZVP9nGGGnzXjeRpA2hBJRNUfX5kEy87hKg/BtnVayi9YMky+CHvOUeZiPwrGtIVN5h+r9r/nUY8tSLGbS6hyjM2uaM7T2PGpn2Ts8RZg3tSCNuPvmFlTiboKb8s9o6Su2iwuE6C8mAVCTa3Rb++MY3tfGnO/lsJ1FAGhNd8OqKLpEgkbgR+xtxHDICRKUu5L0/CQOIlnbREJ0XC4qDS1Nv+wk1IqgTj0PFl4gonM7F7scJEaA7Wdh5DhSJei0/Yc7uze/zlHygI5xm4QZsjhGGvIhf/Q== 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=frjv5n39dSLUJcuVA5USMZtYxT62XyAi/34NunbeLn4YweVWSom2NBo8eUagdvRxG5tNXI+qCAwHdL53cFDUpeFguEkogD/owmx2AT//f+DNVIN0xElNSXLrU8lb5AIGerm0g81h0xyPVfeRtXbdAqNT5PIYQGblqpTsdzNjKSae1tGsvOkRrPSPwcQV08/Q814IWW8Rh8EPJx305qopI0N5xJfaeCnPuiRUPXDOh6DbKCygvuqtmkNjXzyAP1OnXEGfr1d7OstFPnlHJCoP6XLfWd6SqRloX6bcQc2/T06WWEZHKqeuHjmMUoxqoLRkIHPFEdKA9KxG1dwABBTw9A== 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=CvKKGUwmxmZVSo2YXcVHmaR89uBxnfRisFnlQaXZslx4oNq/3w5WLbIaoQP18wHzN1NGbAhuqqb733/lyN91Q4EGfN1jvr3l/MGdVXjo/GQd3LJz7psKfEJLmrnE+iHhG2ljGQIV0k+Hflm+ByOQTWTEZUFIK7RbfpWqSmIGbto= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:55 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:55 +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 v4 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Mon, 12 Jun 2023 16:34:12 -0400 Message-Id: <20230612203418.2017769-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd8fd89-7fa8-4704-c89b-08db6b847b56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /cE+36kY187A++OJ58UZd33TPsRjV8J9BW1eyhvsAjAdi9fsll2w6erXoNlvbN8T15FCK4CBH3ii2JZs5JkqCStmBIG7028gWlGE6f0UGBWRmOUPjci986c1BI810RUScel2TThmA4oVCsQCesyAnxdCrgVvrAe0mqN+AY9/DsSOJa3T5+2eYU63HIxVkg4AGP/8+PJQ1d8zF3Hln/MH4d05+8+8LnzKdeyPfWpSeFIXC3lizkSY6HjPei2ot4Oouj8cueOVeti53WkLjmi/7BqiGvfyePrLpl/9IJYcMVVWuBWdFpZP1wBqGQuWBP2624DUKa3iK2cQocVt9C4LNPeGuhThDCzojTPj4IUh1/YfCWUCIN3xXJH9SXIk9s2SeA4AB3Qh38ASNPgR+k7GvTQl5TiJ/bKOj7KeaFEfD8tjn4SduxMnuweVIqtOPM33phDIJC7atK2qVrIOA80yTwt2o8vRm7LHlKePUBjnfuR2lU4HQk3AjgLoLDLD2nUincpw3nfOIhEtioDBkjQ4ctdDJVcfkIET6vdEnFqNhv78LLF+21E9hk26Xnv0qlImMQd54iXV0ZGqF7HX5p0+o2a29xcn+rATflaApR3li8ozTfU+XGyeQghp50ev079n X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DIxOKJZXHdHe6rxt412ZDRK8s+neDQd9hSpHttgDJvCOTCuzNsPApw5abJLRfKE8IhgKFhcgseXp/RqQPPILhyw5esDZdAlpunRNhaStSwnFZ/Oxnr9LsFHx5ZalyBpbv7Yaq7YsSH+i/gF016BHDaQXUFdGdO5RgbqekWGYCWl0cmbuqUhp1z4QSDde6DcrRqpE5zwUNf/+0RTl/DU53Y9AD4kEk5uwgQHbSlfPlOpkzEKzLvwZ4FskTTZy+UXZOu3YoIzn8TVNi+6HiZMpPwGkKagcjo85moymgCd2oDVkDsDWPot6lLfXOytBfyuBxNWGgRb7gdNO5PxgxUGMMqhU7DllckreP53jSAOe62zr2KYvV+qDXNvHZ+2KfP9zyO9XYNQ3itAm0JfyWpuAfeD9KkVJVenYWIMm+aIQZhQaDB61ziPtGUQ8mzF+oR/7Bo4cNphH8nXhwF/WECIIN1C84lcfZnHP+S0ecpzKpp5B6wpXKB9ursaHsRLuKpUuiBc02LP68QSnyV3BiTzw9oZH/DIV5j8WvC/TUyXpQj9seCfJiy2nP/S8waIpGEZaXNBy3AK6ttbDnsgOIlYBI6w+XPxCMspWFwkVs7ONIaySfmlJlCci4GUdVKlpY61Nij4fzLI5SuqW3iDTSDTfv9JlHliMv263KDkyGE/XcqCvD9tumXFoUWwJsEvIXfhys+SXKA2wAzr3je4eGfw1xMsmFUI4MSUhc7nPAQ+oFZx5mzf75i3L6ge/sOqpUTnWmzphfJfOffVcoiUTAzsYRlxnwTiph3bBIfAyC4EkSUvVm+xOHX8Fp58mnYCc6zTKlByo4ZYDhmVXo3ExXemFeDkXOcwDom+ppz9simvLHYnEpV3R5r3OgcVOmrLV/zSmlWtPBh7NoasOZZtnNMJ2VDbArxOYYvOIDLEVEwseszSeCel2uQBs6uVcc91z626a6tvqpCAdx9BOp+xF5uluFh42BvIZ1pGOPrP2mKaz5g+SccAqScVg284PEy8p6KkOBcnMAuA2LJVNbijkoIE1Aw5s9DjXvfp1fsosN9xsw6xFG9+MsMHbAqZJABvWih9ZA22eLYK5yWkar4ZHp60jg7Q8oFyR0Vy0lJqV0XQMN59J2ku0Vx6ANApVrZQ7Qm7Xuvwy1MB3FnkyPDS1j/Vb4N/GeKre2+5Kj1XIyOjc4tbNmTtQcXhKq21aXrLebf/DnGr2qKE+MGkumXGtcJhyenHaZ6TZceb33BmkKZXPwkQneY1IfHmKGRfkFvOlEgE147JolxBmdpK5VhbX+N41hkD1WtRpZo64n6aDlPAu3Yka1YKaws/h6ygY402QOqtSaz4L1I4XTawkezRCRyXueBWxH/EbzhYGOZlHACg5v/rKgGfmknXfwc+4zcFN5YmCBB+vsmBE5i8cgMzcWa8AjDPKl6o+WXbveS2vk04u8DZbtYm0Zh4kOGWx3mYf4puPhUnLCcXjIsCyHUt+rEGRL1EMSkaJEc8AQBGBDWPjG25UeMmekgLjXgBUsoW1EWhYBni8PZSynHGVvU1V9i9KUBeRcnzv46JTkGGUSt+Nb+xv3jKtZNfbq4ARpBV4+j/M X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcd8fd89-7fa8-4704-c89b-08db6b847b56 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:55.3888 (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: RhulOJXP7X/sXmJPDxncGjbCc8cmNudEDU6Uy5gTFiZhZMuHe62nmMaE5IlVhznk8N6BiqVtodYGkWyX+GWW3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Removes all ATTR_DSIZE_*BIT(BYTE) and ATTR_SSIZE_*BIT(BYTE) definitions in edma. Uses ffs() instead, as it gives identical results. This simplifies the code and avoids adding more similar definitions in future V3 version. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 21 ++++++++------------- drivers/dma/fsl-edma-common.h | 10 ---------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index a9d17cf142fc..51fbd7531c74 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -154,18 +154,13 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, static unsigned int fsl_edma_get_tcd_attr(enum dma_slave_buswidth addr_width) { - switch (addr_width) { - case 1: - return EDMA_TCD_ATTR_SSIZE_8BIT | EDMA_TCD_ATTR_DSIZE_8BIT; - case 2: - return EDMA_TCD_ATTR_SSIZE_16BIT | EDMA_TCD_ATTR_DSIZE_16BIT; - case 4: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - case 8: - return EDMA_TCD_ATTR_SSIZE_64BIT | EDMA_TCD_ATTR_DSIZE_64BIT; - default: - return EDMA_TCD_ATTR_SSIZE_32BIT | EDMA_TCD_ATTR_DSIZE_32BIT; - } + u32 val; + + if (addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) + addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + + val = ffs(addr_width) - 1; + return val | (val << 8); } void fsl_edma_free_desc(struct virt_dma_desc *vdesc) @@ -623,7 +618,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, /* To match with copy_align and max_seg_size so 1 tcd is enough */ fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, - EDMA_TCD_ATTR_SSIZE_32BYTE | EDMA_TCD_ATTR_DSIZE_32BYTE, + fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 242ab7df8993..521b79fc3828 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -29,16 +29,6 @@ #define EDMA_TCD_ATTR_DMOD(x) (((x) & GENMASK(4, 0)) << 3) #define EDMA_TCD_ATTR_SSIZE(x) (((x) & GENMASK(2, 0)) << 8) #define EDMA_TCD_ATTR_SMOD(x) (((x) & GENMASK(4, 0)) << 11) -#define EDMA_TCD_ATTR_DSIZE_8BIT 0 -#define EDMA_TCD_ATTR_DSIZE_16BIT BIT(0) -#define EDMA_TCD_ATTR_DSIZE_32BIT BIT(1) -#define EDMA_TCD_ATTR_DSIZE_64BIT (BIT(0) | BIT(1)) -#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(2) | BIT(0)) -#define EDMA_TCD_ATTR_SSIZE_8BIT 0 -#define EDMA_TCD_ATTR_SSIZE_16BIT (EDMA_TCD_ATTR_DSIZE_16BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BIT (EDMA_TCD_ATTR_DSIZE_32BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_64BIT (EDMA_TCD_ATTR_DSIZE_64BIT << 8) -#define EDMA_TCD_ATTR_SSIZE_32BYTE (EDMA_TCD_ATTR_DSIZE_32BYTE << 8) #define EDMA_TCD_CITER_CITER(x) ((x) & GENMASK(14, 0)) #define EDMA_TCD_BITER_BITER(x) ((x) & GENMASK(14, 0)) From patchwork Mon Jun 12 20:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692278 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 487FFC88CBB for ; Mon, 12 Jun 2023 20:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237509AbjFLUfM (ORCPT ); Mon, 12 Jun 2023 16:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237752AbjFLUfB (ORCPT ); Mon, 12 Jun 2023 16:35:01 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2075.outbound.protection.outlook.com [40.107.8.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A40E56; Mon, 12 Jun 2023 13:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEn5NzTS1YbhYgXXw4KfLHzogXRB/Fg2rLbJFFgx3G6aNfOoo3RXaf8EqrRLC2yZh/zE2Hm2v8HHxrbtffO2PML/4ohQyQry/6byUM36LTVKYBz4OR2PBSrWQe52x1F+BLVPw9ZFaH0O0t4BrtR+PNxSJIU2HHO+nNCzqID6zDwX+YsMB/IInk1xDDRROe1J6lNP4NN5kNXGfU2tY7SjKPOs6RyZwDrcMxyNCGbqavjTIj/rVm0v9Cz78f2pnNWadl7IoBe7VS2dJjylKdat1ElEIX7vKWLndajXjy7DcIIiScdxtyrWDPG4fL3L7zuh/VP6alQrBFGLs5ic1iJMYA== 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=MzRPRo/wYWMPs6adYK+8xn6sNcvuwD7iGMce30jWblPskT0nv1y9cLPXpnO1d3h6gXwP2gKPp1xnT/SVzbI4h2N/Gkn/oHvPjI2nJBSn+aKSF3+UvYKB9icaowz5yp5IQgyPewabjT6/Tz0ybnZ674JRdpFcKqV3M1F5W32hXtgPHYFJRsZHTiOIjNfszCH2WpUNiZq2H7YgGtHbq5XN+Vc8iOKcttCmWnAdIvFhivKRl5K92Zac5vqcA8qoUHLgD5c04WHy1JhzkXMxUJGuB1YtC4pxZqIBnLccOnPQKu2bRPmiKYt/FoMW5cjIy3x1WCSa3M0JFCTL4R6XlIDdIA== 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=Ppl7KbBp+e8TGj19XKqOhi0DppdtNtxhX1orlaU4qL78GOsMD4dddqlLo43ZymAVrmzOf/qQe1cTSIohG92Lb8jCosAlNaeVZLU7fFM8HK6qV/porcEI2iXlnugYSuUH51oDDBgJJTVLCjULxvTsl2OLq79RW9ZqRbaDITyIWR8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:58 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20: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 v4 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Mon, 12 Jun 2023 16:34:13 -0400 Message-Id: <20230612203418.2017769-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 09837582-3fa4-43df-834c-08db6b847d20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrcRWFv5q8d2ue7EdxQ/jZo4ybwANvN+aRT/WUVIal7q1CsL8/K6fAVvBQgM2hJP7V9Haz3im9SN+8YLhM+qtfbhAnmUwUEW32D5zFy7HJrAQXEOgjB+n/FPflmGDVAmNGqlE/IPM8ars9RVTwLtfMtvDZAI4eY7JZzE97MvWuFsTrfU4rWA37Q12DN8iccmg3lScbmVmpcHCCKwi3vYoGePYJ8pZgDqflDvZuWILqGFJKrK4qrApNaNr0I5uhBTSlSgmdGi3l8IUAY9D/DWbeH1EabDfFDKeGU4lEqSPcsJHzj9MyGxvgbFlCO+qXz3D2C0UjT5woiSIPSlloxKrW3xmXN9/xyGLGx2oRECBNS3ocvm+Eatr/q9HcyB6JpDRL/ZAQm8Lcq1gdOFrdDpg6Tq0b6CeJ4Xner4UX2A1fgbZcUGlZMcyGFJhSOiUh+iaERVhgyHGk+l15oZPvftYmvh3L+rlX6DyD9KWh1tlodkQUVsKZBE7broDdbSCYkBd7p0T6kLD2U3oVEBThMWM5lHylyOPt8Io3vbMV9j+Gfe4Q1aWPp7nisWqLjR4lGorf0jPDjiMohoUBhd3oPOSnAVLKhQGQhx9u+pAhtFFe4GKMOppCFkx016mIaInuXko8vAf6Kmy4j9sZ3iwKjGpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qTVRyC8t2oDZQ15vy0O4JyUPXjvs+LrorpwI9o8zQm9yHFQ4EMbVOTomMWfzYjinqwNwWJjQa5nICA4N7KWYPZCog8Rk5XXtABlYZzu1du6+zQOjStG+2r0Oj0pegntc4wQSXO6jl/SQa+2/i45pNAOrdQy6wl7QyB2VOnTWOlLlHJb4A1BNUOUEBjTWGkrOEeHHhcnHNvscFeGrbzVQo6m4FcXuG9Dd2mGOu+RA+U6Jt8Llt5ixq0jxo/He5neex6xwrlt414/pLd4x6oMNSyRi3gh67RMYwyD5ydoIav4ED3V+pRnA9R+jJnE9GUI1CcGMuzUVXYrH5ijVmavB4Rj8Tle1J7lyXixSYJ3RmgTf8soeTIA+UPFImUVqUkUwGc77/GhmA955Rh0CXaEZQeX6ny1FEZZrpV1fH28bGLwyWsCJlsq+sG8dXpQrBNXu72roOxdLc9Kfg2V95t/bmb7EBzkE4qSnk4Fvz50VZluAqOYcI59xHp1cyckAEhY13pJjl2W8HxcfLJCrvIkiQHfDsz4ngFY0YNduFdc4arlAPc3Kw08QTIRC4hXEBWT2G9DMFVIlOMESkJdlLeICG1owvFXk4Ay67kPeHpZxPlh0JQn3shf90XVhi8pp9x6aKKSSTT7PM+AiidfJ3Pz3r/69+o5HsejPpIZNyexW1dC0Qhg8WSExymlQukk9H4qpB8Gb2AV4xA47J7Ft1/hSp6BtqhNqTl+i2/tegisDrEhqCvJ8GG/7KxiYGJ0x9q7zs+eC3dcbZ9UUjXzhTjRQeuwOURMRmn/IjRcU4yWYDJVaaMH/2GprmYcX4tjZVzwRLqjSR/OE7P8brdhaaurogbSEgfmOmcfJ3qHEOD815KMA3RXH4rHjT2dKitz4DgabSUkcV3IPKjL8kf87Bw+3AgLtbNxE9+bJFeM+2sPyX/VwZj9Qg25kEdwly4gEswuZ2Hn1eGVTh7KDdhuwDA362ogMDSD/Pj6tYuMhCEez9jZuSlBr3vIIUCvtXDD01Cwknz8I0lMBgSpzIAJiH1hZQlEERPwUDgIV3Gb4cIyJawJuRdyd3Sf/kVlNK98U5QnkVUnZoFt4yBM7Aa2t8Ra2QLewICCbrHAtE3PEII/JU36OYEjOdPhzwLSqQaEi0lPvmIpD7yeDumjz2phCX7PSNBrcW9ixV+ti36ySqFeitnBJ33fiEESr07WNjBqEEE5JMEo580rrSku0q/xAvbYHCDDZ+g8fb/mnYvDcUMvD/N7Mphd6RH+9zX28PtR5cv1Zmnt0sCLrz+UEsGHwAtIf6uJkdz1VgesfoprHW2HHhZ50ktsMMTRkZUY5uoBJRL480VfJPA+vGQd4Caqo4Xi0j6CzqTf+6zGRT+SB/fcUu8h0WYADo4/N0ek6t4eR8giwKf5WBuU+3N5Kr/6gtuM7svr3ygxNZv/Gb7B2b3dctBZorY7RNyDP0RzuZiRSzYgctBOlaxXmntaaGqw6kVnqX6+/PLnkYpCMzQhLNdfYQEMJe6oFFfvx1anUfZHF1WssPuDAUyMxaD3PzM6ZgM2J/McG8d2o541ppdvIm6wzZYkv+vnubleIGJaHIKoIja0t X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09837582-3fa4-43df-834c-08db6b847d20 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:58.3962 (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: jP3wmOH51E12Jgk8FfRMPQ/1OgVqnP2MrCWAehfhZfg6AyjToyzEBe3X31pKRpGeTvUzKDfn0NqQqu4/Qx7Rfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CE10C7EE43 for ; Mon, 12 Jun 2023 20:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234811AbjFLUfO (ORCPT ); Mon, 12 Jun 2023 16:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231935AbjFLUfE (ORCPT ); Mon, 12 Jun 2023 16:35:04 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2082.outbound.protection.outlook.com [40.107.8.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1848E56; Mon, 12 Jun 2023 13:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fAq2kT+GSd4AV/OoOrGMSyqSLcdztV0PytzVYhGHtCEZhMcKdiGA2pzviaE0DINkjdDtsNc/E1CaIQMDgrGfvJMJPdYH3+uGLRq9Yd9/e+CsfM6XNbb8vuB54SkcwuU3KJg9HZoPJIiNOgTrEllLBS/v8VjuMLzFOXaDSWFZBHdX+y2eUo4xEghY3P3TWdq6RHFgvcCeJw2ny/MkLe5TQdpSFakM3CkxGYmuYcCYivX7dfXvEAWp2CaNLK83aWUQxaUwOmR1IjT54sJzPbuPw5OELpKVzoCRWCU2FdrHE2Ot62uZgQkG1X2FlVBdRijxyoxZ0gOtUo1JnhZ9eY5jUw== 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=Vticdgo8uN20oYU1gCZXFbXyBqBiM63KacFBqoMNVgG0874c5L4WMDieJ76UXTsJRXE+88eJGmY25ctxW1RrU7o1Q8uGlSZBDu10OmG3einwbZ2w7DRGxRineXnVIRCZmDjWDfDcVRdSCUB2ttWLc8teCLlyEKk637fOne6VLOfm+UTQSfP8KS0kfeQh0ZBAcrDm3Hy6GWSjn+SLDDRXcvcOAOZLZqB1hQlOHheJq0xFOir9ku7KyeumUY/JymRzOf3bAgHSUVp3c6LgWVHSpRjSn0DO27buzIM3iLdafBjRSfi6ozxIZr/o5sYGr/joQNin/FI243pgRZbd+u0UNg== 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=Of71S04DEZnXTCVP/lt1+CAIwbSc3YpnjvejPOxYns6pm3xg+2NMQpxWfuII8xqqYdi9OSmbArpJdCTmMUxh5QG1mUlgCeI0EFNMzxPnmTnF3FF6P90TEE4q0GuG1CKkkxEWB9BjR5+1znl+Au1zrAetkw2LeqEIbUrF0eaaxK8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:35:01 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20: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 v4 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Date: Mon, 12 Jun 2023 16:34:14 -0400 Message-Id: <20230612203418.2017769-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 9730f1b7-34e1-4e17-dbae-08db6b847ee7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j2n94GRwifVvmgtAXrYHKA8lYKLvuYF+h6URXNLZIfTOLIcyOk1DjjmqMTX160OEKOMkIlXQPs+6seKEg92uDrpQUF+UH27184FbJ3i3/9yfuya5CKj1/qezvYDU3B5g6hQAipvIBNQnKV5ItRoeg+KB1HaK3VqIrMs1Z5BRUjtu0sMisLLQnzQtvjluVRX8C7IXepHstfRqD0lCbzP1rDEqdqPfDSmLw69b1W5M5cM1c9TTGUOmykmwi3pN9kEL1FueEI3eGkVTTpEYePul/PLM13V04etJmtVr0jHub7Zk4eUhzKMsfoRsafb/RAZ4245i7bwE6YLUCfYLi9rfaOX3vTkQlKY0gxDVvNJaYVAewcQ7aYWiiH+6DwhryYfca8f3wk38UPE9AxNKom4ulgpjKdX5ZaSzYOOOktfsLegnc3zPdrvNAunZIywvc9puQ6BVYSAlDHW/mZ6/fL6ANOVp22Hcqzd46SkhzuGKGm2wA1Ic53CLyf8XeDGgdRNvvExpEBl9BhwoZcO2LZtIy58QrNyX5Kea1gc7V1CJty76/dBZwPOLjUQ7CMWbjZsXcQjmTTUUl2sUsQo6CGk0hcxwCNNYntM51ADvrAUCmMd/OhKZP+M8Inry7AUW07DAMHuNh7H+Itp1iBBNmpsvmA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: veJVLMIAQm4hJYu9ZrsX/npx8JJ27QU8E1ohpGCLi1QHAEpJIBEclgiU3K46KdeJL6ZMjOSGo+nTRI3g/Ze8xGLVx8CZT64/D0rY+jkVXwBxRT7HCXjEd865ZaR/LxvNH5mfZHZ9A3xnPI/6JEN6RN9PyICbv4T/Ffb2HKGdTtXp21fFBei/0N3pqp+8xFIDXz5vZPYMt3uHdf5fs6fxzY3JnmaPTP9HhiEh2HFPFBFiPkdOLgiJS7fGddw0kjJnqsugIng16VEHL1zx/mNjDRXTNDd+p6ABzPb85dh+H+X0rbDSwmXHkQiORIDRVZQIeiFfPX/UyUhMhsNsIq74+qRMNvpgLbA9glILG24nRoJQbBtaLcuuozV7F/zLTfRyVpeCLaYLDViPCAafRtCccT8ku5QZNJh0IJOp7aUopji3U29uSuHG5R+j386x56xbZE8Z4sGs6+FoN1njgjtZjxWvxZH/y2QA/mY6uLmGqn/5sGJKXikzpPP5mONJRYBa9g7CCE8K/06ua/TXlQwT7mZSy9H7V0a1w99i8RREP4INpD37k5FchHDAAEY0H4AeWvBa700l32qNzwvEuN9nDIc/d4fP6KszMPccCsPnOfHxphljtDfqR6fXrXtv5jn2RiaxaunuOJBAIznTnKnzKCcLgc4yXWz/tmj6SRrpL+ZkTgVWuVWhC5f/L5rErdllzdaZnH0wMX3vKmo4K0qy6Fxt8AAMsXGcUdCJGZcWeMw425pn4xEH464JGMjThtNwR9pL6FRtvDAWI8KceyUzzlHW3uvfRceHAUdC6SYvhgyUDYmeDimmSHaAf2kHq/tCB/SMmOV1gOxx7REpq3hB3EWJGQr4+XU7+EOi+nPLNdJ79WTUUTbh4KuxC+Qdzv4sdYf/L6gFG4m+wB5LW1pSUHRy9TwSuftym3vUrKqR24fgoPItR60t1N0+ToESBkjxZBs3lYDqIAw1O15X7e7oH0utmsKiqNErf81fOSWmFeoJ5j9H61TPHRnZgG9pE7ty3H3V6CoxpmF3cBvQfBZqb8i6elrhCW2CKGX3mRqLSXA0QSstNXyGrmUD+m9DYTNQII1vLspLCz2tSQuoLCM0DDKUFZ/ewWeP9q53xqcvQW9edYl8YGkWPy3OW06GFwv8oeaN6jxDjWEz2DminTscBBvi5ILVtEyqsNcpt73/TIK+uP4jGqGk9wWmC7+4nYpDgqwib6IlnQALHHOBaVi3aKZ+3i7dWOB3bOxlp0kteuaARDQcRX3cHeTZL61PqIhSNkAJVvdapqMmSKDZXQyczlON60P2ybr38IxhXGQhKEEUFHRcU6L35h5WYoD300CTaRKAQa2uuF29kgaMIrUuuuojqAujIrvAx8R7sQx9sVlroNA1xR3vLNWy1O9uv6QcgWHiojMJqT8STqkhwsr2+IpxVXHb69DBznKlpmbJz3Gk9DBIY1H31ciimZ039p2mbk+3LGC/fFFBXUsJ5Yexvz1fUgCq54UnNVflTLGiMZ3v7USlYUtEXAwHcNMDU+WQ0Fof+uLJNuYAMWXBqVEPWD7DoVVvvzbm12VfappzFZAq/mtlMm3zuoKqSM1ydFPR X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9730f1b7-34e1-4e17-dbae-08db6b847ee7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:35:01.5237 (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: oopAH/xFhAAQw8JfDmk1piPQbNKITP6Ttm+2NxoH7wFZig9GYhvalpPotSBSFwrUC2IZlBcqp0PAhOPk4l/i3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This accommodates differences in the register layout of EDMA v3 by moving the clearing of register interrupts into the platform-specific set_irq function. This should ensure better compatibility with EDMA v3. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 503e5ad5a8dd..e67aec3f76b5 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -113,6 +113,8 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma { int ret; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + fsl_edma->txirq = platform_get_irq_byname(pdev, "edma-tx"); if (fsl_edma->txirq < 0) return fsl_edma->txirq; @@ -154,6 +156,8 @@ fsl_edma2_irq_init(struct platform_device *pdev, int i, ret, irq; int count; + edma_writel(fsl_edma, ~0, fsl_edma->regs.intl); + count = platform_irq_count(pdev); dev_dbg(&pdev->dev, "%s Found %d interrupts\r\n", __func__, count); if (count <= 2) { @@ -311,7 +315,6 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_chan_mux(fsl_chan, 0, false); } - edma_writel(fsl_edma, ~0, regs->intl); ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma); if (ret) return ret; From patchwork Mon Jun 12 20:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755A8C7EE43 for ; Mon, 12 Jun 2023 20:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237514AbjFLUfT (ORCPT ); Mon, 12 Jun 2023 16:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236457AbjFLUfH (ORCPT ); Mon, 12 Jun 2023 16:35:07 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2057.outbound.protection.outlook.com [40.107.8.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD8510C9; Mon, 12 Jun 2023 13:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/JBDNY30+OG0l3l7ew7FXt5RtxswKu+0d39h+2kmClr6fnm6uKOelJRKPhx9BQg3AVUKojsleosFLNRMiraGT1RK0/3sS4YxvnjtNz8YGu75uZucbwvsYtiAFyIjyJxFnOBXe9cdJPS4fN941YpFxhFg1PfUWXgjVLTQxV0qLGpQfyUr0rh5/jbcOXFvc9emU6PcE8P3z7CgsWCLJumFD4cOSbSZ2mMlmNEHfiUxGBxYUQjSqML+UxlrgAajRpnbBSWiNaZQCV0eUNXndVve8Gxov4tBV8dILOZy1z6XRwgLjnSs9J/J2lT6h7pME1D9fvRcmODml+aU64bZ8Q4gQ== 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=VJVDsl/Uhh1LwIwsCChDdi5tzq0WuUeYLHinauuCodhtMsKqAe4C8sejPXw1OLJ3jjVxs4jRSjpglxAQybbHQWv6aBDxW/i0v4TBS4HYnA9fWCmDxhVFgKxbRQG9/M2GXOx+c2LCxE8byfrIIWaOu+QKB8BPKpNZo2vK04zzPBvqnqORWFJmZTC27+cf4Of1jmKVwTXph6DMCT/XP9uisD3IU5YSbj5IrInnSmWbn4bi0SSwf0McmS9Sw3+wUHaBnsrzX0ur1bEefHpvkCCOGU1KhsMq9NkUJRK4yO8V8pjXlOi5rqcWFQKjEAewflP6iQI6xiWqYRfKlCfzL2ZPEg== 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=bFMcNWxpZ/cfGS2gndTSFsa3gbQk8jY52JlwTxACoLQGYGEs2+WXdHRpbK18hHblreg4AIOWDrIiX3SFSGMIgsy3+2Yh1NgYBTAkHn7Zhk/UrFV5QruelBkOIm4rRdlBjwVS+EDlaatFlGT1YwrN3lYwWtlpWhMpoFVkYCIUjwA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:35:04 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20: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 v4 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Date: Mon, 12 Jun 2023 16:34:15 -0400 Message-Id: <20230612203418.2017769-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 847aaf31-04b2-456b-0b31-08db6b8480c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +6XoRYen4L/uga5Kbut+0kWn59VekKsbChklZ+dqV2BVTvAKi2N3FOe0fEM2211thR2F7d3dE/ZvpXvP7imVzuHTlvHWw9DRvgIRZPlc7lPOYh4l8519pSnao9jIS0+uHuOU+u/4Ff4wgj+ymD2nnBpyYMouIK0dUs7FN5ckrPNJpNc0/QU947sHuWn0NEBbfEafQlv0TdMRfD2SGV+E5iPEDY6QWh4v7OwsrcUMeiSorstqlwsTlqasTeaRLGJCmG6g4aAzUOLk1edZDtiT5lMCrOkwF8ElzoNK4mpqODoUygjRiKdc9YU4Xwh24XNsmgUERaVn83i6wxEQc/RzEGxvTGdyYUn5HMAnPvKIyB11G+//s7OPCI5lvMboiUpbHcAyzwcuhrx+8UWRs7il6E0sBxFa0Xusbt4jvY9P4imDfs6M+eOylwmbpyOGrNq3pDYp1PBC4SdyBFhNzGRVOhzL8UzDKrgA0e25ir+0fTfbqcgrjxF6fR61cbjGyGYn8NkeBYQCFMTAy7GlrAV8oCy2syv5oc+ejQnA1BU2JKNu84mVl7H1oHV3bY8YGsqwddiYPr6dGdf/Wvn1tYp43Ho+RK3YI85piJzbymFk8loK5jKbYvcDF041XqQt/HzDwAdo0t/OyUkqqlda46K1AQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D2FzYFtSwUR9f51MDMYu4RxTRM+pX3TZLjya3JZCeZQk0gwKfoI5pQZUJUxbyRYn2ApmEGontL4FLA7xM18ioJL7wZ5iUNJGnXYRz/XFKDfexUIygCWVTaEQfBntlFqvhBznGcFK404Q+gpmFNRz3K5Jp8jXodDo79zxAPQ73acLTtmmAMSBt5Ux6JCwYmtC1bswH6ZRLsfnu9v6/mey3e1mWP3OyRINtIAjTxM3u0+UKZrTKZlBp489RnFb/qFsUMmoT6Tm1xIyafLYxtW7RerRh8G9UMfk5CSlgSBvuPu3zb2/EjPRblXy83eXx3oI5DLKu2GNUe3XDSZl28teNHTpx2Ce+LTqsnyw0c4kVEIE7CEbZ58F5bWEMvKQwoXULC+dEEbvy+G9++wZ7lh8h9qFTduIf88mwJ2WxQCWjktTBiJvhEhQoqU5+hKwSLqn21nsJZNxfBQ9n9h/SdxSMwCaZXFbPrGctPgZ4RLN/o0ooz2PSOjinnGWLwedOrYrn2pZyrvVdajPIWUuLO/3uWJQKc+E3lqAQ93hWpBvYsFpvHuuaheeJcw74DLJusKlodOeb82WuqzBdKe4ZC4k4+jbqAtDYeXBjKOnWses1xTyMWb4nN6EkXpkjyMBnRHGaBOdFhWe+AdD5Va8dc/EK+fVh2mg0TWP6COHA3BvLjGCwLUwNMGkw1GB8D/zLf7B1nme23kTG9X6jMkAiBEiXn1Q3Yx00uzxIJRFoothGTRWELWaPfHjEhfpDe+lAFI+++TSmvbFgjNKwxGa0tmoXFjIPoesg7+czZwX49q915PKzjhgQNhd39tWOXg5AUg9twpdEJDzg63ZK1DgeAz9lCd3wgsQJGVCT5oe1SN9BnwgOiOLBlmVFx2sjTzbj5OFOTZK/MV7SHQ1F6/osKj4q30BdTkkNuq8lRWWkRnxuk8UVma9B5Yo6alNjzhVuw/lDqPuJORpafnGDNV7Wh3GHk2ZQPBrk8Hj8POqXl98eYNMUyiWhg1oCZmnms36LLfXAnUHTzLtBr7kdeA459xdUWD5lMzVo9OwoEbuIv0l7L6ZHXsccNkIoDb+MA0RyORR/jWieqp5r1iDcx1d93jKF1xAUbTBKJRiXEi1o/RwneInDUfemBQEp4mw1D3vHvfHmUvf40zET9RRRmP5kkeHAequLOvJky3MX2NZuI3VWOxTiwd6pmauzBsZZzy5B+DGnsY1ayHkX8RnhgII8+OFeMhCut16StJVwlZwKcuhPFuBUIaMO2NdCNe7BrlyMwOef23roaqISVjxPZEAFlmqhlMqua4WbE1r7DJU8bY6DMxWKlSEc0uG89A1zd5+oRNlYiou4RZTkQ6YqGskZ7UiZ6SVar7GbzndlfnbAopInRHvIesZPLdhraez76aaDEruuW2VzN8txP/ET/5+0arl1IgbV0sMwhsUBRUtMGQIh/uq7w3OSMoXquSwFAQGflM2vGuFJsdxu71je3hr0Q/js9f55F3NMKd7cAsoUSaY6tYZU0S+d8lwaKTCPpOPz7J7qTRzqJwnUQkQUPH5UJXihAQWshKFOYW/zFMEW6Y4JWszjuOBHVd7ZkgkoCKevs9h X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 847aaf31-04b2-456b-0b31-08db6b8480c7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:35:04.5117 (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: ksNltWXTuoeicG+6yRaJy29lpDiOzysW+W6Bim83iL9mHM8oN13x5HI8pW9fHHzCb/RYaZ+rC7b4dle/7DT6Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F8FFC7EE43 for ; Mon, 12 Jun 2023 20:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234786AbjFLUf3 (ORCPT ); Mon, 12 Jun 2023 16:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237568AbjFLUfS (ORCPT ); Mon, 12 Jun 2023 16:35:18 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2073.outbound.protection.outlook.com [40.107.8.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D4C1701; Mon, 12 Jun 2023 13:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EbgN8OsXKp4kaEC5weVK1RqWB0BDvmNNr4uewSZ2nCRYmnqJvi4OdycMpNR6/TltiS2W9k+Ch8q2bFrQXHYLwkFCcUfZypgNqiEk+t6Kn/ydPFe6vXPSuIHpdop47r93u9TznEn9/xY1w5K7TgzbbjkrlponWuHOx82nruM9qBSERwjDaNdfg5Nic6R3Dq3FfWvV9kfbMwjt0+gObzS17R3EzqWepFe6F4qgPWM3ndiZt6UcBMrCEi2mSlh8OjK5xfJ15ca0BNYkx6+sNzpBbHMhzfI8haLhq/1Rh1IYOz1kZObUfpOel6NzYbzDJl4IpjqZDgV65arLHX0+hHswNQ== 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=YNfsRT118tsmZ4WUCwcCCj5GWRq1ZTnuhSW9KCn8pZc0B4MAqtjA7/Nija8/bN/QqtLJ6/nDGjIINhA8txKkNQ/hASb9RiRzxaPX2wxH/4zuJdwDYswf1C9CyNb5YE+rTng6CCdZKk1xoWcNqiNOK5jyUsIRNtYwrqU2dfx2sHxvt+NYIyBFDqRt8i1Sd22Ykb5P5oQOUTONVC/rXlZlMLctnR9guzgJjypyTwYSroQs558J0rciwM20hDrK/KJWniHriGgUV37b4qeKosIzCh7PnH7+w4Y5NAUmFUoWfVLCUmXhC54XTeVpCdFIX34iauyvjmfqRqvUJvrMRxzCtw== 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=DSJBwIook2UFSGg9A4hSFOXrhn4TO1J/G5RKURFIbOGKFoknHMiR7vIsrKzffFDCdrF90pH8W5B9xoEZHkr04BYxzHTNEJ7TfL4sulyjRXjM1zlJyFpCGtya6VoWO3HO30BiVxWpds6p+Q1NFSZYhr5vsBRAtE1JMDM8RshhQus= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:35:07 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20: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 v4 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Date: Mon, 12 Jun 2023 16:34:16 -0400 Message-Id: <20230612203418.2017769-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: af7d6b02-bcba-471a-639b-08db6b84828e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OW23S6uPJluEFj9nOQT2hDRzieEphMKOxmpmfJ1Ug6O5/yDijzW6TT/R7Ew3S8tEYSMKVEpUBaMceB97B4ZQSSVzPUl8Rf9ORdnaJ48dH28d+IT1LaPXPtK+h6AKYZ7wVX608SFK0gY2ethvfKvKkahEM2A2buAQTj4CK2uHetaR0iGcb6z/b8Axmk/NbAOQ4r/z+c1jqV5SzKuB/Z0ASKVVVz1iDxnFi4IC/lrgzZr2oaAbY9OKlHkWGH20hruwwZWnrZJ6pLDbGqJcvG63BnO8gJmivkAMWEZ9IuoMj4xmVIUwew2f7gtpi2sfT9oF/g76ds8Zl9dAMrhGdJOFwi8BJgDerStJcKmttKVxlZbVBd5wIeT5omrHHaTUrdgm/cLlUpqEXsiNAcvepSwyr9FrgKolkLnGpbcuo7Y1Aljxcsonan7sKWl3sVKuqcwTdFvteB3075YUqIkxfQfoWOXBiytr7Xuk7kfO2E6UKEM4xoWIDk5gX79tiTl/ZrclYXEuwQQi3MMcaAwq8LXFUWWB8BMTNnQ5Nl94sYiIZKzmbE6v6CaZ65ch4uYqnBdK05nQ5DSVHgHGHLPLbQ/4ddFChIWvmhjoYLO0j/1dBj3bU3oO3uA0ULHH18TgA22k X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(966005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pif95yWgiVWwOszr4WkA2NuEQdEp9Q4el8jHz2xAB/hw4vGgys0xE7JBBgxwnvcbmoutxdFq4+olApQVqMyPnw4lLkWbOnQbvSQMUklyu0ucBDT+VJcYq3w06hSJF8XxFrz5eSRiNb7wUaIkePPt8uaCSbgPbNP+HAX1TFI827lG1QcXvrpwLw2Fj+t5jlZQOz4SHlLeYVSRBezzxtXY87HZdashgAT1mperwR+84l6gIlRJkPiJElx2hD/mBVtEzbi17zVo1zFnN/6ZAuZyE5kGEN12rS5ajd0svjiTdew2kGIinZdpbjpmAac9gEEJWeRGS+ni3XWrnzYYsAK3I6tixoho7/85etuCxalpchLeDUondOzBedJCH1QwZ/PcibYSiBN07UoHFyp6xnknvBZBHynHG+FSs1cItLJe/56IDa3xFeJ2wrZ4QpJ6TArQ4WWWnI2mA3IZq2edxWNfnfhSi0rA/8clamB3zkTGN2YUrfatISBqOm841sfcctYpZSGW2K+UUFIUFJycw+GdbL4rhXLDPZ8S7kJQN3AVf5Ml8KzmUm3Qdfp7SQHfkf1mLuJ/XDkH4QMxaltNFqAkgSP/hRCTDaEtkmKjzAVzi8x+/IuR1q7suSjOTNX4KPeOzLCgEoRQrmhIbfMw9g+w5pywd+Q0cH1seCE7gsF8mU71dWSaDp6CV9K2gEB4Zg/uBDuD7KyyXmWEiJ7oWVfi/Li6+VbHl6SKqlHoP1MaOHlvfE1K9uvOzFcBndy8DwruyjDaCkY0yCJLRf1/icxmVMe2XjDifBU7gN0EEI93MRrlREJsThHodsTgv/qU18LbZuh2nQBQ2Tt/lPR9RpwyNuPFbgwAnzVdyq5N4FbCCS6rjsBJXsWsqHejTvK7VQUGl/AaBYH3QNj8dn3nl0uBW/WWBPj5NUDniZAODMvYbJqVrMqj3H/+K8MddTApder9EPLK+V4jSfWq3vrgVWnManQz6LOCgVRG4Vxeqjj3+qMob8yFWsP1kW7q+0YjZEthIyajUi7A2Vlt3IeOLZDx4nxkNrVGqDgfvCmQqdrT3rQ//bpy5hSaX7C+zWAFlckOdBAITXUDOm0lQjQxFtohf3Q8d4v9sFi5mYSE0veonrbwKRxZwiYICveh1IGJPDB0tn4M93adnrvDw6tU1aDSWhqUVK6nuuY39VHwWzV2kqK37LoEcJ/3VJHv9qY0VPVcEPi/6n5P2BP9qf/bQ00f+mkLkutWhVBPcQBsxt/+C0Sr9HqmxeRysQAULu5aiAX7Dol68BKgyZL58BC3BFYlXQK0b3VKxYMVt11uCpCIg2UBQiAjJTbG9vZjlzQzXFBFsCQCYG9Ke9UqaqWOmPebCNzXZ0FcZ8cC9DMjWQvO7wgKXqW5L7G2gw/nl8WGztuYvw84JTUnoQJnnn1WVULxyiiT6fEUJH5pK4Al5Ek0G3Ws3yPNcUuEtR1ymBoqcxkbRSg3iY8IgLut6T2i1C3bQqZ1rO82FEwXnfuMnmL+VE+H9NYN7Q2G2IAsCIjaZN2UwcP8IQee8HmcRblvDzqwhmYh36ine5/K5CvWsEIh5aqT4xZU3tOSNZXJFSspad81 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: af7d6b02-bcba-471a-639b-08db6b84828e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:35:07.5118 (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: Ro8J10YpHDiEPar/vfNS4XyhWbMwJzLlFkRXwBtzsr0s87kfl5vU07bqZyltitecL98FHOd8UeJBDPrdEKB91w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Mon Jun 12 20:34:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DB16C7EE2E for ; Mon, 12 Jun 2023 20:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233496AbjFLUgF (ORCPT ); Mon, 12 Jun 2023 16:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236005AbjFLUfc (ORCPT ); Mon, 12 Jun 2023 16:35:32 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B821732; Mon, 12 Jun 2023 13:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bk8MUoMCo+OOQuziZj2La78MTmfUIdndWWzzzA/+ueHgymcMcxemRTPSTb4ILRpbPkz+wmFSqoEXlVDj8TtxFwTBPkP77QA+kHdgrWF84fHlCnFARWH5mz93t334YLquySYjV/GjlnR9w2OKYeqiLF//FyTqQsdBynEUpAmEHk4b/6RtZXvknfHkW/f7YU68slq9c4ZqV81h2ex5ZyO7A156LTcXE9egZeoLq0up9BY/QtaVMsG1guNAS5JbNH9/ePpYaFPfMLcaCZDeo9da/DrgftCyuke7fvuv1vn7Wx4bDFTGhsFrOdUt5geesU+TQxJabmNzG2aWCxWPgbDdLA== 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=Z9GnRBMvLvdXw8x4t6WG5pJ0iYcqy2Ls7Gud1t1tNIM6N30UUrBqHROlh5eLOGiMlMAmwxBiVKs5ru2d5BSvOy5Avhv6CGzxbw9SxdQV/2+NQFG9WOdG/FfB6jFVPhjs+CZ0lx5JD5rFvwu1jkU6WJPn/0arbApVKgFzJeBeBmjl/3oJStPAIVkWOsbW4H/KxF3fMKzI/07WjNisplFRtuS0GndEfOx1pBUIQw1hIGCRie6msO06/v5HLhiFlK+q59wcyvefW4Qu+Pl//wVT38SQE7TB0WKXn/IvSufsOfHZgBM3Wulr+ckPoddg56FMykJXBOMWOsDARX8I+swTUw== 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=UOlDNkUD867aB8XvTEAc65xHzJGlHYgcDEeStfXzhHqhtqJYhpDXHKEBIkcTosmkQE/NCMGICaINy8qqopqTJawptLHlki7HfGW4CsAygShcuC/vNdcCE8ZsHLThMeAFCAT/eiUQJ4jPJHI6xg/yttiqizhAPdSFC8fhbzSYcaU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:35:10 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:35:10 +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 v4 11/12] dmaengine: fsl-edma: integrate v3 support Date: Mon, 12 Jun 2023 16:34:17 -0400 Message-Id: <20230612203418.2017769-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: cfbaf40c-00ec-49bb-bc09-08db6b848455 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KZzm5LcdZBCHnmCJVjLEW+IVMfa3bX6Xbu/0Nq1TWPY3f0DyXipa+9z3mXkxD+iCuZ/aYdFKbFo4c6nXYg7u9Msx3nPuvCiEfsSio4PgZtU9VW38Z1ny/eRG3/8a/gt2NHhO4uydPfGOhM1TsoUx6xyG0UHuc/TA00eGOYfiizgqLSSxHt3JBgY+TKpMajex10+3HAWgcDCOF6SaGxly71GpbyaSMFR7nrb4Y/E/GkgDMk7DGfDzR5FDJWdHZPXi4s9D8LZ/7Axi9CwAvKrOn7/srSRqs2+aivz6QD5rpaRcQ0Dyxzq/WNy8MhNVoIvxI2El63mQnYQf8y3RJMNwNAREpv9uB/zhocXzD9EZxHU9swxk5HSnfsqS4RzjpfD5iA6WZkxWhAOaPJ/DlYvUGyaUZQY2CYtnpvLWKx0R+NqVVltQMZiApxtg5NRyLV/xWugS1/xwcD7iXw60IWJbIjYxjBrLAjKShK2VquZebrRAnXslxNSSGolESL6XOHIq31CFPz3IGFrxUO3s1G6PCWXAfPsN1kKS6ob1TpzbjrDk5WWKmw955IUooG6RgiOW/iFNwzX3xQQp/HhamoywBBtttf80KzyRjHQ4lH+wAs5EPh5L4dhcZCkPM2fzAj7Dz5DnJ2VE3mCXWAN4jamfnA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(8936002)(2906002)(30864003)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Aci0buRhkUP6PU/0mIVY/uMQwcIHrwOQhEI5oVtnkA4EghVHS7t/hk2VMekg+SYpbjjiyVoY2DxdwRmdSnkEfrli5HDOfGw9N5fwcTaeq7JQkTOEx96yEI7LH3aQpDwywJEsjK7llPjOEbGQOflSuht/WSdbSnvk80fWJ/G1ZvfFYh22aDZG/RzeysHuq2Q3xDn6ZHv7gPaFH/f2Qz7sbbB79hDVi3KzPYU/uTNOXS/zeC7ZWxPQy9UsgSWRwRGpZ+HgRnpsjpy01dl9E2r88JAc+lxG+CcbRAHJsvTYRxoUX9eDgIQMmAbc6w9bI6JtTdm8LfBw06p6usI/qlpDoim2nh1hWoEuyPw2m0QNkHlcON2niRlnlhWLeNzHPIXiuSB5aWY9YsbccBEj7Mi0JY8yRBtjuD6N1SL1lIX6oOAOALqRjeLdX6ezr/gIP04OV2CuKAXpVhWMqcBYrR3mNF1JVrzpZu9Gryl0F8tcK7LVmJacMb9atDpPhChmSV6dxXP//kitVgk6lvyNhLYA//sroBmfY0JL2DYFNkI84ONishI9HpJT9YEkiU2+o3Ln0SN36j9Du2jjPj7y3aQdLxCOHMGodatWaI5yX5RkmtmbAAKJihAVIbg3jj1RREkGhoTHMOnD8/cGGdxM3WwjyhUtEiFs0iBKMfcku/DliEHRku8q4WJLCHK6VG447YcNz4V/25Tvqo2XFltSW9VV4F5cBI3M+neKEkNkIopN/eEtqNmH9gsXuv572MBMLOA/I2+qoPPKAylUK2T04MwAhf6/R3cXg8YONsrOyrBmHyekQeFUp1DhT/S65Q4of+nGmJ9QlBzKPF6/Ga9Y50FvgADHVvNSNTwgumReiJXSauanyctSxBA9CGGiVhPbOcqcqAFDVNbUSoCzAHfsjtrDjnuBC6KeN/tIYS8cL8Mib1Z1zDydpiAq7uqCf26hT2WFiJcgCjALg2WbsrHchjKnaJ+g6HUmypzn91tsMXHXfTcM89O2VCMFicDBHeJG1EiKqY+KMIDspWfjd7Tes/4J4M73bhZNaJhsqg7IvBU22YuHYOgzWgYassQoX8EJmqKgcw/QBijCKgOEbm1PTS37c6Hp9iGH5UUlCpIl8E5/dlnUAq83VCEGMfqa+C7VL2dEM1nXsvYXtc22iVRHCr6Hoeh7DLrTSogTYWzQNSkvu0Z8xhn/F+Lz5jCgpeDRukCNi2EmeLOMx9xOZSzf7yHke5K8uHuQNneHokxAgURBFzu5eJll2EnH6LovlwV0SuUgcUxXT2Ewg8NWTj1wY3mWCcms++eSwYESDi/rcCpNFeFPNRAJmHq3zndHez3/n/R7hUQLPpt2gkaMZj+yeMIXfYHEoj5OyIIyJ6skCHSWYOHIfjZmM1lWD9JUbM6jlsR9FbyXklzsm7g7TL8XQT3EwKLEhbVnIxS50t0sdn1BT+3NXfO2P2mQiHTHs2vWSSzfjLZ1HnGbbaGABb4Q5S6ztm6lJAOY55IN7WKge/GnHpbQphwzKYB2JGjjgDs8TAxSUqydGBgG50zUG1c+Is/ErSKziiZltC1gV/kPlTsI+bcmf1CvQu1kxeNP/Ld7a5K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfbaf40c-00ec-49bb-bc09-08db6b848455 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:35:10.6472 (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: qLAZUaWqafqeFUSG+IbqYGtoEmn5gu5bCfDACLLPqee6WiTea5oNxWYLiq014q8iAxcr29M3nXLTYWLY9M5+Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Significant alterations have been made to the EDMA v3's register layout. Now, each channel possesses a separate address space, encapsulating all channel-related controls and statuses, including IRQs. There are changes in bit position definitions as well. However, the fundamental control flow remains analogous to the previous versions. EDMA v3 was utilized in imx8qm, imx93, and will be in forthcoming chips. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 158 +++++++++++++++++++--- drivers/dma/fsl-edma-common.h | 73 +++++++++- drivers/dma/fsl-edma-main.c | 247 ++++++++++++++++++++++++++++++++-- 3 files changed, 454 insertions(+), 24 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index eead6a4765f7..bec1f4d6a3e1 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" @@ -66,11 +68,46 @@ void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) spin_unlock(&fsl_chan->vchan.lock); } +static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val, flags; + + flags = fsl_edma_drvflags(fsl_chan); + val = edma_readl_chreg(fsl_chan, ch_sbr); + /* Remote/local swapped wrongly on iMX8 QM Audio edma */ + if (flags & FSL_EDMA_DRV_QUIRK_SWAPPED) { + if (!fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } else { + if (fsl_chan->is_rxchan) + val |= EDMA_V3_CH_SBR_RD; + else + val |= EDMA_V3_CH_SBR_WR; + } + + if (fsl_chan->is_remote) + val &= ~(EDMA_V3_CH_SBR_RD | EDMA_V3_CH_SBR_WR); + + edma_writel_chreg(fsl_chan, val, ch_sbr); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux); + + val = edma_readl_chreg(fsl_chan, ch_csr); + val |= EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_enable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, EDMA_SEEI_SEEI(ch), regs->seei); edma_writeb(fsl_chan->edma, ch, regs->serq); @@ -83,11 +120,28 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan) } } +static void fsl_edma3_disable_request(struct fsl_edma_chan *fsl_chan) +{ + u32 val = edma_readl_chreg(fsl_chan, ch_csr); + u32 flags; + + flags = fsl_edma_drvflags(fsl_chan); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) + edma_writel_chreg(fsl_chan, 0, ch_mux); + + val &= ~EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +} + void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_SPLIT_REG) + return fsl_edma3_disable_request(fsl_chan); + if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_WRAP_IO) { edma_writeb(fsl_chan->edma, ch, regs->cerq); edma_writeb(fsl_chan->edma, EDMA_CEEI_CEEI(ch), regs->ceei); @@ -135,6 +189,9 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, int endian_diff[4] = {3, 1, -1, -3}; u32 dmamux_nr = fsl_chan->edma->drvdata->dmamuxs; + if (!dmamux_nr) + return; + chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux; @@ -186,6 +243,10 @@ int fsl_edma_terminate_all(struct dma_chan *chan) vchan_get_all_descriptors(&fsl_chan->vchan, &head); spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); vchan_dma_desc_free_list(&fsl_chan->vchan, &head); + + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_PD) + pm_runtime_allow(fsl_chan->pd_dev); + return 0; } @@ -286,12 +347,16 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; + u32 nbytes = 0; int i; /* calculate the total size in this desc */ - for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) - len += le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) { + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + len += nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + } if (!in_progress) return len; @@ -303,8 +368,12 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { - size = le32_to_cpu(edesc->tcd[i].vtcd->nbytes) - * le16_to_cpu(edesc->tcd[i].vtcd->biter); + nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) + nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); + + size = nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + if (dir == DMA_MEM_TO_DEV) dma_addr = le32_to_cpu(edesc->tcd[i].vtcd->saddr); else @@ -389,12 +458,15 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, } static inline -void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, +void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, + struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, u16 attr, u16 soff, u32 nbytes, u32 slast, u16 citer, u16 biter, u16 doff, u32 dlast_sga, bool major_int, bool disable_req, bool enable_sg) { + struct dma_slave_config *cfg = &fsl_chan->cfg; u16 csr = 0; + u32 burst; /* * eDMA hardware SGs require the TCDs to be stored in little @@ -409,6 +481,21 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, tcd->soff = cpu_to_le16(soff); + if (fsl_chan->is_multi_fifo) { + /* set mloff to support multiple fifo */ + burst = cfg->direction == DMA_DEV_TO_MEM ? + cfg->src_addr_width : cfg->dst_addr_width; + nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-(burst * 4)); + /* enable DMLOE/SMLOE */ + if (cfg->direction == DMA_MEM_TO_DEV) { + nbytes |= EDMA_V3_TCD_NBYTES_DMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_SMLOE; + } else { + nbytes |= EDMA_V3_TCD_NBYTES_SMLOE; + nbytes &= ~EDMA_V3_TCD_NBYTES_DMLOE; + } + } + tcd->nbytes = cpu_to_le32(nbytes); tcd->slast = cpu_to_le32(slast); @@ -427,6 +514,12 @@ void fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, if (enable_sg) csr |= EDMA_TCD_CSR_E_SG; + if (fsl_chan->is_rxchan) + csr |= EDMA_TCD_CSR_ACTIVE; + + if (fsl_chan->is_sw) + csr |= EDMA_TCD_CSR_START; + tcd->csr = cpu_to_le16(csr); } @@ -466,6 +559,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); struct fsl_edma_desc *fsl_desc; dma_addr_t dma_buf_next; + bool major_int = true; int sg_len, i; u32 src_addr, dst_addr, last_sg, nbytes; u16 soff, doff, iter; @@ -509,17 +603,23 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( src_addr = dma_buf_next; dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; - doff = 0; - } else { + doff = fsl_chan->is_multi_fifo ? 4 : 0; + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = dma_buf_next; - soff = 0; + soff = fsl_chan->is_multi_fifo ? 4 : 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = doff = 0; + major_int = false; } - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, dst_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, - iter, doff, last_sg, true, false, true); + iter, doff, last_sg, major_int, false, true); dma_buf_next += period_len; } @@ -568,23 +668,51 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( dst_addr = fsl_chan->dma_dev_addr; soff = fsl_chan->cfg.dst_addr_width; doff = 0; - } else { + } else if (direction == DMA_DEV_TO_MEM) { src_addr = fsl_chan->dma_dev_addr; dst_addr = sg_dma_address(sg); soff = 0; doff = fsl_chan->cfg.src_addr_width; + } else { + /* DMA_DEV_TO_DEV */ + src_addr = fsl_chan->cfg.src_addr; + dst_addr = fsl_chan->cfg.dst_addr; + soff = 0; + doff = 0; } + /* + * Choose the suitable burst length if sg_dma_len is not + * multiple of burst length so that the whole transfer length is + * multiple of minor loop(burst length). + */ + if (sg_dma_len(sg) % nbytes) { + u32 width = (direction == DMA_DEV_TO_MEM) ? doff : soff; + u32 burst = (direction == DMA_DEV_TO_MEM) ? + fsl_chan->cfg.src_maxburst : + fsl_chan->cfg.dst_maxburst; + int j; + + for (j = burst; j > 1; j--) { + if (!(sg_dma_len(sg) % (j * width))) { + nbytes = j * width; + break; + } + } + /* Set burst size as 1 if there's no suitable one */ + if (j == 1) + nbytes = width; + } iter = sg_dma_len(sg) / nbytes; if (i < sg_len - 1) { last_sg = fsl_desc->tcd[(i + 1)].ptcd; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, false, false, true); } else { last_sg = 0; - fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr, dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, true, true, false); @@ -609,7 +737,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, fsl_chan->is_sw = true; /* To match with copy_align and max_seg_size so 1 tcd is enough */ - fsl_edma_fill_tcd(fsl_desc->tcd[0].vtcd, dma_src, dma_dst, + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[0].vtcd, dma_src, dma_dst, fsl_edma_get_tcd_attr(DMA_SLAVE_BUSWIDTH_32_BYTES), 32, len, 0, 1, 1, 32, 0, true, true, false); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index cfc41915eaa1..3cc0cc8fc2d0 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -42,6 +42,11 @@ #define EDMA_TCD_CSR_ACTIVE BIT(6) #define EDMA_TCD_CSR_DONE BIT(7) +#define EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(x) ((x) & GENMASK(9, 0)) +#define EDMA_V3_TCD_NBYTES_MLOFF(x) (x << 10) +#define EDMA_V3_TCD_NBYTES_DMLOE (1 << 30) +#define EDMA_V3_TCD_NBYTES_SMLOE (1 << 31) + #define EDMAMUX_CHCFG_DIS 0x0 #define EDMAMUX_CHCFG_ENBL 0x80 #define EDMAMUX_CHCFG_SOURCE(n) ((n) & 0x3F) @@ -54,6 +59,15 @@ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_8_BYTES)) + +#define EDMA_V3_CH_SBR_RD BIT(22) +#define EDMA_V3_CH_SBR_WR BIT(21) +#define EDMA_V3_CH_CSR_ERQ BIT(0) +#define EDMA_V3_CH_CSR_EARQ BIT(1) +#define EDMA_V3_CH_CSR_EEI BIT(2) +#define EDMA_V3_CH_CSR_DONE BIT(30) +#define EDMA_V3_CH_CSR_ACTIVE BIT(31) + enum fsl_edma_pm_state { RUNNING = 0, SUSPENDED, @@ -73,6 +87,18 @@ struct fsl_edma_hw_tcd { __le16 biter; }; +struct fsl_edma3_ch_reg { + __le32 ch_csr; + __le32 ch_es; + __le32 ch_int; + __le32 ch_sbr; + __le32 ch_pri; + __le32 ch_mux; + __le32 ch_mattr; /* edma4, reserved for edma3 */ + __le32 ch_reserved; + struct fsl_edma_hw_tcd tcd; +} __packed; + /* * These are iomem pointers, for both v32 and v64. */ @@ -119,6 +145,18 @@ struct fsl_edma_chan { enum dma_data_direction dma_dir; char chan_name[32]; struct fsl_edma_hw_tcd __iomem *tcd; + u32 real_count; + struct work_struct issue_worker; + struct platform_device *pdev; + struct device *pd_dev; + u32 srcid; + struct clk *clk; + int priority; + int hw_chanid; + int txirq; + bool is_rxchan; + bool is_remote; + bool is_multi_fifo; }; struct fsl_edma_desc { @@ -135,8 +173,26 @@ struct fsl_edma_desc { #define FSL_EDMA_DRV_CONFIG32 BIT(2) #define FSL_EDMA_DRV_WRAP_IO BIT(3) #define FSL_EDMA_DRV_EDMA64 BIT(4) +#define FSL_EDMA_DRV_HAS_PD BIT(5) +#define FSL_EDMA_DRV_HAS_CHCLK BIT(6) +#define FSL_EDMA_DRV_HAS_CHMUX BIT(7) +/* imx8 QM audio edma remote local swapped */ +#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8) +/* control and status register is in tcd address space, edma3 reg layout */ +#define FSL_EDMA_DRV_SPLIT_REG BIT(9) +#define FSL_EDMA_DRV_BUS_8BYTE BIT(10) +#define FSL_EDMA_DRV_DEV_TO_DEV BIT(11) +#define FSL_EDMA_DRV_ALIGN_64BYTE BIT(12) + +#define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \ + FSL_EDMA_DRV_BUS_8BYTE | \ + FSL_EDMA_DRV_DEV_TO_DEV | \ + FSL_EDMA_DRV_ALIGN_64BYTE) + struct fsl_edma_drvdata { - u32 dmamuxs; + u32 dmamuxs; /* only used before v3 */ + u32 chreg_off; + u32 chreg_space_sz; u32 flags; int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); @@ -148,6 +204,7 @@ struct fsl_edma_engine { void __iomem *muxbase[DMAMUX_NR]; struct clk *muxclk[DMAMUX_NR]; struct clk *dmaclk; + struct clk *chclk; struct mutex fsl_edma_mutex; const struct fsl_edma_drvdata *drvdata; u32 n_chans; @@ -155,6 +212,7 @@ struct fsl_edma_engine { int errirq; bool big_endian; struct edma_regs regs; + u64 chan_masked; struct fsl_edma_chan chans[]; }; @@ -168,6 +226,14 @@ struct fsl_edma_engine { edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) +#define edma_readl_chreg(chan, __name) \ + edma_readl(chan->edma, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + +#define edma_writel_chreg(chan, val, __name) \ + edma_writel(chan->edma, val, \ + (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. @@ -224,6 +290,11 @@ static inline struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan) return container_of(chan, struct fsl_edma_chan, vchan.chan); } +static inline u32 fsl_edma_drvflags(struct fsl_edma_chan *fsl_chan) +{ + return fsl_chan->edma->drvdata->flags; +} + static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) { return container_of(vd, struct fsl_edma_desc, vdesc); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 8ba705080f5d..b0ddb82862ea 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -18,9 +18,15 @@ #include #include #include +#include +#include #include "fsl-edma-common.h" +#define ARGS_RX BIT(0) +#define ARGS_REMOTE BIT(1) +#define ARGS_MULTI_FIFO BIT(2) + static void fsl_edma_synchronize(struct dma_chan *chan) { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); @@ -47,6 +53,22 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t fsl_edma3_tx_handler(int irq, void *dev_id) +{ + struct fsl_edma_chan *fsl_chan = dev_id; + unsigned int intr; + + intr = edma_readl_chreg(fsl_chan, ch_int); + if (!intr) + return IRQ_HANDLED; + + edma_writel_chreg(fsl_chan, 1, ch_int); + + fsl_edma_tx_chan_handler(fsl_chan); + + return IRQ_HANDLED; +} + static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) { struct fsl_edma_engine *fsl_edma = dev_id; @@ -108,6 +130,51 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, return NULL; } +static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data; + struct dma_chan *chan, *_chan; + struct fsl_edma_chan *fsl_chan; + bool b_chmux; + int i; + + if (dma_spec->args_count != 3) + return NULL; + + b_chmux = !!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_HAS_CHMUX); + + mutex_lock(&fsl_edma->fsl_edma_mutex); + list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, + device_node) { + + if (chan->client_count) + continue; + + fsl_chan = to_fsl_edma_chan(chan); + i = fsl_chan - fsl_edma->chans; + + chan = dma_get_slave_channel(chan); + chan->device->privatecnt++; + fsl_chan->priority = dma_spec->args[1]; + fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX; + fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE; + fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO; + + if (!b_chmux && i == dma_spec->args[0]) { + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } else if (b_chmux && !fsl_chan->srcid) { + /* if controller support channel mux, choose a free channel */ + fsl_chan->srcid = dma_spec->args[0]; + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return chan; + } + } + mutex_unlock(&fsl_edma->fsl_edma_mutex); + return NULL; +} + static int fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) { @@ -149,6 +216,37 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma return 0; } +static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + int ret; + int i; + + for (i = 0; i < fsl_edma->n_chans; i++) { + + struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; + + /* request channel irq */ + fsl_chan->txirq = platform_get_irq(pdev, i); + if (fsl_chan->txirq < 0) { + dev_err(&pdev->dev, "Can't get chan %d's irq.\n", i); + return -EINVAL; + } + + ret = devm_request_irq(&pdev->dev, fsl_chan->txirq, + fsl_edma3_tx_handler, IRQF_SHARED, + fsl_chan->chan_name, fsl_chan); + if (ret) { + dev_err(&pdev->dev, "Can't register chan%d's IRQ.\n", i); + return -EINVAL; + } + } + + return 0; +} + static int fsl_edma2_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) @@ -203,29 +301,109 @@ static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) static struct fsl_edma_drvdata vf610_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata ls1028a_data = { .dmamuxs = DMAMUX_NR, .flags = FSL_EDMA_DRV_MUX_SWAP | FSL_EDMA_DRV_WRAP_IO, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .setup_irq = fsl_edma_irq_init, }; static struct fsl_edma_drvdata imx7ulp_data = { .dmamuxs = 1, + .chreg_off = EDMA_TCD, + .chreg_space_sz = sizeof(struct fsl_edma_hw_tcd), .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32, .setup_irq = fsl_edma2_irq_init, }; +static struct fsl_edma_drvdata imx8qm_data = { + .flags = FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx8qm_audio_data = { + .flags = FSL_EDMA_DRV_QUIRK_SWAPPED | FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data3 = { + .flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + +static struct fsl_edma_drvdata imx93_data4 = { + .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x8000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, +}; + static const struct of_device_id fsl_edma_dt_ids[] = { { .compatible = "fsl,vf610-edma", .data = &vf610_data}, { .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data}, { .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data}, + { .compatible = "fsl,imx8qm-edma", .data = &imx8qm_data}, + { .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data}, + { .compatible = "fsl,imx93-edma3", .data = &imx93_data3}, + { .compatible = "fsl,imx93-edma4", .data = &imx93_data4}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids); +static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) +{ + struct fsl_edma_chan *fsl_chan; + struct device_link *link; + struct device *pd_chan; + struct device *dev; + int i; + + dev = &pdev->dev; + + for (i = 0; i < fsl_edma->n_chans; i++) { + if (fsl_edma->chan_masked & BIT(i)) + continue; + + fsl_chan = &fsl_edma->chans[i]; + + pd_chan = dev_pm_domain_attach_by_id(dev, i); + if (IS_ERR_OR_NULL(pd_chan)) { + dev_err(dev, "Failed attach pd %d\n", i); + return -EINVAL; + } + + link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (IS_ERR(link)) { + dev_err(dev, "Failed to add device_link to %d: %ld\n", i, + PTR_ERR(link)); + return -EINVAL; + } + + fsl_chan->pd_dev = pd_chan; + + pm_runtime_use_autosuspend(fsl_chan->pd_dev); + pm_runtime_set_autosuspend_delay(fsl_chan->pd_dev, 200); + pm_runtime_set_active(fsl_chan->pd_dev); + //pm_runtime_put_sync_suspend(fsl_chan->pd_dev); + } + + return 0; +} + static int fsl_edma_probe(struct platform_device *pdev) { const struct of_device_id *of_id = @@ -234,6 +412,7 @@ static int fsl_edma_probe(struct platform_device *pdev) struct fsl_edma_engine *fsl_edma; const struct fsl_edma_drvdata *drvdata = NULL; struct fsl_edma_chan *fsl_chan; + u32 chan_mask[2] = {0, 0}; struct edma_regs *regs; int len, chans; int ret, i; @@ -264,8 +443,10 @@ static int fsl_edma_probe(struct platform_device *pdev) if (IS_ERR(fsl_edma->membase)) return PTR_ERR(fsl_edma->membase); - fsl_edma_setup_regs(fsl_edma); - regs = &fsl_edma->regs; + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) { + fsl_edma_setup_regs(fsl_edma); + regs = &fsl_edma->regs; + } if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); @@ -275,9 +456,29 @@ static int fsl_edma_probe(struct platform_device *pdev) } } + if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) { + fsl_edma->chclk = devm_clk_get_enabled(&pdev->dev, "mp"); + if (IS_ERR(fsl_edma->chclk)) { + dev_err(&pdev->dev, "Missing MP block clock.\n"); + return PTR_ERR(fsl_edma->chclk); + } + } + + ret = of_property_read_variable_u32_array(np, "dma-channel-mask", chan_mask, 1, 2); + + if (ret > 0) { + fsl_edma->chan_masked = chan_mask[1]; + fsl_edma->chan_masked <<= 32; + fsl_edma->chan_masked |= chan_mask[0]; + } + for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { char clkname[32]; + /* eDMAv3 mux register move to TCD area if ch_mux exist */ + if (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) + break; + fsl_edma->muxbase[i] = devm_platform_ioremap_resource(pdev, 1 + i); if (IS_ERR(fsl_edma->muxbase[i])) { @@ -297,9 +498,18 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); + if (drvdata->flags & FSL_EDMA_DRV_HAS_PD) { + ret = fsl_edma3_attach_pd(pdev, fsl_edma); + if (ret) + return ret; + } + INIT_LIST_HEAD(&fsl_edma->dma_dev.channels); for (i = 0; i < fsl_edma->n_chans; i++) { - struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i]; + fsl_chan = &fsl_edma->chans[i]; + + if (fsl_edma->chan_masked & BIT(i)) + continue; snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d", dev_name(&pdev->dev), i); @@ -310,8 +520,13 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_chan->idle = true; fsl_chan->dma_dir = DMA_NONE; fsl_chan->vchan.desc_free = fsl_edma_free_desc; - fsl_chan->tcd = fsl_edma->membase + EDMA_TCD - + i * sizeof(struct fsl_edma_hw_tcd); + + len = (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG) ? + offsetof(struct fsl_edma3_ch_reg, tcd) : 0; + fsl_chan->tcd = fsl_edma->membase + + i * drvdata->chreg_space_sz + drvdata->chreg_off + len; + + fsl_chan->pdev = pdev; vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); edma_write_tcdreg(fsl_chan, 0, csr); @@ -345,12 +560,25 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma->dma_dev.src_addr_widths = FSL_EDMA_BUSWIDTHS; fsl_edma->dma_dev.dst_addr_widths = FSL_EDMA_BUSWIDTHS; + + if (drvdata->flags & FSL_EDMA_DRV_BUS_8BYTE) { + fsl_edma->dma_dev.src_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + fsl_edma->dma_dev.dst_addr_widths |= BIT(DMA_SLAVE_BUSWIDTH_8_BYTES); + } + fsl_edma->dma_dev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); + if (drvdata->flags & FSL_EDMA_DRV_DEV_TO_DEV) + fsl_edma->dma_dev.directions |= BIT(DMA_DEV_TO_DEV); + + fsl_edma->dma_dev.copy_align = drvdata->flags & FSL_EDMA_DRV_ALIGN_64BYTE ? + DMAENGINE_ALIGN_64_BYTES : + DMAENGINE_ALIGN_32_BYTES; - fsl_edma->dma_dev.copy_align = DMAENGINE_ALIGN_32_BYTES; /* Per worst case 'nbytes = 1' take CITER as the max_seg_size */ dma_set_max_seg_size(fsl_edma->dma_dev.dev, 0x3fff); + fsl_edma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; + platform_set_drvdata(pdev, fsl_edma); ret = dma_async_device_register(&fsl_edma->dma_dev); @@ -360,7 +588,9 @@ static int fsl_edma_probe(struct platform_device *pdev) return ret; } - ret = of_dma_controller_register(np, fsl_edma_xlate, fsl_edma); + ret = of_dma_controller_register(np, + drvdata->flags & FSL_EDMA_DRV_SPLIT_REG ? fsl_edma3_xlate : fsl_edma_xlate, + fsl_edma); if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); @@ -369,7 +599,8 @@ static int fsl_edma_probe(struct platform_device *pdev) } /* enable round robin arbitration */ - edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); + if (!(drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) + edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); return 0; } From patchwork Mon Jun 12 20:34:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 691770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5D46C7EE2E for ; Mon, 12 Jun 2023 20:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238094AbjFLUgL (ORCPT ); Mon, 12 Jun 2023 16:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236848AbjFLUfv (ORCPT ); Mon, 12 Jun 2023 16:35:51 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD77110C9; Mon, 12 Jun 2023 13:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ABmMXSxgJYVJHKz1gCGwSbxegbydzXfZZZ0bYjEAgMUpvtlkMFtsb1ZQel1sn4KIwKCwnCQt9KEEeXWrsOFDusWA4nXeLvzHL9OvJHP8qS9cD6Jxz2tBtBt+tRhHR9QM+WjnUNz4EQhcXxJfBwOkN9Mx8eLXSUUzmK36YVh4IsyKP3Z45g49CoXmaPPE4slEyOo4f0w96yACoWAIQ0sxdvxNd5g36L4AA2lnaUoCaLrZlWLqYdy6L4zmiMS2UmRcXbx8la2j//0ifkRUmp0Njtyv/HiyOrvqqCWe6fpZBF9B6SYev9K0Ud0Y6lWLs2H+phLoqkIvfXFhcfl5mzP+mw== 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=9YUtCt2NXQUa21be/5g3CxLSwJ5IiHqX81mEMIh1qcQ=; b=WtIPYdD7bUe9Oohqe6vzplSeWTmbJzH7Va3BFslQo9bv4rLTN595D+FJrru4ndxxOGcHA3V+/rXWKcd2UGWm47iYra6N7i8BvRHg7ryC4VGqXYwYL4EDNnZnDsM0qVJwCZs5eLROG1VHIxN1zpFbiRoMesg4l6Ygd4X1RND40KiIEztAsxMYvVCEJwBq6A7u2krkhlcztCRgwXRQk+AqHLPeMTP0mg+zPiEpyaJL2ei33pwRde3rUilPFUoBUE2R1fcuesDnSgzy7SPOYgCDYa+InpOcwbqjSWQ/F/0TInBDeHz/YTbsh1X3ykQYmmtOAQ68xU0TxXEqzRVljG757Q== 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=9YUtCt2NXQUa21be/5g3CxLSwJ5IiHqX81mEMIh1qcQ=; b=KdXfe2Gy/5H9zJssbmDRSAbBGf4/DqpuKq2lCX41pl0BVftrJk5fHJXcwCPvl+6MK5yRmlEFb7PMIH6uARHxV0WjK2bcj1fhInfmxvHwJG5jjwAcT1guLLFYGtrI11lyDClFpzE+I1yXjkySn7+sKwXkPGYWlf63eLj8Lt1VwH4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:35:13 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:35:13 +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 v4 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Mon, 12 Jun 2023 16:34:18 -0400 Message-Id: <20230612203418.2017769-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a9e8a85-9d4a-480a-eb8e-08db6b848634 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CR4dwtrJHp2y+MSBvpTxfUqA0w4TQgtYwF+rtG3AQD63eV7Zwq6MIJ4k25rqEf6QSmTmJjla7i1OvPp9VyqQhJO6Vvlu/j4NwXD7FKrUQdiK8MFAHlrEcPvB5eHIlzYsbx1qDkCc+v8OhOOLenScAKc99oQiZj0Z74pV+rQqxmnzU7WxIE8swG+njCron/eMPDDMFaGNdvH6oJM40tb0pbZG4GYTdsDDEEIp5IBi1roi57aNBBJFQiMbvoKnyGVyTAJiJCh9G+8Xy9vzhV1FLGXj4AYn33x3hhLEeciO0nhvclLQdoD3yBGQIrIFR70kzDU6IjS1hdGy9N2slLjqwsKr4k6++XGQVqG+kZ5qOdyRoI1NmBlEG+JgVP2uRGeBTpLKloSRQJAq9lAeQvUqacdUZVlEESoZEjdYYhrS6eus9BGKG3PxLLug3lBroYE11eIX/mFG1cMpp5iEUqndJo9zejzcFXSsyjtrRVD6mM6WJ/ALjRjZxE7opqHBd/sPVStDlQS6toEzB13QqYl3PnUTV2V60wXYMt82dE63mTpTOsy45kNuWFli4BYXbHSkm1okmlR53x+bWYh00CyErUn9bPUnHIGtyUx+L1gTK0kYJ7KWSg25cBr/iX2ek3tn X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: umhrPbfitj6gzVV4+hbrQPZSAlSx3yzMgBWCaqbk55qpW8fmYk6uY9XF3SXZaDjdN1I754Jaw/LCBJcX23mqCLthpqsKyS3kQetvaeA1IwegWhZiX1js7wXtzRHlg9814cKZTLynQ3qThsFHeqvZ3OlKvXyzQIIf4+/a2HHzVi2x56+Oo1Hw4jLqaXa0DPiSEVT2V6jpM/x499z5vAOj+bMmuHO3lZUTr4oS/UHMTLvCMiRf0Bm6ln79Rxg+NoYX7kF6ccWCT5s5A2JJ35nCp7VG2sP1bMrihakfjPievSJAGpHMVKtKw/eb22oHDEZhAdotrLeDQ7uDBzI049eIZ/E/+SMRUJvXxuFto9SiKWdwpKK4IQW5EtL1utId4u/3VJITQQZOH2vU380QJQ/4l4KhgkcaWB9XLgEqS5PLZxxxEux8kP5RzGg5EJ/XJwUXBFIRTUlxczqNw8cJfmtlnjSJ6Abpqhuvo4pp+vm8posmNfEln01+7mhRpb8fh34FlDNC+rkdRTDMiLsG6vKNLC2px8BHjKgeMtQd1zAO3zHBEetES7YjdAkL6gKMxfV8aQ0l+/qaR0+sOTrLw9DZOfPLJbkDZEd8oT52ljrULQ0HuJ5zvhFmBBOE/bC4RG+LEia0yuljJ7iHLnMV194IKBgY3rGyw/igzWU5HlwTFUQbeItoe4eb6zGRkK7PYgIU9GywtV+0hXlEqaZXkv5vNGVfIVwvBXaz4ZxCOhZf0I4CF2h/bzYT4cguVk/ftL6y1ear8TSqbruq7JbRUTg5rL6Z/8wk1bPqgJ4EzoHI+D5kTJ3d9DKIGG7Pgv0gqHPgIxxYV9GoYLCc2lr30ET/8E4z9eVU+PVVCcWAB2xhixfDOy0OU1/stsr0LgHYybCRIjJiPogobCVJF+mEIGRTYt4Xm7Y0ZorJlzac3DeqBd4wnod+tY8BmIrVaBr930JPv+tnwbwUXPdr/ZaRborZVKLmuSELmlyqm9jZoM5awW0bTaCO+Xibf8534Ner79Lt/6N2ufbPjU6+ltzMdUwLBQgd+6VvHOaZjLYiG3IRG1CKV9AdRX3c9DKm1mngPHag0sBnXIDZ7ta995+LQMM2WaHFgW/LiFeCKjsG26FKQMC9zIlZ1y4WvF/k+xtggmWL/foMMkVkO6xTXxsIzOj5fdvRiQ7W9zNXqexcv357Z6fD9uIwrgt6PEMlntoGjR2kHe0/e9vjz71oCJpgsGAZq4Z+XVyhSOCJO8oxjPCLgnDtHhkt9oiFxNcpXZrcPocN09x60qMePZwC0uV4wzKewAPi/OJl5e2rVyErc0SVtvMbZWzHVvT5XWNk0Pp45RynDjipKtOHpIhBc3efIFCjnEl9/yqFK0wMwQ3DjIXo56h69eG1QpeXKYJGPiunDcOrrKYSbM5yI8h22OeqJoWtHoUtlutiP9BClnD/WZm0kaCBl4/f1/GrilKPBgS2ApQ/LJ0AwzVoNCNGcMllnyoqmHM+x1rlphJCjxflEjDHCzpBQZfyxWMA5Q7bF49DJ21XNrIpXWuHZWdepflxiX72HaL5lQsu+tuL/6+vHMCvDvHiU5dYUFIFqt6MM/SnpJzY X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a9e8a85-9d4a-480a-eb8e-08db6b848634 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:35:13.6135 (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: GHFNYSUdF/hqP5e3jIG3nvF3rwBE2sorlCNhwQEI3xtS39bY0R51NkH0Fb36UgVMwitG+x7cR4Z/YbpmBs228g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Extend Freescale eDMA driver bindings to support eDMA3 IP blocks in i.MX8QM and i.MX8QXP SoCs. In i.MX93, both eDMA3 and eDMA4 are now. Signed-off-by: Frank Li --- .../devicetree/bindings/dma/fsl,edma.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..14cea8a3f442 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -21,6 +21,10 @@ properties: - enum: - fsl,vf610-edma - fsl,imx7ulp-edma + - fsl,imx8qm-edma + - fsl,imx8qm-adma + - fsl,imx93-edma3 + - fsl,imx93-edma4 - items: - const: fsl,ls1028a-edma - const: fsl,vf610-edma @@ -101,6 +105,26 @@ allOf: reg: maxItems: 2 + - if: + properties: + compatible: + contains: + anyOf: + - const: fsl,imx8qm-edma + - const: fsl,imx8qm-adma + - const: fsl,imx93-edma3 + - const: fsl,imx93-edma4 + then: + properties: + reg: + maxItems: 1 + interrupts: + minItems: 1 + maxItems: 64 + interrupt-names: + minItems: 1 + maxItems: 64 + unevaluatedProperties: false examples: