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+i3dFCYLkPzMEf7CQ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8uqc1XNN+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");