From patchwork Sun Jun 18 18:09: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: 693871 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 47474EB64D7 for ; Sun, 18 Jun 2023 18:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjFRSKB (ORCPT ); Sun, 18 Jun 2023 14:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjFRSJ6 (ORCPT ); Sun, 18 Jun 2023 14:09:58 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2080.outbound.protection.outlook.com [40.107.105.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E0E12D; Sun, 18 Jun 2023 11:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwSNlKDDuxcbz5mMFgfhmBOC7BKxXZwaehG7OeDeGmqzGV2HBbwtaOSvHtkpwQI1J7SK2bTG0TaEUwFuFUphl4fi7JtfyEnlXyvnKosdlIJbYnzUx/X0Clycj3d4XG77YpYVCRPCbec5TzPoar5BPK4133ZK3ODD+ebHPN1prXOH+OubR06+dWtSR3fE7etMmpC/okhacQitp8Gi6Yqvp1lW6Fqs1ziprH0eIAdNWsfgsfZcxWt5IlnjXRs9cooxq0FJ8kShTyNyXBpR6CCZWns4tE/QOido5L7DnEHyuMdkhJz3q2++BAtGhbYXVi/46CciSeJ+H0Hu4+BUCyTrGQ== 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=kGKartRdaOyxRO9kHyRPYpeR1vnejEed94NA1lkawl52vDZoj98HtK/RHchSdLaBw9pN8sqcCpHHY7QRslC6cy+0R5qUTH02YvZuzcGgHcRXGRZieRLK45ZpH53XitAjhqLHZg9MYwG6OoRKvESGyJOcPpUBQdaS5J03Ul2cbvxXBCJW26BMlcqIYyWv7mAs04BFr1tS53vzGZBOeYuJRb/zgGPo5Ct0VDqVaidSxezgoVawmUVCZRFTRsSTzLw2lKFw2cr4RujGhPlbFCJLYSYEWfYRrL8cBxZWRt3CQz6bKuzVhRxUsyvd3Sdhjm9yWRj00jyR3hAOmaHzKC+oUA== 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=nuiEUNHt6Plj1WDJ5kg0dFOxEJEuO51ODIOdA/d4gP4xZLbTEaVz3EDPU4GXGTWLTaNPc+0DRHk/EF/yOZNw3eXPN1qc06eBCr1daE6mN3n9ctJzaGIOzxWZpqDGZk6OqAp10ytIA3uxtylFqjmto/y1JQqiDqXcZUjpnYDEk58= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:09:54 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:09:54 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Sun, 18 Jun 2023 14:09:16 -0400 Message-Id: <20230618180925.2350169-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c19964b-b85f-40e3-ba37-08db702737a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w6/pNK5HK0r2YmnlNRt9hnIY5FYLP8C1gTcKMXMfi6G1LIwP2gpwD9DNSWdFDyo3yUZzwl96yVB0U9IcyBrEVGPTwj5aFo5FKgyK7acS4puucDsi/x45qJ2ZW5amj+XwLPIIE8o08L2sNXedAbOoE7by6MM4O27Yyk1bqV4gv1wvVBRDyFg5mNgPUZJJ0iVFMp/ntxC+YaZADdvyKa2fntrNpqzww8KlTYia66TV23uCCTGeFqz7H4iIYQBC/VRtIYXqwYbTqf0Mj3+2NBcqdmcy8OJFCR9VP2W0D2kNn9zAgsn+3bVKKIeYkznvC6nEVxk1jyRWQIiMX1XL+io4RIzFqnvubUSlGUSBTN1ZKhhNvL6DI6lAu6IsX8UmnxjRba2eB+niSG4z+gPBiFtYqPdA21dhxLLl6pMqxCQQ1ajvEcGH9bjCwbk4r51FYBeTmEh43rqJBBSYebAXBDzhbNJpTleLXXqcCrCM1HI+AXqOkP8kuX9u3OfuEYV6sV6bRMNHHyP9lD9Bq3A+7Hre2pEj+rDphOiZ3H5J2YswTNdlbQUtK8yPCEm7omzXtG4vOexqYs0CCqkK0pKHjYlnjqLhEMe+YZCMww5QNfcTNxyn9fslIYzXlEYMYTH8N/uZ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(6666004)(52116002)(38100700002)(38350700002)(2616005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KMxAhKCJcWpJiE7vxo7X+kxuwd7bMC2c1fARQd/ddPN82taWXL49myme4yXEM2KVYki9oGdTNTtSbjkr0XMQzVL0Y4P6+vXlsHFGUI/vy9yJQWYHfz/B3fYnP5ge7cZ2wBM+GLaD8NF7ZfVqmBGOdAx5s+k7MhD1uAj1mO3FPj899JqUY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XVGZbaHhipmVcxgpI0lkOlxLEOB0y/Mh7pwfFpsr6MnLfO+WWPD47q0EbYilA7gC7hsFI9jpGGnlEqRkkW0jzFf+EN9/YX6g64Et1HoRlo2ub5Ifk6vyrewWxgSJLkKPag2ikmFHyk4y9GiEf8FjNP7sJOP7Yrmo+QlHsRLUrB1zr5RQUSmmWhBrxIlAxI4+u8m5ds+1rxntFvdewOMtuaDX9h3DIZhlBdNh9hxHR1fO7j3AEyWUFSJIZth7q+zoK9yYme6kZFAl5VfFA0323QrzYiZdeMjRs/0Y2BSuTB9yL4gAhk+0PKMkQ5AwsevGTxYQHezMU0MwilufBdpPMnx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c19964b-b85f-40e3-ba37-08db702737a0 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:09:54.3848 (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: jVi/6DCG21piGLsRhBN4ep2A5SoPTkhkZu97MF6ErRGqq9eZpsOo+JZWXJXWlpjn6QbXDuFGzxj99dGkgbPmCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 Sun Jun 18 18:09: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: 693870 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 48106C001B1 for ; Sun, 18 Jun 2023 18:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbjFRSKE (ORCPT ); Sun, 18 Jun 2023 14:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbjFRSKC (ORCPT ); Sun, 18 Jun 2023 14:10:02 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2072.outbound.protection.outlook.com [40.107.105.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90817121; Sun, 18 Jun 2023 11:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M5u0+Tcj5mCzxTF001dTas/zI/8POfv1MHqnsA+gbgfQxOMu7ZuSoh/5RaHHjgD4ESHTL+pZdbZq3xQNT+86sIoDWpV2rNF8A0RNzs323B3/b8sFPxtHUCWCBmvBPP2XKkvMT7Yf4XWuHvEFJ2ISlaTXeFUdfK3a2anyMJIvaegnxR7s4GjBVAlNVqlM/gcmZwSVjfQBIFm/ZJkm0op8wMI+1HnuN4bPEgMoKRLyGdtFZpDykFTN7M5VFJvusXHsoEl8fi0i7K4U0TP2tm/XHUqWfkgXPgRbMg/fdzqHaIUbkhrvX2iZX3EycFZvXr6KZW2fNUxxCyrheczCSxjVhA== 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=FzwsOlhkoYhwn4el6eYoG/xeEFFpO8mZ8ZN2fQSd1d5FtD2LwevKrkdzNcv7OtHNyhDkFg5F+O+s5i3LOgF6sUFeaEH3LaWENBe/N8sputpcUsS6v/ADc7XmcD/Iqbwjqdp9eER43hwVH0Av8IS6jTAi7H0vTBRw6Hcvu5oTPabenH2JzXK8q3uNQDOxVIJMCGA66oi5anWO0P+R2ze7PKACzunt+AZVGQU4WmRHyY3wABJtyzkMC0QC4dgAJEFygznh30J1TYM7v/uGcTS1PFno7Dz2W5m3LPFZI9ZNGAoA7Hdb8Qco/JECPzrX52nlDzX6M+arO8wu/5v2wEOy8A== 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=d1p2DWwIeeX3HsZRYSuenTZDjNdOr7PzrB3b7HHXthKEWnzH7FIPCpI3u3ZBKAdmp+y4kHA7nkpSOgF6md5G0VAPr2QdH9PBSpqrfrTCPGKfEXHfZA4rRz4S7HwYHdS/s2SK9xQ1EA+RfUu+JvLGpOewAkeJ4IfOXe72fsTapQs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:09:57 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:09:57 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 04/12] dmaengine: fsl-edma: Remove enum edma_version Date: Sun, 18 Jun 2023 14:09:17 -0400 Message-Id: <20230618180925.2350169-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 172087d1-cae4-4a57-c2bb-08db70273978 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5r/OJF/J4QgzYqtLNeyoulzOgg/Puxh98K+HdW2TqX+bPoWHDG9zBm8SoW7O+1cZ+pL30xJOZbIqvbVOYuZabbcQJ3md/dnDTNyFgAWHnN8oDEeYdD/LpjQaNVnU2gLH85AdXvf2MatvgUFAjKteplavz7nS/TSsQk3UTIVYO7LL2mbI4kxXLMhs4R1VlFkVEP/H1ssSYd8iVbHlpDG5eBNpjzqFaAo089yDdXW165CTN88FkSWmnxKdLiArHqRrXOD3acNoCFQRD4ranr6aHd8ZrvPxYn+NeBpMVw0meHMy8e+EDjpJzr65xwgSRofW00UJr5kInFt1VX7Fk5nQX4b63YncYf1UJxCTk5ik16tlZxOlmhzZPeYbmFsnmG6oLxL+TLpxt19ju5IuuFzyUoqeD8md4Pt69ZKXQspA3oRoF/bLRQjZdctpb5Z0lWVpXDlNvxYE1DWrBAsQLYgK6SMWrlo6mmnM4p0G1VphVeSxQFU6TJrKbj5BzOUxS23DX6ueVtZiQXFH42F4/JjSz9pMiK/toE8Qm5kHez4VgHUlhQ8EG/h+LWW+91rY7Nj7RuPTFzhIxNf3AdISYoKcOBd0jGTIV/xJzfi4+h72/bPoVVEe9Y2popAy8OGKg2vnzsb2YCX8wgtx1URTfaatXg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(6666004)(52116002)(38100700002)(38350700002)(2616005)(41300700001)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-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9rLljEiixlbsQr1nyHsUQ+glbRlpxLQ1qIV/Bl+CKlshEc3Fob6VJmaUCMP0KJev7/AE1CYKr+KYc8QeGV3fdj0a6ReRefNYHKwiF5SgMwf4H2HdgQIzIY5xzyAvLVPBu8S4t1PwsahMEJyghjS3BeXP7Adnk7bd6jF98PTGDHewFSC1MkkjMQdMSjrIBoE+i6kHq79kXUPC07RJmYqOdXjsD3jv46E7I5U7QRGcelox7DqHnNgH4HUoesYXgE1SFXL0g+tGXAPeh0kIWZ5h7YHb6DScJRlEBsv3bo0fvUdNx/fXrlwiAnhD5fva+oYnDSW1qODes7toIQbzUbj806Vzt99kS6k/RqlXXi9dRSFAzjd7wFfiVHvOtwBRUakFBnyt+2PKzjnzHkT/co8Jv6mahlj5tFzAkQePcWk7oO4BPJ1kt2hbe5jEXBs4Lr4BypNCjyMC2Sg4sEf5oc5w6RQKUgyXgYrVokM84OVvpkuWB6BKaiBSEsfTNaZf56gjTG6aP1CXmH8vPOS5KJVMe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 172087d1-cae4-4a57-c2bb-08db70273978 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:09:57.5020 (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: he+U1wIXMw7gPg5LeZ6B//+BzmSJphLFqcA2tC5CmVWHithzJslos7HngY9SzzOpv+rhU8B+bc9SEjpf7cZO7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 Sun Jun 18 18:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 693869 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 C9416EB64DA for ; Sun, 18 Jun 2023 18:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229557AbjFRSKV (ORCPT ); Sun, 18 Jun 2023 14:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjFRSKQ (ORCPT ); Sun, 18 Jun 2023 14:10:16 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A0AE74; Sun, 18 Jun 2023 11:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iC6UMsVYgSqELiMBBXID2iM55+4iwuPJYh5Tg4E0n5vXMtk6TKzz3e63YvBWlkifB7D/iX7FhPCtbortqs3JIed75KGxaORuQ0zgvUi6SwZuLxNZUG9ioZk+iQaWtmVSyr0Yp8T+zgvTIEoBkd+DelDsX2Vb9Ga2ANAprCHU9YUE5/Xo1ArFneaG/Ml6mpXiKODfqDs96aKGX7qvmBomilnKxrq1J4NZdzxolMhdLZi1okU8OCcQjqSY6tIsuW9x4Qab9xECfDiL6Wu6Kc9X5IcWoJRyamfy9u6M6gEZExBeURopdTJCjCn/mneci06MHU+vdtHkR9qScIhmcWJ9EA== 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=In55gcnisLkuUkfxV2zRufPnzkYw04amV3oN6xmgwoWjcVEwK3S2NUOxJWzIfoHz2Zm0aB8sF8FCuaCkkQtjXzctqQzhbc8y5VIPfd2BkpSPQSrR6u4rhx+ECxhv5NyQ/99xuuyfPK+bxYI9H/eelxRUvOMCmr1kPwf0eyvGa24WBUbVFyv+SORaKlHNAJH1XRBt/7Peql6tW5Iua6bfB0rWsyzhJDK7TeBSONZlZPr+zrWkIJSKgyqbLUY/Q4FehN+AveCGnXVFZnCU+j9tVaxjDmCY+K6RpU0CpjNv2vXrEZ4xoLZcXIXN3P5HfVgGpcMKXa36MUeRgfbZ46FkOA== 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=gu8nNF/ipnOeXsy9zP/8maUfMdukh76S56kPfB5K5OgotuUGXpfNk3VrCihEB2/ZWG+2SmJ6lLjEni2+0Gpr/uzRSdtIUVHZ3sVKtrLYOb36PKjZGNPuYB211xbg1mj0CTJ+cvq37O9PTkXI+sOqP68Irg7YB4PWvoIbp0KOTfA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:10:04 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:10:04 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Date: Sun, 18 Jun 2023 14:09:19 -0400 Message-Id: <20230618180925.2350169-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f9f1af9-f269-4d4b-4830-08db70273d3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fooUI8GjIWT881jiMJlAPdyUpRxBHw435xQwAs8sX+DICB71M9JyMwHueddnTPz+jJv7dSvT3gde9cUcE6OC1NHzC1cdV65t3ZCTgb1RhSU9d+TJ0un3COh4YCC/TLYTFVn+gpm05MjYjxfJ4GxM+LbpROKAC/kgKE/OYkSFo1WYwIHMewqGMnaE1HClok/DvYGsuBsGF61L7Qv9OA5CanoRtEUM5NFNKwyTecKm3WWQbLkOYVdwvYonyyrXyF/zR6xEQkSFFne+cJjBYTccxlkhgCkDuU6B465Soxh1pIRQs7oJDZ9UeGRbCdON0GZSq5MLZjkhmVPYWJxSyGroQ8oDc090ghCe9ZLZuxuUepMSvnNC8gESPDwQAh2fYzSV4fXwxXXCCtZFnN4oqV2C7Kr+4DtmEy46m37p5kXH0srQt/oe/ga8aQZjMma++KFm238UUE+anAvBz0fZozOP7mZXXHksDsLPsDV0gVfxRjarJZ0M8HOHfgqRHTMEdp2yMq9TsLWFzHcrxBossfkRa8OO8kqVH3xU50K72CuVV6asIp5A9PD4C0IFcJ3T/2+zpwyXcxu2nAvSFugNVdYYGW5c0aZoEgVlYhNmNR7Cv6MNoXDttc2sBD+L0ul79STz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(6666004)(52116002)(38100700002)(38350700002)(2616005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 014pLfs6v9eRK2lNU8wKIidNcpbGhwBGRY0RCCF5IQUoAEx9jky2pBEICc8KdZSPkrdXNqwPDMNq5CrT6U8zj0Yta6E+K4p8W3OQUz9xPLT2uzDZEO6yBVncbCcoKI01vQU/PTuzURZ3dw4YOHbYqy4945MBMYe0hnTZmxCMFv3VkyCPy7qHZiFLg1EBpeF8MxCDeICJzoleahJG0F0gVt+I4NmTOjid3gSNRMelSa4X4qgF7KN26SBfcrB6pgnMjcV/a/MPZ2p/eaSvd5JVzd26uaMQZsMCwJ5Dfd3+TSRcqxawc0enIBKbL6URLIE6LCwZ1rBR8v1hshk9z26xsl2C11UySdCr9DARCR43b46x/naAMHTZu4ObYqHVVncCgSju7U7lrNCidnaZsJjGw8v9gmcwa/ga1l+2Bcojfb4AE03P4Jivx2k7r+nww+qv1BqDjG1eNHk7/3wzBflToriQI5yM44BmZzzr/h2zj2jotntbUQIkk2qvlKno1LPOJV84RXHXq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SaAn+llMsCqSIon X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f9f1af9-f269-4d4b-4830-08db70273d3e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:10:03.8655 (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: ZKRPafkscm1IPxE3TU6iWolFTzJZ73jhol60Lluwv9z8iRchNSvoHPHwl3RnNFVETr72MMV5C9ftun3v/Wkupw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 Sun Jun 18 18:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 693868 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 142EEEB64DA for ; Sun, 18 Jun 2023 18:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjFRSLA (ORCPT ); Sun, 18 Jun 2023 14:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjFRSK7 (ORCPT ); Sun, 18 Jun 2023 14:10:59 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF4010DF; Sun, 18 Jun 2023 11:10:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZhAvLBidn4XZttG0U1BsHwS4W22OjXhWKKvhvkXm8SIn+6J6AyzRBMG9aq59G6/oxxYAYjuW+jBYeAW1e0wL5UWWUdLkHcEXUWHi9JqhjK+MAPRjZL55YFlqE0y7U5zaZMH8UBPxgVcZisGHMoZ9A/vBi6JkWSJGel/tSsMvQgCjonhy9pinv7F5OEAKAItF38nzwW9C+BHcNAFiR8j162U22JK6FCy0Qs8sGBjBNXR29nId5rNA6+E/2HYJodl5iwS0RPdbE4dV97ELzuPXXCQTapaMfJNWxlvaNUINB4u6mO8jcUBEUYMtIOtnM7eED7KE439Yk7Mpl0lVN4CDgQ== 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=ay0D4BZB6PxqhU1cIxX9dUnrWO5BzgA9wBRturWpQeYdIrfPRvDrmOxfdFSuvMnLi864dyWUcr19Kp+/3Hpp0qgXPpvdnXyV7Ag274eSn/1VaSfqbQ9HPkeU+Nxn1M2M70Vw3yfJdVOECQSKtQUQReht+LNAYvuV6FeZTMsL9MqAlaEO89jHRwYHMKskCzmJcphTt7+ZGbqbhw77S0AAHTrDgSZ89yM9BOPEpxww8z24IE/hHvXVTPqOFIEM15HwCVjt4fFlMvk3TPh9/N7PGpT1eBQmQC0QsK+U8YU2cYHV0EznXzagA1Nu3WK31GPX1HC7M++8z+JOhI1jGdvVOA== 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=prMEqIO6m0wa3rh8Crv3Z5ctdpzY/QElUmMFibIChv0rwzVLPOE7XzvGtsuIiwxS9cXGrrJaDf5y6zOjUNjJ1dPrQN5/37D0D6MWUcDMw7sP1nXCiqcgtZX+P/REngLbLvDrtwtEvyLNRfvacFB7c8GzntOvMxmysDkt0sLaNNY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:10:13 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:10:13 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Date: Sun, 18 Jun 2023 14:09:22 -0400 Message-Id: <20230618180925.2350169-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 00d1eb8f-ca9e-4110-f911-08db70274320 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GJz/XaybKhrU9/6C7hHqI5v9gaqgAmOt6GlTnsMo5Y5yiulCrN32g6EMdt31X8Ak8dfaIpgwThjFdjgh4611rhbBN/6hVbyE/XDKnALMfrLOkSn05FB517HeRHjQekS5ICVBIKSMXoA07EmaR5YvZcHpSZQZ0UbFEqd11i2/eEf2VgeZeGeKnKot9kLuNy6QYFurUWyA1P0dMKLfA9gCln/4GuUpNTew/e9JH2NEvkZltpxiEUaWK9rXFPkHosQmOYCH0lSPuJ5acnwhx3aJtV9yF06DVT5K21siEUqmYym4hIVuf3Qd9O1DWX+C1DUfGSFG896xQWGHj/h+/erANtivYHG4CBnSoSiyuWrDz60XTupBnc4Uit7+e9KNZsp0hLjuTSOedDPXOADsHQniqYADy8rzF+76qYaqCg2AHGAM0SPHZGb/bt2ZWs1qzKA5ErbOFgpsZbMdup5ifTEYja7lpCoJAHm2tk85U6+BSOXCLLXZz4YCOz5zblHgdxjbUtMUpAl0B73tOOi3aPduwCh+ynThZL3oISJpzuzlrqkSDW061vKN2TteRzcGcF+Iut4DDfLgStKnxv6bUbg7U9dIAzpoAHyzKjQC1s0piDO3QrEd09/k3PdIPku3twLP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(6666004)(52116002)(38100700002)(38350700002)(2616005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ckKbKidiS/b9WgjoSayzCOKmJMr18+5an8LkUQhfKGSvC+Eb0ySO6q4w6D3ajk23WuaToV+vMQ7GetCXokbswwbwPQrnd6pT7jwhSdF7ECACNFpA7UamoCXYtXsUCO+PrwEyc3taQgGU+Selgr3ubM9IOzbmN8Rsq/cZrznR7UEH3HXviNwUFRh3LvJ4CGvrc6qQ4V89ef1RFX1qGXWZB/8Bts0Cpo1lmc4JJ0+TkNVyzMIMKNrv11PYc3ys2VO3vWGxD+S3VUfMtxcZFKq/pPhI+Qub+VfNGuZ/aUiQfoXMF3Ifsq9EDRCnaH7koOMCOfoajo/I2CUa/qIxHykcw5Pg2YhHUf8pEjvsF0Kbgl9qdJNYbSK3suPrMSy/7aZf+8/lWa87U3fhkrEVyYc8iHzLlKfIFlYVKSyzI7brphH7nCHLT9Fgr0ubtBeIBY9RqpUqFrKsDM71y1Xkz7wqcyy5bTtdir/M+iRk2aHaxfyW+5w0NkRjpPjGqz8nvCDXfJY46W4uGZWZ6ESSHgwAS+SXyiTfN4ufllTbiL2P0PyCJMkUhq7GvPLm9XrjJ+pMzcSLch+L1t3C9umaMZN0xfTEAEe9Ajk4XOErg3EUfs0cZFrghHEQwlr2TvwSqkBFA4IXm4xAeDr1WfP3932wwjzfQ+vHX349/P0DvjjPDHh8VXL0rnchBMlqCzSIBElglw5CDKjQzTM++L0hPPApjjU7EPWZGie9F5LiSkLJlr1TkiQ1ap6HyfmVNuRgiOmpefHNHbTv2rRICmwPTHWqDDrar4psumZ+PmJGlV3Ru98zmb2id1Tmr1/IQKSQuLuM1t42t+RrhgM9Mgs95lWDu5MrsOkfCslf3+PZkj+xQeTfSNUQEbHvKVZ0hQtgqPbQ0nWEt3f/e7HMsxzyBtdCH4fk7wsmTWnpvIofw5EmAXQRf3mS5XnGiMbvptN2LyUndXY4mjmaT7M9vrYpIVXn+y3lQAREU5ZnlvJdLjXb6F7w6PDf0vddQad/oEAwmV2E3kgeDDJQVb9Yc1vhphadzNKOIa4pbTZC4LmIgR9LnEUAasiFIC6H222fZtoaVpXqL379b5qEel3PsOjztf+WziVRaMR4/SZnnLjVy9BwHHK8AKRUbGReZ9cqmi3JZ+MCzW/tT54zRRV4x85MWTwLyy9yB5Va9iMBG0NpIFYIV6m2K83l8Q63OmfzHnAjAL+tvP22/ZtZfmGNchbEEZfbz4uPIXWtsC9lOboRog/avkUysImwIXD7PVEW6hsS4NnAxfGhVIEhS7Q/f4RAkq4zHDRH0A4FBmyL6dKNRqml5MpoLDPcO9yHt1WpQvIGpe+yLKU3mz9SMmaDWyXDm+2mh6nRBJbVqwvbDCRnJAmidFjXV7ANcMRvNpNUSr4MVo//Y929wRvVnfLT5GZtkfEjuDa3snE1Gb7B98qDwmz3l7DRkCE7hhOVka+EY50q7oLoSRdIG3tezLowr3fYHeJ7ojv/36FkVasRbxXylmbApE7YkW9u3O6AfuOsQacdjXMRaRIrREp5JA+C0jl0kDmcUA3t9Klg2IxK8V81yBCGYs4bH7YiREJJqmMelOGIrDXe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00d1eb8f-ca9e-4110-f911-08db70274320 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:10:13.7205 (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: G0RLTngDnl2kpxclDx/HxZmc7awQ3Yiu4iJySkzvu6FpJGaM24EL37LA241HaxMkkF0W/YYVq3HggloPSsUmVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 Sun Jun 18 18:09:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 693867 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 2AB8FEB64D7 for ; Sun, 18 Jun 2023 18:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbjFRSLe (ORCPT ); Sun, 18 Jun 2023 14:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjFRSLd (ORCPT ); Sun, 18 Jun 2023 14:11:33 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95179E78; Sun, 18 Jun 2023 11:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cd62V9JhQyTrPkOIIJmYo7n4/cfbyA0fZzQE5OvobgE9EPWgtOVqrtmUl7HVAQN9Dxgm5gZw1/rL0E5MZgSSLRiQsamOw+q8LSEX78WtfZaMWeptGlQQrPlH6xQDk+uYMbdm2qseSPPCpzcIBVm9nnl9AAa8+Xh5SJIw8OuXfGYp7oXsGuM++ynpbzFTJGuznHLPNmI2EhakIGtV8pQdg4n7vyAyRjORqzCUzBpaMUKhTbdI0nEoBwm2UsGBNq6aCIN56n+5UncOZrj11rt1EDhrHgQyrdSldHvknlCnAjf4bX/LErgQDu/fBxRJ37blJ2Uqf8UEaCnB4gzAzDBI8A== 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=dV7R0tRu3LHS0WHVMLWiu869SApCvbrn1UA1dVkZJ6Am79QT2/lDVBOldyfKqdCFx/tXQCiK75PHkIomPm2nH+u8ZFjlReI2Jg9gELAx829M2u7Q83Es904mvlXirodXMWIEeCDmM79g2ko0ujLRwHWp3a2VWJ+u8U8pC9CdV3KNL3TA8gkQGn21OvDEIyMb/pNB7yx9VO8mK6ItRC4f4t6ebBFENwklAzFOt8KfOMSQALYZcgP19TYHFMT4tNDyf7AEjkcBS9BaesZ8kw0yo/jakot9WLsl/wzSC8w8trwkWLdwb5CY+Xffini4U+A/QStEXAYeaW0g0iXpBvpBbg== 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=Wv318naIoLS4vp9odYatz5HgTF3NUNElhVgH91PT3xxJQblcUHhAl/tyxy7PD7CMZWb0p67uOAtUUCORWH072TZOq1MDkC8iAA6rPxGKJNRVe85Iv8BZv3bDopIRJkCsdpQpWHy2unJkCDERekVwrhcJsq3+AExsViwOKopc5kU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:10:16 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:10:16 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Date: Sun, 18 Jun 2023 14:09:23 -0400 Message-Id: <20230618180925.2350169-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 27f8e515-d595-42ac-8aaa-08db70274502 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a1YLcoNcoXKDafYgOnCE/NYPvxn3as4OqabfIfT5UHWCTJesI8V3SEwUpEQgPuOqXfKzLUtwKNU47b0FWPHQo4G5dnNCJDaz8dSTb5yV9PZ5/jFZVNmc/5Li7vkHOShG3S+bBIe9oru6PSWuuxina/VVPJqLI+1nxX+jiyekoqo/VQg9SyJ4ZY1TNi18iaB/Tuc+pBr/1ZM5O+wSdO1A/Hrerd5ZSl4je7+zOJjSweeTzjueWC5YCA+KeGrM/+0Xf66Qsj83j3VgzT/jfcnpSfFGOmyoIWCiXis9yhn4Uw+/nM6NzVWcM4pSB/h3N6PoPeSD/Y4kwpVT5eMHjYruzL1vMMTnn6A1+cPeEPzPml3XGtSc6m4uPc4sFBI2fUUUQME1fR4mCysTFlklB8mxp5/D5p7Hwjkaftgs+G6FE91R4tVsLYwId9u9V63EniaDd9zbP7LCeMAx4eWCKczvbNtutGa71Ue4ugN/03Dfuwu2LhpWjxUKGb1SphJcjoptouKMUzGhxRLYjHtZ26jC+8tfWhdYQT05o/iN4y1zsqmzxookVM/G4/K//E5Ir40YSaI3p9wV7qDS5u/DVBjwLiJ1AoEBfJAFEra0ykIbpR0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(966005)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(6666004)(52116002)(38100700002)(38350700002)(2616005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QCdgCmxe1kQRoFt5iecJgKbPBtz9WsybCYqP+E+p5zO+2Ps3+broHXJPH5KFSofUAvjYcU4goD2x8249QCIYnIC46H1cvdjVKZef5WQlCkBPrJDufJHE7G168x+56SFyyGbON9HgZ5UdrCyiAqdXhQ+j9bc1JYpGckJJ8vFM1ypS+sVJc0tXiW+AL2wbuDudE1jnNQSTtaVI2BD1mmaxGfWawsGjSb2z1/Q/r1D877fDC6bNwKgNLjU9ncQzcIdHqb/DkMAKN7Zfums4sPloNCNarYI1rv+PVmGEXrbv3oXt93I+u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s57Q+5EtTNFuyKzgmYi3F/bA5LBphpq5Qbi920K3e9GTtRp27erTSkLzMfQvNPAop891X8ZzLSM57BgC/f26H5rEbzXDwSFFVBNndM88i7M6cGMeqYxq/olMP23JQyTdgj/QzLjesF4b2OepJ3w3dOChvzXH39pBqLXbTii26WdYe9e1hv/u+c99+HYMMIx0HihcG++5HCBw/7qlWYUYV4jXLM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27f8e515-d595-42ac-8aaa-08db70274502 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:10:16.8479 (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: kRHo9XqiiGJukuuhtxlkUQ0yR/Xia+x+QgmKUTGQQRYvvv/yFC4VSivEa71Rb+kEndqH2MPkIGt5rZHaL2UKEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 Sun Jun 18 18:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 693866 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 010D0EB64D8 for ; Sun, 18 Jun 2023 18:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjFRSMS (ORCPT ); Sun, 18 Jun 2023 14:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjFRSMQ (ORCPT ); Sun, 18 Jun 2023 14:12:16 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B04FDE64; Sun, 18 Jun 2023 11:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JdH0fGA6IXGemucvNo3U/LDd4S7wKQbgDkV4Aoid3HrpL0kIEkub10LYOTXw26BUKOGGOOYKLefz9NrY1rtnCNESx6jDVc046Z2x8mujt1vtIbLZOw3bhsrmgotjrPhuHdB/bjh8XFC86SNn2aFXulUXhSohnFwj2MIVHyNop83JSY1urPUKxfS7kpmj5+kPdtCGDUvgMvzRiUcGRqBjjZVfDZ/XeNisnkVnlc3m53Hy5i3yWQbRfGLLLy8zi9NJp8MeefyFh2hwtzvgh84C4sqjEIQubkXUKKpZ4lHF3TNhAzVdWDwwhXBaQOKJKLgCC0UshGyUkkMXNEBxlI1PEA== 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=X1aMJzWiiDVx+EzvQ6gIRjNjd3cakxN2zCgL6Y+LfCo=; b=TUaeeV3UlA5tqCmDC2D7QK2zYhK7VSK6YIAOUMta/LQDzKB4wPbaPgPi2OAKhJOPIxJ5BuKsaQyvAVwAtgH48bsUoFQv3Crc0dUWB65SFKhdbJ0Yb0BDOWaTEnXtmoWfrcme5Gj+Vl3r6jjT9mlz8+QQA0MWK7aSXCM5qZJDwpGHiR2Tp/LCvlewXh71DI9UTL+h5yCJYaeFbUIOsLYQYWcVT9wwys/+TcW//7ZvK64OOizzYP9F9rgYU8RzMp0HyPThtunIiSvX0a3A+ou/9zBUAZMNMH1HHDjeNMn1Ajfrk+ibTErX3EiBtD7Uz4ZyWVtFugmcn3Mt5FVxA0ShxQ== 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=X1aMJzWiiDVx+EzvQ6gIRjNjd3cakxN2zCgL6Y+LfCo=; b=S2HlA6JgAcZTunpHmnUUBCKlDVfnecfwfPWX9EX/essaLUHO+QqVTCkmc9OcOGcKlT+WNT3oJrjbi8BFIR1z1wEsrJLhg4yOPG/RoJsudGry5ZCxzKkLw6Onar4rZOo/WPGVaw1XL2Nw/t4tfHWTlSxyo4af8Y/0A4XLdsmsZ+4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB8PR04MB7019.eurprd04.prod.outlook.com (2603:10a6:10:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Sun, 18 Jun 2023 18:10:23 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::4a2a:262e:415f:e41c%7]) with mapi id 15.20.6500.031; Sun, 18 Jun 2023 18:10:23 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH v8 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Date: Sun, 18 Jun 2023 14:09:25 -0400 Message-Id: <20230618180925.2350169-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230618180925.2350169-1-Frank.Li@nxp.com> References: <20230618180925.2350169-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0048.namprd03.prod.outlook.com (2603:10b6:a03:33e::23) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB8PR04MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c5a7828-747d-46d5-5e23-08db702748d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vqaiUnzQwuw1fZXIoPtJ8HhCXR3XigAG0H6r1ibMREaNdqBDW/wvFrJx+q0qwKeczdUKfTUWS4r/iEQ62NXey7eJ7WEi0XLodafaZHKvpIcaNDplXKdXAPA6lTSyusHpiyEnnLuipOxLGOjgE8mNo2FzVXjEcLTfverFgo9WvJbdNHTkHwP0Ac8mMx5a9gAA5R2sDltFAbbOIKEaIHN72LaBEJnSZTW0kKADMFeVT2xfZPblvm9SdGwZtGvqtqXWGQ74qNJ1gdQeJjrezAvCn3LQiI+aIv4wI+2PntUz/l/vZbISAHPsumUFBhnH3BupBq4I2/xVGJMNEo4Llq+5ji7SRw444ui+7nM5q3X1fqfs48Afsz5hrx4k36p0n8IFaVLwYUmYx8nzcJ0x8tkZuU1n2NDkh8Pvy+W4ffnjfBgouUZu6nW5PSx6y6WpVUcM1Y5PtekipLTciitgrKLAUm9pSM5zQRUFmZyCd3itCa9dW1MjD/hYXqZdirEMhI1AvqTV8XuVvn0YHLJ/nMboh6whKaWVXXlc+ZnAs/5Zpmj51ErFGFd91xhbtRI2+mf/azMFEpcZQf8GTQNBf8mMxMc33nIxdkiDm+CImEyHog964jeCK+D8Eq674YC6v+kS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(316002)(4326008)(478600001)(66476007)(37006003)(66556008)(86362001)(36756003)(186003)(6506007)(1076003)(83380400001)(26005)(6512007)(6486002)(34206002)(8676002)(8936002)(5660300002)(2906002)(52116002)(38100700002)(38350700002)(2616005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +HL+LNkXOzq9L7PyOpgMWECbY1zJWDMSrKC5vcMS7f7TLpD1Nv6a9N4FDNg7Z1/5u3jq9Jgzim0e0U2SvHKNMoB0puV06z20zanh6SEsin7MIk1chB/xSkNHa2qhwHeZ9JlsXjoCbRY7v17916FpFSe4fj3h+5czFjlrdcy9xeXdqjXFej8whARXcnkzQvA4OyzlyOlSKs4ODi/cijsOHI5HUIObKCBuX6+aOsFNtXjfyl7thKND9ZNuTLmIRKetx8PFU4uObxRNp32LRyY7QXXJIB49IK+//tKqlxKktOTe3wwuXIjPX+XPz37J+fF+I9N/JxDJojsnnYsfSwFVT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z6KT69nv/jtNP8U8opT067rklFNoj0M4uxor2FU0UnyFcRL4lgEK01J/+HP8vn551JfEnpc7iB57i5L5SDAiRoS/tHZzfYLvVZu3P2/RQIBJnKUbaSK5h3/QyWXECPRsSjWmd6osU7TI71RECMRw0R89kyniSM4+I8S16+4pT570qF2VJsgMVILHtvN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c5a7828-747d-46d5-5e23-08db702748d6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2023 18:10:23.2475 (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: tcYl2+FxC05hmxEPPG5yCUdVhyy0L0BJjTSNjuoi2ATViLZKKvLWkHcALGFgM9Qt6p2QAf9x7PPmFCzeg5RtiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7019 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 | 106 ++++++++++++++++-- 1 file changed, 99 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 5fd8fc604261..437db0c62339 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -21,32 +21,41 @@ properties: - enum: - fsl,vf610-edma - fsl,imx7ulp-edma + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 - items: - const: fsl,ls1028a-edma - const: fsl,vf610-edma reg: - minItems: 2 + minItems: 1 maxItems: 3 interrupts: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 interrupt-names: - minItems: 2 - maxItems: 17 + minItems: 1 + maxItems: 64 "#dma-cells": - const: 2 + enum: + - 2 + - 3 dma-channels: - const: 32 + minItems: 1 + maxItems: 64 clocks: + minItems: 1 maxItems: 2 clock-names: + minItems: 1 maxItems: 2 big-endian: @@ -65,6 +74,29 @@ required: allOf: - $ref: dma-controller.yaml# + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8qm-adma + - fsl,imx8qm-edma + - fsl,imx93-edma3 + - fsl,imx93-edma4 + then: + properties: + "#dma-cells": + const: 3 + # It is not necessary to write the interrupt name for each channel. + # instead, you can simply maintain the sequential IRQ numbers as + # defined for the DMA channels. + interrupt-names: false + clock-names: + items: + - const: dma + clocks: + maxItems: 1 + - if: properties: compatible: @@ -72,18 +104,26 @@ allOf: const: fsl,vf610-edma then: properties: + clocks: + minItems: 2 clock-names: items: - const: dmamux0 - const: dmamux1 interrupts: + minItems: 2 maxItems: 2 interrupt-names: items: - const: edma-tx - const: edma-err reg: + minItems: 2 maxItems: 3 + "#dma-cells": + const: 2 + dma-channels: + const: 32 - if: properties: @@ -92,14 +132,22 @@ allOf: const: fsl,imx7ulp-edma then: properties: + clock: + minItems: 2 clock-names: items: - const: dma - const: dmamux0 interrupts: + minItems: 2 maxItems: 17 reg: + minItems: 2 maxItems: 2 + "#dma-cells": + const: 2 + dma-channels: + const: 32 unevaluatedProperties: false @@ -153,3 +201,47 @@ examples: clock-names = "dma", "dmamux0"; clocks = <&pcc2 IMX7ULP_CLK_DMA1>, <&pcc2 IMX7ULP_CLK_DMA_MUX1>; }; + + - | + #include + #include + + dma-controller@44000000 { + compatible = "fsl,imx93-edma3"; + reg = <0x44000000 0x200000>; + #dma-cells = <3>; + dma-channels = <31>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + clocks = <&clk IMX93_CLK_EDMA1_GATE>; + clock-names = "dma"; + };