From patchwork Mon Aug 21 16:16: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: 13359628 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 F171DEE49AB for ; Mon, 21 Aug 2023 16:16:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236514AbjHUQQv (ORCPT ); Mon, 21 Aug 2023 12:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236503AbjHUQQt (ORCPT ); Mon, 21 Aug 2023 12:16:49 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2083.outbound.protection.outlook.com [40.107.7.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9DE100; Mon, 21 Aug 2023 09:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTnWj89kmbQZOmrnxySXe4XGNZ332xeP63ZV24lEan4Tf9Xnmy5D2C4EQ/P0V2xBW62fzFaRA5R5mmWKeBOGJzOk/RBY0iM3RxhXxPV2DJYjvdFap6WdqwlsKWTkWGC6D3rRRI0ibDbrHGVMClmUnahB2AmA3jmMWCWNdIJIk72Wi0KI1odOMkH95La4hHW8K1Yd+MKMcCNG6gKO5eGKqh50m5cG3tZ4TKCP1NNzA3lu1ceQ+C4i5vU9p9/7lr1sajgIUJFL7bK77jLg+gATNO05ECp1QWtDcyK8RMwbxUpFpztSPS2cy1/Gbnexc7oN3CbWZYcXgIDR0MzeLMTBdA== 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=yRPIuDooRTbTaTypXEGNysaiq5m1mMvXL38u7iVQGcc=; b=TMv0pcifkfx+K1tgqlkDF22ouIS/Fe0Iv/WIJt/yNabL6Meu0p9qYbEoJtMSxKhresUVebYPTofYqGkWWf2eZ9u9imEW8oDK2vywkKe1IdtTRMAWwRPPq09CrtkjXQgWh5tdsMeKsuvwEjKGumiD8khOFUJznO8uIkTK0gqZfaupYb2OUsrcwWav21TloHTmc075ZmdkedHcmM9g/TU7IxRvqbTfXQs5EIViVNk5ifrXyJuIMP7V41fIITD31HhhtFj0rjUIblIrE35+dVkV/0k9x7vCT0mfi4INcWBl7aF/yDV2aVN5WAaGYcHtjQJTX+DPmBsQXTLAxYzmX2+bdg== 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=yRPIuDooRTbTaTypXEGNysaiq5m1mMvXL38u7iVQGcc=; b=KKMeCrBKsVpPLrVKT+dZD/bXMAAnzcIiKxFD/hG22z5BFm3nJXGtJ2koaxf4dZAiYSodzv9p6b96jsGmLb1X8h04grKmEi6deuyjg7f4yEMRilLZK438qMnyZ4zaqA7+hJPCdDsLCsFbOIZbVrs+XzQjoeC+Nc6UV8KBqAimNms= 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 AS5PR04MB10042.eurprd04.prod.outlook.com (2603:10a6:20b:67e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 16:16:45 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8%3]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 16:16:45 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v11 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Date: Mon, 21 Aug 2023 12:16:08 -0400 Message-Id: <20230821161617.2142561-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821161617.2142561-1-Frank.Li@nxp.com> References: <20230821161617.2142561-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR05CA0053.namprd05.prod.outlook.com (2603:10b6:a03:74::30) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10042:EE_ X-MS-Office365-Filtering-Correlation-Id: be4f0770-f8fa-4580-a35a-08dba2620369 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pfEztdYF/+YB8FehgRQAAR7HCwBbOgtZiNp51RhMHGTq420psr0D+PBUkXU1e3PJbIsLAYBfuhvyZeNPz3SRoGS6uXd1HfXX4XWVeVQiSdopXM06dTOSBLMhZdr4HaOGQwQWha0Rlip04z18EwTE0XAzcsGNNt5qh2oShStAZZBekz+L0yn+yxlBos7zuUSNaxBwd3TJOF3HUnb3HgzCQH01Op8zGSfN87NI2aGoC/wNqO9oLEpUXGIpSEvdGD476WjZw9Enkf98kQUE5KDgPoG22gRmcqr8I9F48/zEeHoktQPuYAZ/Cd+u4xzL26vzeedm5J9TB1qdo93ZTyIH44Mk2xZN1KwF9J1mjChw7GiSUw1Kcn8O9xmevZr8Pbm1PPpJyoYxkxstY0zlaQZ8erjMTCuhyO1nkGI4pj09tcOr9Aqk/MWNQnc2LjKnIbp24Vtx0AkwspVuue8YpeaTitaRzOaxykTtwDhhitBmIvoTw94wN0JcDRohp9jZJegwnEr41kmceKrQ/dBX9GvZLSDIc62IU3YKmDgqPfDSDxqMxKf/URkV+0nGCOTg1JZ00q3tjNo9go/8InRoSvpKCzV8SABreQEv/hcLpMf0ALEHhP1rst/Y5kFkC7KluJG0 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:(13230031)(366004)(39860400002)(346002)(396003)(136003)(376002)(451199024)(1800799009)(186009)(2906002)(52116002)(38350700002)(38100700002)(6486002)(6506007)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(6512007)(66946007)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QePSRMsB0ZtMR/G4CFmbm2xzl3JZ8L6lwGPr88ynRbu3V2Mr9Ukp4g3o5TUjyOfZNCta6NA/K9X3YQZyGoO0d8RhqK3SUnkFbMm6IjsQbnXZLEl+FKU32fWLjlgdVGmIyzeGJ24Ge//rQAf2um3ZXgGamqmHWzkKOoH1+gm0l1/KyhMMVvS4BWGw/VaU7TS9mGHGbG6UQiOFjKXtGyhKqTF9WDvB9++e6XW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x0XOW/kFboDRx9tjaIaNo4uY0avaX6FFXVybBrVIj+WKjqwXCjamAhbhGUyrF0cFtHK85Ztpc9E9nYBy7c0SYL9pxE7lkgikGTOvsGGI2W0ChRakkakroqxDGwiOQDAAUx3HbfHFbPgtStY3dUaY9mpVwgNYHITpwcqTAr+8Fy194NsGXbDOO3UU815MjWyRfvl8L99JpV5WLTIP8h0C2VZcRmQaHeuOmqHufETWBhddqvFCwlkZFrG49qzNAZEyeuVYUWwBhuaE56k= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: be4f0770-f8fa-4580-a35a-08dba2620369 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 16:16:45.2296 (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: sBnGPYvQjzWVthdhn2+1IUmctdDjMzViyIog5hq1LfqbQBy67XngTitUrhxXaFasRd5DCJFp7EfBp2TBNBefQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10042 Precedence: bulk List-ID: X-Mailing-List: dmaengine@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 89b0d09c13ff..2549a727913f 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 8c9ee9fc7240..a318ad6e40c2 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -244,14 +244,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, }; @@ -303,7 +303,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");