From patchwork Wed Mar 9 21:11:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775609 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 4001FC433EF for ; Wed, 9 Mar 2022 21:12:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232562AbiCIVNh (ORCPT ); Wed, 9 Mar 2022 16:13:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236334AbiCIVNg (ORCPT ); Wed, 9 Mar 2022 16:13:36 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22FF92F3; Wed, 9 Mar 2022 13:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuRc6Z5X+UfTs7HxYDF+n07U6elCPg7b76/iHrGmfcS9q9zRZ7ltbUTOu/MZ5tjnai7tCXln08Yl3gCtXXY6pfrleA8ldtIWP2yFwrKV8VVzpmg+2BSyumHCr4slp+HpGxWDJdIpYR5zrV0WvVdwyVEqXXNYZ2uHjF5IDYE7PUUZ0ZIYL/t4X766Ap0ktd6XC6BeMM3U+lYiDaO2TZ4n5OzpdpK0BZtJawURc/vvtBoHHBSo0+HWiiRGd1eAv+UlID1l91MPYi9T44cEO4Hb6617NyCI7v/51rmG0s7TZ0AsLOlOQmxh+Jv4TjPrwC73DTevblxrsJWpttu68xz0qg== 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=X4C12opOJyCvPQRa+M4nwmQn7NR7/Y/bRzT+SCYkdD0=; b=oEHNcMVJTyGvvbKLp4CqPeIE7xd+Xk0WceA9jyxAD3e4PgLU6Oi7GcHpEWckJF9ZGjtco8goxb9Hb4V3fY87ZDPn8gsMB5JQ9CMHN7db5zksdoAOtDmymc4bVIiiesGcfunoqKhIVQ5NiuxQTYXRXZ5JhJ0dQm+8G7VZPqb8np6aLdWRUTVOPPz6g++NhlZp4P1SbFy/iB/Yy0y67u7XHTp+c/Zqc93sKe+sqh01wQnetWpIU2Ya61x1MMzJ6rzLBlbsNk/RH+P8cXPsbLI81jNKhZLF0O0gLuCxKc45uJeXRTB5Zj8oPMbKtkVVSnCYTHjoVTzJhnWzZRz8wOEqYw== 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=X4C12opOJyCvPQRa+M4nwmQn7NR7/Y/bRzT+SCYkdD0=; b=SHwi3cAOTAaC5FHa7s0vCa/jv9/B/dG4wfu3a6tptxjAzp4ISG3ITghCkPAIJwM0EumAyh4Q5A1Ml80w0FZNg3sexy/wUTbSEJV5Rb6+gwVpJ3vWN0rUMxXpbe2rjZVo75ud8l5bzgTh9NhI4Yshw1Y9cWJ1tKdwZa9twkPCzMs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:31 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:31 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 1/8] dmaengine: dw-edma: Detach the private data and chip info structures Date: Wed, 9 Mar 2022 15:11:57 -0600 Message-Id: <20220309211204.26050-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89aa71ff-2144-46ab-9f4d-08da0211861c X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wCaVIYAf2UBubPOEP60vZ/OQeiwY7nAtYLBSRIW3ERDWa4quYzKV1IlAs3Rv1kLfVPfo7sHlQNHx/IlPnHNaeAz0w7ivUmCUGK3ArYShWODR8LQsZmjRp1gKuHmEN5IVdcXH+CEPG78rIdQ5pnGpX4vbiLIIyzPZe3psqSKsQR8i8l3f2vJHzE1HB0OnK+nOz0CbWFVlSCcDVndI84RfZ+ScLddgV9J4Mcm4rlAzDqfMLN/0MWCCFFuZ3iOHPbO3GcDhKSzfGDW8aj15NLgwxByspIwZdiW6bPR6cN/ZaCkK+S91G/oN0U6/xgtx8Ezvl2n2dn6dvvmVSjywdGKu2DKADbTsnQ4ouep3Uznpj6RSUkfsGY7rO4b5QpGyTzZC2cVqGZMt3hCI8Crz3FfPX3slTURLHBq/XI3n58bReqFfNGG27oGz+L2RrM6Rhh2U39+aBbfgsVvLw7WY1BZUBNL+1INGhhLHmCgWVIhT6X5x7XK4jVP59GUJhdt0izO40ln9GVlC5O8OsEfiNvdN8uBVr6BOJUpmbx6DAXm1fPWWpf3AamRz2RDD8p9t/LXTrrFQKFxqlrzmuTweu8XVg0MwXZbhGdY7eXn+sxNV5Ow4/Ag6qZ8VunQmrx61VWa9eSrGhmEAN+DEgRQP4oT1p8QpknxeS4RAKA/nYRzueFyb+4NJctCBLHdAKpOsQjLCCcV3JlKUuXa7Z0VTpyH9Vg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(30864003)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e9gDfCPRbIujOXJbWHWGQS/69iZ48S/axCJdrMViJK8p7DwIecHwcamanre5ZUFMh0GzbAfwGwXr73/J+ChQMgGZgbAl/+UUAvRm5leoJmDtVHjOU0s3hPjMJSOFChUQhkTX1zD50tFLg2mPD3EO4hrm3dw2J1O1Zz5xL+qlJhgZ8Z3s3JMGEwkhFv76I88xiDhE+uClTOpVszIW/OqRhNdaF8QGsTMkSwIUKJCCrP2mnpuBoGbDg12ktAUWZRnCBzXCFEEM/u0nf3xT3pHsros0QgQJ3ED+jA9IRjwjWbnbLddjsYJ7oXqEqxlbGj1RfbrdbchFxk12jSJCbK3xhnyem1yFa8MzFSrTAEINeeZDUcmOfQ2FnMOlZ2yXAxY9kVNTbIEWQHZKb+bciDln38J/6kEJNzu5kbel4+6g+E0yQ2e6s6sf8u9zaw7Cc3NoWjz18hmereRo8ZwX2capa+Q4W05xXWJEtMTarFwbNsLW2dYIcdLhmizvrxeFo9RB1GVXdlhOdUPdrio9bxl7mswZ22FQ+y68BW7eRC6BNZTmnPS4++EIdw5Pb3eeoHT6pabdKrb4bhYpudDfjg3QZPMlFpoVIIoUiFLf5iubJewxHEJlqr86pHakGAHN69+uPiFdUHSQOo0iI273sh8XsQlMssHkjrMcjbW65Tb6nhsiV4RrUnUAS03GFR70ZE8bYsTlZD+P/dLaf5jZMacYUHs+5gwSa4jz3HPjPf0srlccey4J6VSp2Sxrr49Ufr5VcFJG2FG8OsTqpC9pQiLrjzPfyterTie0VQIgbOx17ugKUU5iUG65HsaJwtghMfR4Ffnqh2jiuriaWZfr5vITeO5unSEIymsq0izjiS/IyTLSY84n/6Tf5GkszOXrPkr0gO9KE4qcYkt0BZ8VDLDZ+a4aQB26n13KSRjmxjSvEEqMUHpPXX8yJADo1eopQWXVq3Rvt3RIsHa2d391j6F+qW7mx1CCTSxGEo5ysCgvg2hqyeHqU7unxQy8UkzLfVBdCjv9h9NR6wqLhCxdKvUP0hAiasvTScD/XV6QnDoJVf1zexst4iZvHeXfJYGNU/kdblKBPPo+3snThVfNMl4+hcpa/AvNQvnGoLH4a9APgpYHgBWXF8zMRhRSO6mGtEwKmR5CHDLQDaQoPlsemc3OAHhKB/dp+pGOMNco76uoXDSeOb44uHGhZOJrc6LBH1I+MJFnaxaaDN0P1TBZo3LVns5jQ0OvNvluiTV3fEx63Il+4F9hOdEdvmrPOfuhk6UcQnpV1jiTSsa4QqgijVwAJLeAiIXvRJku8fq85caHhVnLB7YNLZiQ97qLtkNF5CC4psr94GGgz1gQLQNgVoVEyViQz/QE49KDYa1otQoSdYMs0SHOPMECHILG5INZ1BhnBt9FcRMVqJ+GjVSVIEcb5wtliIONpWamceo/PXBxyGNS7Pj3vuvKugrW0tX5h4J6jHm2WKiqX34K1jkke/gmVRCn94HBjKdGQE4LM7MlL+qeKKW6LbmVOx9PJKy3hkrlIQv6hnhv55y90jG2eUYJo2wuF6XXvuPodn73CNwRYSbymtfA529Ey8MIgY4ZqBgEbel4wqQglllMGGrafQl0Jqw5FIyvjLL9YHAoQoIFV8Y= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89aa71ff-2144-46ab-9f4d-08da0211861c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:31.7193 (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: qofPQKtBPk+CM/XXyZ33bwXI87wCLz/Cel4APPlE2RntG+uoqKFba3sZN2mhms5E32rYHFTsBnm8v4nF9/wBcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org "struct dw_edma_chip" contains an internal structure "struct dw_edma" that is used by the eDMA core internally. This structure should not be touched by the eDMA controller drivers themselves. But currently, the eDMA controller drivers like "dw-edma-pci" allocates and populates this internal structure then passes it on to eDMA core. The eDMA core further populates the structure and uses it. This is wrong! Hence, move all the "struct dw_edma" specifics from controller drivers to the eDMA core. Signed-off-by: Frank Li --- Change from v3 to v4 - Accept most suggestions of Serge Semin Change from v2 to v3 - none Change from v1 to v2 - rework commit message - remove duplicate field in struct dw_edma drivers/dma/dw-edma/dw-edma-core.c | 81 +++++++++++++---------- drivers/dma/dw-edma/dw-edma-core.h | 32 +-------- drivers/dma/dw-edma/dw-edma-pcie.c | 83 ++++++++++-------------- drivers/dma/dw-edma/dw-edma-v0-core.c | 24 +++---- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 10 +-- include/linux/dma/edma.h | 44 +++++++++++++ 6 files changed, 144 insertions(+), 130 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 53289927dd0d6..1abf41d49f75b 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -65,7 +65,7 @@ static struct dw_edma_burst *dw_edma_alloc_burst(struct dw_edma_chunk *chunk) static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) { struct dw_edma_chan *chan = desc->chan; - struct dw_edma *dw = chan->chip->dw; + struct dw_edma_chip *chip = chan->dw->chip; struct dw_edma_chunk *chunk; chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT); @@ -82,11 +82,11 @@ static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) */ chunk->cb = !(desc->chunks_alloc % 2); if (chan->dir == EDMA_DIR_WRITE) { - chunk->ll_region.paddr = dw->ll_region_wr[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_wr[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_wr[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_wr[chan->id].vaddr; } else { - chunk->ll_region.paddr = dw->ll_region_rd[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_rd[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_rd[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_rd[chan->id].vaddr; } if (desc->chunk) { @@ -664,7 +664,7 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan) if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->chip->dev); + pm_runtime_get(chan->dw->chip->dev); return 0; } @@ -686,7 +686,7 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) cpu_relax(); } - pm_runtime_put(chan->chip->dev); + pm_runtime_put(chan->dw->chip->dev); } static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, @@ -718,7 +718,7 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, } INIT_LIST_HEAD(&dma->channels); - for (j = 0; (alloc || dw->nr_irqs == 1) && j < cnt; j++, i++) { + for (j = 0; (alloc || chip->nr_irqs == 1) && j < cnt; j++, i++) { chan = &dw->chan[i]; dt_region = devm_kzalloc(dev, sizeof(*dt_region), GFP_KERNEL); @@ -727,7 +727,7 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->vc.chan.private = dt_region; - chan->chip = chip; + chan->dw = dw; chan->id = j; chan->dir = write ? EDMA_DIR_WRITE : EDMA_DIR_READ; chan->configured = false; @@ -735,15 +735,15 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->status = EDMA_ST_IDLE; if (write) - chan->ll_max = (dw->ll_region_wr[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_wr[j].sz / EDMA_LL_SZ); else - chan->ll_max = (dw->ll_region_rd[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_rd[j].sz / EDMA_LL_SZ); chan->ll_max -= 1; dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n", write ? "write" : "read", j, chan->ll_max); - if (dw->nr_irqs == 1) + if (chip->nr_irqs == 1) pos = 0; else pos = off_alloc + (j % alloc); @@ -767,13 +767,13 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, vchan_init(&chan->vc, dma); if (write) { - dt_region->paddr = dw->dt_region_wr[j].paddr; - dt_region->vaddr = dw->dt_region_wr[j].vaddr; - dt_region->sz = dw->dt_region_wr[j].sz; + dt_region->paddr = chip->dt_region_wr[j].paddr; + dt_region->vaddr = chip->dt_region_wr[j].vaddr; + dt_region->sz = chip->dt_region_wr[j].sz; } else { - dt_region->paddr = dw->dt_region_rd[j].paddr; - dt_region->vaddr = dw->dt_region_rd[j].vaddr; - dt_region->sz = dw->dt_region_rd[j].sz; + dt_region->paddr = chip->dt_region_rd[j].paddr; + dt_region->vaddr = chip->dt_region_rd[j].vaddr; + dt_region->sz = chip->dt_region_rd[j].sz; } dw_edma_v0_core_device_config(chan); @@ -840,16 +840,16 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; - if (dw->nr_irqs < 1) + if (chip->nr_irqs < 1) return -EINVAL; - if (dw->nr_irqs == 1) { + if (chip->nr_irqs == 1) { /* Common IRQ shared among all channels */ - irq = dw->ops->irq_vector(dev, 0); + irq = chip->ops->irq_vector(dev, 0); err = request_irq(irq, dw_edma_interrupt_common, IRQF_SHARED, dw->name, &dw->irq[0]); if (err) { - dw->nr_irqs = 0; + chip->nr_irqs = 0; return err; } @@ -857,7 +857,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, get_cached_msi_msg(irq, &dw->irq[0].msi); } else { /* Distribute IRQs equally among all channels */ - int tmp = dw->nr_irqs; + int tmp = chip->nr_irqs; while (tmp && (*wr_alloc + *rd_alloc) < ch_cnt) { dw_edma_dec_irq_alloc(&tmp, wr_alloc, dw->wr_ch_cnt); @@ -868,7 +868,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, dw_edma_add_irq_mask(&rd_mask, *rd_alloc, dw->rd_ch_cnt); for (i = 0; i < (*wr_alloc + *rd_alloc); i++) { - irq = dw->ops->irq_vector(dev, i); + irq = chip->ops->irq_vector(dev, i); err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write : @@ -876,7 +876,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, IRQF_SHARED, dw->name, &dw->irq[i]); if (err) { - dw->nr_irqs = i; + chip->nr_irqs = i; return err; } @@ -884,7 +884,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, get_cached_msi_msg(irq, &dw->irq[i].msi); } - dw->nr_irqs = i; + chip->nr_irqs = i; } return err; @@ -905,17 +905,24 @@ int dw_edma_probe(struct dw_edma_chip *chip) if (!dev) return -EINVAL; - dw = chip->dw; - if (!dw || !dw->irq || !dw->ops || !dw->ops->irq_vector) + dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + chip->dw = dw; + dw->chip = chip; + + if (!chip->nr_irqs || !chip->ops) return -EINVAL; raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, + + dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); @@ -936,6 +943,10 @@ int dw_edma_probe(struct dw_edma_chip *chip) /* Disable eDMA, only to establish the ideal initial conditions */ dw_edma_v0_core_off(dw); + dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); + if (!dw->irq) + return -ENOMEM; + /* Request IRQs */ err = dw_edma_irq_request(chip, &wr_alloc, &rd_alloc); if (err) @@ -960,10 +971,10 @@ int dw_edma_probe(struct dw_edma_chip *chip) return 0; err_irq_free: - for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); + for (i = (chip->nr_irqs - 1); i >= 0; i--) + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); - dw->nr_irqs = 0; + chip->nr_irqs = 0; return err; } @@ -980,8 +991,8 @@ int dw_edma_remove(struct dw_edma_chip *chip) dw_edma_v0_core_off(dw); /* Free irqs */ - for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); + for (i = (chip->nr_irqs - 1); i >= 0; i--) + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); /* Power management */ pm_runtime_disable(dev); diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-edma-core.h index 60316d408c3e0..e254c2fc3d9cf 100644 --- a/drivers/dma/dw-edma/dw-edma-core.h +++ b/drivers/dma/dw-edma/dw-edma-core.h @@ -15,20 +15,12 @@ #include "../virt-dma.h" #define EDMA_LL_SZ 24 -#define EDMA_MAX_WR_CH 8 -#define EDMA_MAX_RD_CH 8 enum dw_edma_dir { EDMA_DIR_WRITE = 0, EDMA_DIR_READ }; -enum dw_edma_map_format { - EDMA_MF_EDMA_LEGACY = 0x0, - EDMA_MF_EDMA_UNROLL = 0x1, - EDMA_MF_HDMA_COMPAT = 0x5 -}; - enum dw_edma_request { EDMA_REQ_NONE = 0, EDMA_REQ_STOP, @@ -57,12 +49,6 @@ struct dw_edma_burst { u32 sz; }; -struct dw_edma_region { - phys_addr_t paddr; - void __iomem *vaddr; - size_t sz; -}; - struct dw_edma_chunk { struct list_head list; struct dw_edma_chan *chan; @@ -87,7 +73,7 @@ struct dw_edma_desc { struct dw_edma_chan { struct virt_dma_chan vc; - struct dw_edma_chip *chip; + struct dw_edma *dw; int id; enum dw_edma_dir dir; @@ -109,10 +95,6 @@ struct dw_edma_irq { struct dw_edma *dw; }; -struct dw_edma_core_ops { - int (*irq_vector)(struct device *dev, unsigned int nr); -}; - struct dw_edma { char name[20]; @@ -122,21 +104,13 @@ struct dw_edma { struct dma_device rd_edma; u16 rd_ch_cnt; - struct dw_edma_region rg_region; /* Registers */ - struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_irq *irq; - int nr_irqs; - - enum dw_edma_map_format mf; struct dw_edma_chan *chan; - const struct dw_edma_core_ops *ops; raw_spinlock_t lock; /* Only for legacy */ + + struct dw_edma_chip *chip; #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; #endif /* CONFIG_DEBUG_FS */ diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 44f6e09bdb531..2c1c5fa4e9f28 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -148,7 +148,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_pcie_data vsec_data; struct device *dev = &pdev->dev; struct dw_edma_chip *chip; - struct dw_edma *dw; int err, nr_irqs; int i, mask; @@ -214,10 +213,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, if (!chip) return -ENOMEM; - dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); - if (!dw) - return -ENOMEM; - /* IRQs allocation */ nr_irqs = pci_alloc_irq_vectors(pdev, 1, vsec_data.irqs, PCI_IRQ_MSI | PCI_IRQ_MSIX); @@ -228,29 +223,23 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Data structure initialization */ - chip->dw = dw; chip->dev = dev; chip->id = pdev->devfn; - chip->irq = pdev->irq; - dw->mf = vsec_data.mf; - dw->nr_irqs = nr_irqs; - dw->ops = &dw_edma_pcie_core_ops; - dw->wr_ch_cnt = vsec_data.wr_ch_cnt; - dw->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->mf = vsec_data.mf; + chip->nr_irqs = nr_irqs; + chip->ops = &dw_edma_pcie_core_ops; - dw->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!dw->rg_region.vaddr) - return -ENOMEM; + chip->wr_ch_cnt = vsec_data.wr_ch_cnt; + chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - dw->rg_region.vaddr += vsec_data.rg.off; - dw->rg_region.paddr = pdev->resource[vsec_data.rg.bar].start; - dw->rg_region.paddr += vsec_data.rg.off; - dw->rg_region.sz = vsec_data.rg.sz; + chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->rg_region.vaddr) + return -ENOMEM; - for (i = 0; i < dw->wr_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_wr[i]; - struct dw_edma_region *dt_region = &dw->dt_region_wr[i]; + for (i = 0; i < chip->wr_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; + struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; struct dw_edma_block *dt_block = &vsec_data.dt_wr[i]; @@ -273,9 +262,9 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < dw->rd_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_rd[i]; - struct dw_edma_region *dt_region = &dw->dt_region_rd[i]; + for (i = 0; i < chip->rd_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; + struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; struct dw_edma_block *dt_block = &vsec_data.dt_rd[i]; @@ -299,45 +288,45 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Debug info */ - if (dw->mf == EDMA_MF_EDMA_LEGACY) - pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_EDMA_UNROLL) - pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_HDMA_COMPAT) - pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", dw->mf); + if (chip->mf == EDMA_MF_EDMA_LEGACY) + pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_EDMA_UNROLL) + pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_HDMA_COMPAT) + pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", chip->mf); else - pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", dw->mf); + pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", chip->mf); - pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", + pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - dw->rg_region.vaddr, &dw->rg_region.paddr); + chip->rg_region.vaddr); - for (i = 0; i < dw->wr_ch_cnt; i++) { + for (i = 0; i < chip->wr_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, - vsec_data.ll_wr[i].off, dw->ll_region_wr[i].sz, - dw->ll_region_wr[i].vaddr, &dw->ll_region_wr[i].paddr); + vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, + chip->ll_region_wr[i].vaddr, &chip->ll_region_wr[i].paddr); pci_dbg(pdev, "Data:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_wr[i].bar, - vsec_data.dt_wr[i].off, dw->dt_region_wr[i].sz, - dw->dt_region_wr[i].vaddr, &dw->dt_region_wr[i].paddr); + vsec_data.dt_wr[i].off, chip->dt_region_wr[i].sz, + chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < dw->rd_ch_cnt; i++) { + for (i = 0; i < chip->rd_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, - vsec_data.ll_rd[i].off, dw->ll_region_rd[i].sz, - dw->ll_region_rd[i].vaddr, &dw->ll_region_rd[i].paddr); + vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, + chip->ll_region_rd[i].vaddr, &chip->ll_region_rd[i].paddr); pci_dbg(pdev, "Data:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_rd[i].bar, - vsec_data.dt_rd[i].off, dw->dt_region_rd[i].sz, - dw->dt_region_rd[i].vaddr, &dw->dt_region_rd[i].paddr); + vsec_data.dt_rd[i].off, chip->dt_region_rd[i].sz, + chip->dt_region_rd[i].vaddr, &chip->dt_region_rd[i].paddr); } - pci_dbg(pdev, "Nr. IRQs:\t%u\n", dw->nr_irqs); + pci_dbg(pdev, "Nr. IRQs:\t%u\n", chip->nr_irqs); /* Validating if PCI interrupts were enabled */ if (!pci_dev_msi_enabled(pdev)) { @@ -345,10 +334,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -EPERM; } - dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL); - if (!dw->irq) - return -ENOMEM; - /* Starting eDMA driver */ err = dw_edma_probe(chip); if (err) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 329fc2e57b703..e507e076fad16 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->rg_region.vaddr; + return dw->chip->rg_region.vaddr; } #define SET_32(dw, name, value) \ @@ -96,7 +96,7 @@ static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) static inline struct dw_edma_v0_ch_regs __iomem * __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) return &(__dw_regs(dw)->type.legacy.ch); if (dir == EDMA_DIR_WRITE) @@ -108,7 +108,7 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) static inline void writel_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u32 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -133,7 +133,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -169,7 +169,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, static inline void writeq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u64 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -194,7 +194,7 @@ static inline u64 readq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -256,7 +256,7 @@ u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; tmp = FIELD_GET(EDMA_V0_CH_STATUS_MASK, @@ -272,7 +272,7 @@ enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id))); @@ -280,7 +280,7 @@ void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_abort_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id))); @@ -357,7 +357,7 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; dw_edma_v0_core_write_chunk(chunk); @@ -365,7 +365,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) if (first) { /* Enable engine */ SET_RW_32(dw, chan->dir, engine_en, BIT(0)); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { switch (chan->id) { case 0: SET_RW_COMPAT(dw, chan->dir, ch0_pwr_en, @@ -431,7 +431,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp = 0; /* MSI done addr - low, high */ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 4b3bcffd15ef1..edb7e137cb35a 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -54,7 +54,7 @@ struct debugfs_entries { static int dw_edma_debugfs_u32_get(void *data, u64 *val) { void __iomem *reg = (void __force __iomem *)data; - if (dw->mf == EDMA_MF_EDMA_LEGACY && + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY && reg >= (void __iomem *)®s->type.legacy.ch) { void __iomem *ptr = ®s->type.legacy.ch; u32 viewport_sel = 0; @@ -173,7 +173,7 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -242,7 +242,7 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -288,7 +288,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw) return; - regs = dw->rg_region.vaddr; + regs = dw->chip->rg_region.vaddr; if (!regs) return; @@ -296,7 +296,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw->debugfs) return; - debugfs_create_u32("mf", 0444, dw->debugfs, &dw->mf); + debugfs_create_u32("mf", 0444, dw->debugfs, &dw->chip->mf); debugfs_create_u16("wr_ch_cnt", 0444, dw->debugfs, &dw->wr_ch_cnt); debugfs_create_u16("rd_ch_cnt", 0444, dw->debugfs, &dw->rd_ch_cnt); diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index cab6e18773dad..a9bee4aeb2eee 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -12,19 +12,63 @@ #include #include +#define EDMA_MAX_WR_CH 8 +#define EDMA_MAX_RD_CH 8 + struct dw_edma; +struct dw_edma_region { + phys_addr_t paddr; + void __iomem *vaddr; + size_t sz; +}; + +struct dw_edma_core_ops { + int (*irq_vector)(struct device *dev, unsigned int nr); +}; + +enum dw_edma_map_format { + EDMA_MF_EDMA_LEGACY = 0x0, + EDMA_MF_EDMA_UNROLL = 0x1, + EDMA_MF_HDMA_COMPAT = 0x5 +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID * @irq: irq line + * @nr_irqs: total dma irq number + * @ops DMA channel to IRQ number mapping + * @wr_ch_cnt DMA write channel number + * @rd_ch_cnt DMA read channel number + * @rg_region DMA register region + * @ll_region_wr DMA descriptor link list memory for write channel + * @ll_region_rd DMA descriptor link list memory for read channel + * @mf DMA register map format * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; int irq; + int nr_irqs; + const struct dw_edma_core_ops *ops; + + struct dw_edma_region rg_region; + + u16 wr_ch_cnt; + u16 rd_ch_cnt; + /* link list address */ + struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; + + /* data region */ + struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; + + enum dw_edma_map_format mf; + struct dw_edma *dw; }; From patchwork Wed Mar 9 21:11:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775610 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 881F2C433F5 for ; Wed, 9 Mar 2022 21:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236791AbiCIVNk (ORCPT ); Wed, 9 Mar 2022 16:13:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237777AbiCIVNj (ORCPT ); Wed, 9 Mar 2022 16:13:39 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54FF2F3; Wed, 9 Mar 2022 13:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcGFcim5IVLsxx4pFK62TU6UkmF+5qVe4Y0IqtUkovv20ngLr4EMcnElSr5M3twS+OeaFUlWrZJtREM9qERxgyQY77ZHXKlL2FouirlemIf794XXSrxAROBjzTfyVnw0c6kPpxa+YbpUKvS4oYvKkGD3+r6TljYh5Czh536qCSkqeLZGsbjsYh0bVweAijgd0dmRGMtZ/YirSJqRITbLr0RqYgC1aSLCe/Ue4pxF7hlTpFSoAZ2oDirXjwIuMS6ZOMxbHMq4MVniZM3RNACmdHmrUXZnFnGzLkIG48ZAGuzQOzo3QaIBITzxRwxQE816Yyw4thuqOfVaZq+JEgltcA== 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=9y1Tg0vJDQBj7Ogdx+zhHJvKV2s6HQMNCw/wrEqsK64=; b=g4F9Cejl79UjwmBZIlDVl0PZ9Q+bALJMVWyS2X/2eP610fOSMHouy7ApwNcmJEJhd3OxYjyi0CYHCVsoB9mA7WBzGgN/Pc1+xkOoHAYLt6kcykLPPrWqi17XWi/HS3Ydbd6shj2INVIQuMLnBlFb7c8e0PtzqJjJEC4XKE085VbQFSki1PGKbNKTpC/74n7PBe5qjR2+/dx95u6piXRfLcTyNU172P+46J6JsCyWcbd4fZth7WoOgBLNYj+z5gWUiVDTmMggGb9WhoirrsM7RMF5skCq1NiEOrQYSXutEmpZ3clDWWAdoYSt3zGSnQDHSwq2138kd8lyZvJjZEBfBA== 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=9y1Tg0vJDQBj7Ogdx+zhHJvKV2s6HQMNCw/wrEqsK64=; b=K3mGewUA0QB2aD2xiJh4hLSR47P/CLRt/RZvAHkcFAlcJpNqZpWcLQT6CSi/1fJDO+RwCGngkU9R7RUQ1USbfdEU1dIiQ2ru/PLKzwfOwwUMGmLNnc4/fZtZxyOSRyi2GMGya+M8ivKAOcVJc0hWq2R9J8pkXfJEoTkvUeqSnVM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:36 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:36 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 2/8] dmaengine: dw-edma: remove unused field irq in struct dw_edma_chip Date: Wed, 9 Mar 2022 15:11:58 -0600 Message-Id: <20220309211204.26050-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6610720e-9ce9-49fa-d0cc-08da021188a7 X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5O/FxI+Oh4hLxBBbKsv09EbPlHfE/5pj0AGRIarQXzVRAapZn8nx43r7WNF4KgUNEaCQ+hMFq/g8vU/3HmTSjoVCsM/8Yr9X70Ov3zBhVkhXtA79xwZpMFbnRI9/NzJyKMfRCWZYk/N1nxoT+13BoTzExLIOBBazTQutHM0+DZGAUiRKnn7tZycFSJzy8ynMhYvRTtKihVC/AdA3+q9WTlzX08YXr0YUF+wo6V0rMumRkUnZhRDrvSQueJZDusS4X5tVwo8bRm+8/9MTuK0T/iVAd6816os0GxEjqP0JiWYhaRKUc4xhYB99O21Y0bQRlC9BQF/bIItc+wNF5ztka3eMpAP6EVa3oZN01cywfoIpHI7ZfYSPplYjb+ANGD6xjQ5gRWBBgZzSKijgloqxpnZ0Q9utwKbtfMJINhaYA20sbpf8zd1ZHllVKxL/M8HuQfSEqYUE86SxTYc88pWzlJeGLAGRS4He14op9OXlq/DR+huKvTgur53q93CTqsphVpozxO/sSZ9ejgo6EA4TNQ0QNyZm7ZLik4dt85MFxG3UBt2Qnjx/yj0NK36swjkjpe/eS3StSPHXvtXY+SbP1nA2anJ55EFXm50VLSHuzpQPjufsa5Og9MYghA6LA+XeOw7sX31FmqInnV3Ay3OCBhnXtrkPqPD3k2NQy1H/+FINEUGuYVv/OkzeqfZhIyh1CLnBg9P7yGguA7/Vl/eiyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(4744005)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uBtg9Zelk8iD1XL7YdezaKnib0tCcwv6zcwhayYMJgYR7uhFLouX2/sC99RswBUWvqRJnnC/WETY1BQ6tr72IysKhLbf+4ilvwH+ws4ZfLqAxW8McRfziOcKmP1Sb5CqNdPy9mTqCPdbO3KhvGxnJzcRtT6xUs6jIxZanePbnlXwyv5l4JhK52kU7qYNVj/v2qSGMhjKqalnZm/wLyY32POytdFHGJENRK+h+Naz8t+hzy5Qs+R2/n/ZM3no/IBor5HVD+g8DU4sejdO0fvXTqsU5gDc50SX6fupkvnZPDhIy9QZ2WVA0NWFi/4YJ5IH5HIUNcYhnKlyYqz0RI7CIF/zfEXyc0yvQSHKmX2YuugloNsekBmEtNgtV/amP7oEdubJlzFLv5Rsn9p6C5XlFvDzVHDOR14N+qXOAPPbcSZHEAA8OuewsgexM3uebhl0hai10u2+ZfeZSvPSCclkyup2Ms2UErtQBspoxVAVz39dxpp4u5to0NWfh5eOyPdu4aT2tDW19dL91EbhVHMLvhzu8ttwTcY8/qsGV6/h3TY8KXPD2TlqJ47mMo12LxZ7gqEQ1HpmmgiNxJOwzkMsdhyIyage4nVj2HstWx6F8iAQpqxsKU0MJFmp9ME/U/xPj+S3FRERe7j+pwb2K/psojm2JBtoy34UMAuBAxYjjvxpdem67e+thzn7GAlNwfEo9om47PlF99K3PpANebq+g2rgn0q6QmfdijIaqfRId6D28mnTLxYEt15xKCgnYC4atmPpKDL7BNvV9uZY2MggBiZYqUevrA4QXghetyRTG9YmxPzOM6QJFS6NgVDmCoBUc87IGcKpipNvTqJut1DudNJwedbs2P7N5X5Y6P75L9IV5XUluPQ8zpH3VIGQsCWKEKO8qYnRAOn0CYvZWbt71V5eHeBvPzPZoG2p/QfxOGieFIDQ2ZaY3NLcUMK363xzpU21l0ghuZLv2kq3APyNNo7wekizN6yTaA9SRQbp4VfxRxfT0QyBDw0RqZA+KRcnAkryAH1ExxIWWAL2Q8CcCqbHPwawNj+mJAkCs1ZnSl978xyGtGYoUIgykooF8m1R5MVaybYvISF5GgFnezQqDjNOYD0qoV1AumTUr1S0NC5S8yoqlXeN92NSQkkYJH/sdxowCCAi3Vz23NcLeLNt4SaELFBlNb9PCCECj67nQi+dv183acaZKBIBW+RD2Not33t6FmOcsilcyA13RAuAKyzkDNgvsVKowayUPmMgtNWEa+SChmHdkP7CHtPrjHtleu/fCmr5nQ1Kkglnr6p6Z1N5wFndrQIBulebffj8+Q6qCea2fmpRQ2cxH3vz4Y7sRD3ZrbsKwU6xR+BRoq1cerOVLKv5o2qiS6lbZXhyr8AoOw8CGroyT3El/fUiimyj90MlF01ExhrwWs9mwzT6SuOhOaiHVf2XlV23viZbGAlHg47H9xxKm9Ep2HKQs4wReuxSShN6mdzy7sTaI4QXXMQsUzEBC9FyCQa4TbfqNbmhq7OnPJTuZeaVND/tCUXVkfsXkXTuI6lgYLZ7/4UT4q7BNmFIC2T+NO/oP6YSO/FwwmmKNyabmG3UBcUjZnIjOS0lPTOJdy8vthUW9zVe07mQ6lyXbhJl+x7X24gDG+w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6610720e-9ce9-49fa-d0cc-08da021188a7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:36.0026 (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: 1qyC7pnKYv2/DB0ldj40dqaIQz9AvekD9tR6XcGL7bJ+VlRNVX+2EMSmXCcqJwb+OS/1rbdeCyH7pyjcbALfnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org irq of struct dw_edma_chip was never used. It can be removed safely. Signed-off-by: Frank Li --- new patch at v4 include/linux/dma/edma.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index a9bee4aeb2eee..6fd374cc72c8e 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -37,7 +37,6 @@ enum dw_edma_map_format { * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID - * @irq: irq line * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @wr_ch_cnt DMA write channel number @@ -51,7 +50,6 @@ enum dw_edma_map_format { struct dw_edma_chip { struct device *dev; int id; - int irq; int nr_irqs; const struct dw_edma_core_ops *ops; From patchwork Wed Mar 9 21:11:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775611 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 F0D80C433F5 for ; Wed, 9 Mar 2022 21:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237137AbiCIVNo (ORCPT ); Wed, 9 Mar 2022 16:13:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237777AbiCIVNn (ORCPT ); Wed, 9 Mar 2022 16:13:43 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B34C398; Wed, 9 Mar 2022 13:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Us78s1J+yiTmJPZMoUqu5NZufMgQGFv/kJ48wPc4QJShxNXh3BnxbaUo+cgc/omRmYWwOMi73aBlvq2YS4eIp71ewzvz8ZLyOx9E2kO83pT2ZOVaDb8IuHd5lJTxfzQdAFJEJNUVgDBKUGnO99sBVag2IobYr579yoqB/yYY5RCNcGr/uhLUoHMLvNV+qJ8yjOqcYDirPzTDAJmnH6yO4/9Lk7Tz50lUK/mUXpMoQC3aAQlPLDFzyUrdECAu05b7xWKyqGRX0PhrVRIPkFoOu8+A3SY5/9fbvmhLYhI0SPiAkLaD7pY7hhIRJs0CSWYy1PhFp4ExgXKsb5tUKEhF4w== 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=IHT11MjgnE39rNrGnEtyOgi/lFFnnixX5FddCpJpqJ0=; b=WlZ2qceqBc10sEWP6Tq1DqX/MpZR2OfxuUm3egLlo7rv/DeaicaDemb1jf1DHuFopbNC4urM5SKLqmvuFRIP8KlWuNG0Xv+lPd7BuGeUqlMH1dDrXsnREW6dcgBHc4MCq5ToR4kqY0i+/q+Dyc7wAEcFS0wqHfK9+Br02SlS2hlmosz5Nu+PZwjDPj5xoKulBVHgdYbnsLTYi0FBVSCyqd+gcYDaojg++6AVDLJS/avXtHljQ2MoGbg3K2j2myqfg/exvAKLsKugKhJWn0aMi8lKawSFVg1ZfS0FY4UFMwdBDXH9d+qGmp21aPsFSLZmpGwYQTsAQvgNy9zeRbJJmQ== 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=IHT11MjgnE39rNrGnEtyOgi/lFFnnixX5FddCpJpqJ0=; b=TWM2AI6u7ZfVqzAvurJgxX/0LLFQWi6KxSK9V0NMJr2l143wr/oGEKg5Tj1i/Y6QYCm75aY/LRlduTBXKHIW5ATM+l6iiPp4Vlx/dvmPK4aJl6Ht6rfKmjSEDiSxuncZ7HzEHlkvDrTCTg38mYFw+ASgQOnRmBt+U+c8RSW43fU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:40 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:40 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 3/8] dmaengine: dw-edma: change rg_region to reg_base in struct dw_edma_chip Date: Wed, 9 Mar 2022 15:11:59 -0600 Message-Id: <20220309211204.26050-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1e724a0-159b-4c0b-5094-08da02118b6c X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Sc7rnibeJzuQJGLQ9X+VtY/wIynWgyY3NXIIv928wXSJQ6ub/Ij4SjwwcyNz0SUHjVVP3TpL8qaw8AlPeLTBD4mvulvsWPiaZ9bvY5wPPNq/x8ALNTPJP3OvTLBeRI0gvnih+SodeQSTdkiOY+0UaTJkYlLWiTho7G25PYL8/gBD167S//REc/jAGHFnreZ30KFJ8SZ0vCfaPSUN/kVlXRMkfzMo5NGiHm9BFtQdGf4pB/oq09IwiB9tOmRbBlizK0gbAhZM/QpenZzvqSNllze5P5yqMt2BijWsbEUeggK5ewMabIX4fJTTDsM/Gp7Mq3sd6h3njQr6cRpgvRZiwQQumguHoor0vqbnEcVewsfxSaxqwUwI99z0Zix/LzHfFQ97vtubHmG7uF47R9drTm0i4lLv56vUjPEw+iQ42xRvxLsD0to4OXCfXkx/wmYX/6IJeI6518+NJdEhoWcMiRad3lI84gISFRBY9Z0quhwyvYCW0MKeALHa4fVQjXPhWKfum6/1uPQJ7HcIhx0OYEyuwXFPjSytWIghl9xWu4d8BXtM1mlYtZj0LpgF4VIJiJSJwQmIH/41dc9Kj3h0gUWjpPm31aIFScBrz3EowhUtpdtexLBmnXTCqOdHZ5486cOOkJa90GyY9rL7S3sl3NSPhXKZsr/pfhmqXxcUJADTEJFOjw/HYcoQHb5TBZ2i+iSJugFqGHsFtLy80Jfog== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4h8ee4tBh8EB9kreyhDuwNtonhJ9NRTnkdTUU9sSFKev/ofH4bRZYdz0LURyf9vG3Feivw89DOnBvX0NfNoRmQkTgR7uRTqqWcRxyL/AmQ122ogYyh9LhvOnortEwjuA1DJuJnLyScBkg9XXVr5dohe/KAygbxVo/3EdWaCBY9zvnf6JkGCYhRSQr+J5QTJ7dK/OxGqaTmpeSIbBd0xIJXRSJcxQzoId6VC21XL786GdiiCu6TiNBvaz/puMi5OKLsRQUbOzpU+UPINRAmDh1HyaXiOYDtdU//jdSq82kBfjq++jWKvU1KrN/6MWRVJ73dOnUVHJsN3C2uSXzhyF69dAQmCTEjJTjNrsnSpLHqdmcQp1TN7TK6HAl6PV6lmttmyIE3t38XmX4F99esfK1v36L4jeokEYfM2VJy7EsPCcUOx5BVcLH6keLnL4KCMJTDaw98FBvTRRBfjvFJoxj8ZgtQKvE1zWn6wbb6mZfr79fScZySCpEiUqHmBYspB3kgE8XZOL4k6jzE2LtkzIXpAFtSYBPIPtJgAaBq25Sk0N4WLB3JefsVVIN51JKDLt13Tyl2LSKXiVNhB8U8Ft8NpFlBaErwxCjhmsS9sk+blwcrAtETA/wVYz/58clJeWlHGr73pVYkPHbtC0YXJSZ3Jt73pkqQturjr/IqXVeoMU+Ve8Qq+eKjStUeqCi39AtHNw2l5tICQZp7eY5nm6wPh2UhHjieThenyuN7AYGhsvNmo+Z45IgQItC7IEy6lqMkzwYEB/7JFRJgJeX31sR51MLNnxIaqNhhjhnxfoNOGtA4O1VkuWMOF4Dk1QxtkgTg1BbJtZ1mktwTQ8o99ibkTA0/4INORrd7pdWnVDrSIdCZjFEoExoLEB/LKVO9/KfcBMSCSvWXOUI9SkvEjm6PWyGBHC+rQoJChJBHbz/HAZnO8x4JUaedngNfE7+i1UURXtJnwv7XLGtRgdgEX+n6cjClagqC07SdD5bMzQ49bmc0nAhGQnzzIKkOHVOQ6NnFHAn2ZeCIrUWcxjaBCRyG8PlhAY0VeDlJxr4+kyJArc6+qMUSZzIuqF4yzEhCVcYfBhywlIuqzUmxMS6Q78A4v5Q0euTrnGbKhQb+kJcdcTlhz6CchWeAF/yDydrT5KgafM3lvgSlGko3ZWG2b0uhheiZkRwrEsUoGFwrDrJpm+OPWw5xM+b4I2HNEb2wGDK1bFJ/vFS5x0gFUOXHKbMEhqe8cNWvC+s9Gqe8oYNaZ5okk9H4Mny/OsMypX1y6uwT0RJ2eWVBdp95VP5VmJssKHw9wvPyjgLUUPbl1ob7yNz4oGcj5I1I4EYPmdINsI9L77n3VVYukD267+YiXbOel9/5xj7hjq89Gz77ic+b8uEuz9R3MFp6lMeZ+/qSc9rOa9O6kKFwH//KHHDF7m3PYIfjeFj1vufqNnEB82wRjxxAR0wJklKtIBDT9j4h1vSVQPZUa5tgNMGz8VSkFq07SM+3rYa3DpmPgx47ta+yoCd7IU8eS27weLI9dZSizwV7XCf67VRv8YMw+npHv3H6/Mm+hwVGNas0EXzdjCzLjeLDyR3jEftOU0stCsH9IUl2wRlFdrwygLfueUhzKejVsSyVl/Ze6fD9VyuQUR5uw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1e724a0-159b-4c0b-5094-08da02118b6c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:40.5209 (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: BSds4LPPnOOks0vkHNh5BA6KZ0lnw4CJfqOLq1/QTNiHizBY/89GE7xVnDVK4s9r9iXGSgSp4awgwfBS1dDgIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org struct dw_edma_region rg_region included virtual address, physical address and size informaiton. But only virtual address is used by EDMA driver. Change it to void __iomem *reg_base to clean up code. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- New patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 6 +++--- drivers/dma/dw-edma/dw-edma-v0-core.c | 2 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +- include/linux/dma/edma.h | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 2c1c5fa4e9f28..ae42bad24dd5a 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -233,8 +233,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->wr_ch_cnt = vsec_data.wr_ch_cnt; chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!chip->rg_region.vaddr) + chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->reg_base) return -ENOMEM; for (i = 0; i < chip->wr_ch_cnt; i++) { @@ -299,7 +299,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - chip->rg_region.vaddr); + chip->reg_base); for (i = 0; i < chip->wr_ch_cnt; i++) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index e507e076fad16..35f2adac93e46 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->chip->rg_region.vaddr; + return dw->chip->reg_base; } #define SET_32(dw, name, value) \ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index edb7e137cb35a..3a899f7f4e8d8 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -288,7 +288,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw) return; - regs = dw->chip->rg_region.vaddr; + regs = dw->chip->reg_base; if (!regs) return; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 6fd374cc72c8e..e9ce652b88233 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -39,6 +39,7 @@ enum dw_edma_map_format { * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @reg_base DMA register base address * @wr_ch_cnt DMA write channel number * @rd_ch_cnt DMA read channel number * @rg_region DMA register region @@ -53,7 +54,7 @@ struct dw_edma_chip { int nr_irqs; const struct dw_edma_core_ops *ops; - struct dw_edma_region rg_region; + void __iomem *reg_base; u16 wr_ch_cnt; u16 rd_ch_cnt; From patchwork Wed Mar 9 21:12:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775612 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 AD456C433EF for ; Wed, 9 Mar 2022 21:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238374AbiCIVNs (ORCPT ); Wed, 9 Mar 2022 16:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238377AbiCIVNr (ORCPT ); Wed, 9 Mar 2022 16:13:47 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150082.outbound.protection.outlook.com [40.107.15.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C76F42F3; Wed, 9 Mar 2022 13:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjnWcyEGmFUN3kwed19fP587Wk27i79KDOFZA0Vdwa5KSOZElAXdie6VpRlxrjjF3AQRUK9V+Q8d5oeTyV2Pw66JdTksdLIbUUgh6L9WQEZqgLgxFdw8URK/wKm7jYi19XNC3pCxr3WIwt+HlsHqv84yVAQEBe5CE6SpxRXqNUR2kfBDUzPPDdxXe0C1GPvnTBrueuxtHSFuOx0R5ZFRL4UaI5H5LiG3MXnOp0bUODpEZddvQmH1tLB7l7l2o3lmbTExBDwPqfNB9MIoOUwbCYu1+idWD0qwAqrmv0IOaONKT59BuN/gdRWvsBqppcpKVjktHgmzp6C6muguDgY7kg== 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=4fM+4qJD50tUEvuhkEVHv9xN/oCjiAUk/rMYm1Ro1gc=; b=nLv6F0OixG6LvjqgWqPyvupeEniD/rqHDydY4BdbaExP8mKGnQp+b+p9foOYVQlB1CUoR5PZirNoUSNiGhKNEfoo9GRS/SYmRlfZWQlXuuE+1AUfQy9fB5XQK6cS3CWKfcaam6uTtTu6flxfknMvhiEq2M6gf/F6bJSgq9HNJSS4yCOZzyUav0l27yIlL2xbIjzmAkx16K+OJspoLVJZXyj5eMu2ZoBdOrtuvsl6Vjn/p+32MuSEmFxfPPN0tHuW9fqif3NaY2UvLIkD5/d/EkZfwIN+FNSOm0TKOwbRp21OMEGXVXXwclBUCc2zszpJKtpFuAEFNmyL7001miiy2w== 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=4fM+4qJD50tUEvuhkEVHv9xN/oCjiAUk/rMYm1Ro1gc=; b=sP9W+OdyDKi6cnqu7KQnQVfhiIzmt274f/XJVyoCXICcRydKiRw9Wv+e7R8vgIVIsdEt9IfGAXA4c16VM1JmTOV1te7AZc6DlSe+mZDrE6nYcYkEM1J/Tk9o49scSQlJ+wM7kCPWvwXhd70/TVQg/xA6Dbhz4MeiGM9qnNgW8lg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:44 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:44 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 4/8] dmaengine: dw-edma: rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Wed, 9 Mar 2022 15:12:00 -0600 Message-Id: <20220309211204.26050-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01796f26-0eaf-45d4-cc2b-08da02118de9 X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: axbitCYhW+/z8tmjaMwJTwe87qwQzrl+4TFDsNVRBxoUJrC9WCj6Mn6v7oevnCukSQCm5YxpLbd1YbUnC4RNHUN81cI+dbiA1S/hn6AmtdO+nhB1nmJuCnD50TebLJPDJi1r+UInQXADE0cX/9Ai5GCM4OULmrEgZlvBCbKu7G9RXDqH+VAzwrj5Sls/RGJkPKqXdF6UHJ6Q0EKpvS/XhJ7Y3mvuOWhjMgYqfRr3yz82axdrQyF1GJeJOAvIxzcuvE/MZGoTsQBdwe9HXJKuEcA0Mycj0DMqla8qniotTW6LboqS9YXYjStQ+c3wlFKWq9FHilketi2NNfdGypkb4EVzqmbKMdFAeUK3bR1sas/R91SlEbtUWR/coOAXEwGaj8Za7qBuLDY3PQUWjyT0thyYWhDdTx8zpgOAZ6BcarTTv9i1l9cnlPDJ6VuN6G2Nxtiqle7eOlUjZKth5wkYif4iPpS0g93wv0NWX1Tdk8qZkTAe+isr6frxrmJBNjSSG30Dih/qu9k7Pkv2QdAZ8ytRowpa2jQUKmqdhW17nQ/whoxDZS+fLKpeI5stmGHodlIFLIQdskISqlcl2t8BQeyrD4lNpzrfMEGiFMItlrO727huhhXq6BLCRtvw/tE8PLnAGF3XjnO4QxolLRuy5UXqI4vBxlCy16ooxxztzuQEOqwx4DxD8oaIOw8jeIAasJ/0l6quu+y/WMKcTTxifA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FFcu/q/JEps6/DvdPlGJMkouXaD5EeC5qOvEgR0pu197OLfOlT/JlEDZILFrvvPxPWighB7eXSWrUDCkN15PO27A0o32z/w6sGZljFsh9GQfSUtCxTYsho8ldirPkC7MwWdraqKQ1SbI8KQUZcvSUM1f9sY9ZiDAfHJVe/dDJ24/XEkBWzyFMTUg/D6PBKmYYj6+u5mmK0fSvLeaVybWfO8JdOlkFJXcFwpQZNJARofcXq7buC+B01q4grV82XEKksA0Rb/GINYQCBVbMzSZpptZ/4fp4bePiUJGIJr9ygZIUOPFEuzA0H67iI3s21YpZFw+2KJVrL78mWLTGcjHxp8H4p8pMrp4DC3qCoiDIo6iCZBpqiLFXOtBIIs6sFjq3lCGYZIeWqBt/fIwx9O2MYj/RjzEzYMHutxysm8gm2eBWM1HMX7oyQMkcFLAs3dv9Y4JOG5u6iIaGE+dqpHwxdER2qBvE/TiGQH/O6kHGrXkjH8OAaH8yoqhyLl3PmgUzv8Hduv4b+IIwBjfII9odatvediErUGKLJHqYg63jaaJdFyKIoNtGijZbDEI8h69GxGofbLVx2+FFp3Lo0kIffvecIg0RwjijiftxEyUhga60z936MXQTDIECMRXl20PS2B6Irdyf9eixJpvKMM7RD5ThT6khZwLi99pvd5s5PKeOfvpiDz3oAJLKqmWA3DSJ0nB/gB2+xxsrSPWkHn0C6Uq+2cAknO0osvhJ0PGQ4i3M9acn9Z0Vz78vnjbqFWXShNMIZqIFATEQGWUuboTsbNRLBvC5HVZb8WNqVVBOLigAc56Ffce5pB2ZMgcWgZs625QSfFy1utJZCu32bsrlCM72IXfXYc9SU8r5dqZX0J5NuAerEPM7/fOyRHkjmuCicwwwUNhtloWknQ9sDux+k9OQPLSt1qG9VYH8llXwe6rKyFgN6oQje2imQLj+LSl012gVhs4bb4cdASm74lVKYA6F3u+k7RJKpU8TonqLdoOV06/jR7YKjFH+TQn6lV5FhB6e6wBtN3sDIkMMuamCkF2v8ejjqV5/cS/Y6DGWIQ3OL8TxvBVA/LoikkXeYjhrZnDdoGGY3vsCAqzJYNg2WC4aiayMaKnxRrCDwICs3YHLLJHvMuVkorsklVnTdDHeTdPp/6merfU85urKzpWzzp6Ak/tIEgQkEstaEKqG/HyxoUZf/OoWI1/bq+ydusNdA7D8gHyVE9i7umLa7UScIeZL2T4idYy9ELcjmkUOPozGtY1NFkERvgQAKMIBLlkuBAHYhax2O5msOkagq0+Ke2tLc8UoldvpMScfJcXKLbHZQyY09nrIM106f4oPkeByzuMj/vu+l3iD8o5KrtD5mBQ3ArhjuCh9+UA7ypZW+VTUgKOTGRW9FkIA0nno5enbPqBEjYWwpqw5DPd7INc1xrVHkxZyjMUknlO2HUYRNk/d+b18ErUd8wj5jRWyeMQT36koU6IJJyeSYJ6yt/A4ntrQcHp6Wt2gedVcsm6cRHZlWUoiuz+HJwBElmJ3Z1y+7jSyRaRJjQLZigRb4urTx/EBvQZ5zC0vXrcrc3+qawBRE2Hqs0ffiXYDZkYkUtVBLV6JAa6tV1JGFFyCg9n6qXUYhPcgabjG3QWPJfNBOc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01796f26-0eaf-45d4-cc2b-08da02118de9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:44.6986 (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: R7Azh2aSpYeDGt+NJE8vhSYlB6OUb/4PMlaYIiJL0v+1KnKRzGVKGRmdZ4caEDhPd6n7ebSJPplqCpuJnU0nHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There are same name wr(rd)_ch_cnt in struct dw_edma. EDMA driver get write(read) channel number from register, then save these into dw_edma. Old wr(rd)_ch_cnt in dw_edma_chip actuall means how many link list memory are avaiable in ll_region_wr(rd)[EDMA_MAX_WR_CH]. So rename it to ll_wr(rd)_cnt to indicate actual usage. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- new patch at v4 drivers/dma/dw-edma/dw-edma-core.c | 4 ++-- drivers/dma/dw-edma/dw-edma-pcie.c | 12 ++++++------ include/linux/dma/edma.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 1abf41d49f75b..66dc650577919 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -918,11 +918,11 @@ int dw_edma_probe(struct dw_edma_chip *chip) raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index ae42bad24dd5a..7732537f96086 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -230,14 +230,14 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->nr_irqs = nr_irqs; chip->ops = &dw_edma_pcie_core_ops; - chip->wr_ch_cnt = vsec_data.wr_ch_cnt; - chip->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->ll_wr_cnt = vsec_data.wr_ch_cnt; + chip->ll_rd_cnt = vsec_data.rd_ch_cnt; chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; if (!chip->reg_base) return -ENOMEM; - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; @@ -262,7 +262,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; @@ -302,7 +302,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->reg_base); - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, @@ -314,7 +314,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index e9ce652b88233..c2039246fc08c 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -40,8 +40,8 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @reg_base DMA register base address - * @wr_ch_cnt DMA write channel number - * @rd_ch_cnt DMA read channel number + * @ll_wr_cnt DMA write link list number + * @ll_rd_cnt DMA read link list number * @rg_region DMA register region * @ll_region_wr DMA descriptor link list memory for write channel * @ll_region_rd DMA descriptor link list memory for read channel @@ -56,8 +56,8 @@ struct dw_edma_chip { void __iomem *reg_base; - u16 wr_ch_cnt; - u16 rd_ch_cnt; + u16 ll_wr_cnt; + u16 ll_rd_cnt; /* link list address */ struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; From patchwork Wed Mar 9 21:12:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775613 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 1CE70C433F5 for ; Wed, 9 Mar 2022 21:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238377AbiCIVNy (ORCPT ); Wed, 9 Mar 2022 16:13:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237777AbiCIVNx (ORCPT ); Wed, 9 Mar 2022 16:13:53 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2054.outbound.protection.outlook.com [40.107.22.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05C9FF9; Wed, 9 Mar 2022 13:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RjWqrY6Vyp82H35zhy3VNQTd1PtpFCu03oA/dpy7GqC3hOvvni3HXRQJfsizDB9LgpAbBylb0nViHln661mVVK5yyGErFpVQqpX9ZXEnDOlyEI02RiAqWeoqrnuol91YrqWmJ8RC/kulfcGZX5ODdS+Ehob7fvov/FYOBvF/6PleaEMFt+RoIyERxz6rYhWOJAEQ3YzcbBu2bzVkVcE5c2yCRmnWToyVhvbmPC6y7/XBHYAD0ceqrX0+Y0boqtihsBZc0NI3Ol6n87FDnm88lDYC4IMwQASdnnY/xzLAKF+4y4PQT8lD7S/IUpSRbgiQTVV3RqLWvPbD9YBLEEmk7g== 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=472FIKlaO3DakBiBSbd3jLTBFdDZ4qcy2IlKX/rYfLI=; b=LTKge4CjffWCcvJ8gPgFAyDXBEaYkM2ChhVvwkCH/SnhF9E/p4fErRGnUtTHu8Ely0qauDZ+/LMA0OWWXo4yx0yYkBP0rbEnFiRKEpsi3e14eNIGmiTu7Tv7EPwyZdG82ugpXO/EWs4slzAYDRKzR8xd+n62xrrm0/cb6oUTL7E3UXZDKnL9nT80gOBda9lmAJ9dfWbXwVTgN89hULK7JDH1Wf2h6LFW+Gf85f0B69s8JD0Vt6H+5MJiLZ2qWc1PCkD5V03d3ptdSjEJ+L3eL8VrZKydheW6sMqpYoi3aVpd2usER90PFv+jYllwlnn1xwKNbYlAgnCYjkzbbTCL6A== 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=472FIKlaO3DakBiBSbd3jLTBFdDZ4qcy2IlKX/rYfLI=; b=WEOtdhqmsoOxhjlK17UI8VBDsxqEt4TC0ehM6ANJHP8PLppSz/Da6t8t9u3YurGIu0xrHG/KT4auSaoAMrCWuE/qbC554qlPgn5XRkiBK/7RfOLgmETSrXjh4SMis1Z4F+fYQOXGakeRpb1B/i8mQZ/r4XOa+jNDvKcJDGK/tt0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:48 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:48 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 5/8] dmaengine: dw-edma: Fix programming the source & dest addresses for ep Date: Wed, 9 Mar 2022 15:12:01 -0600 Message-Id: <20220309211204.26050-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b4921c33-cb3a-48a1-84d0-08da02119066 X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eVNU63sKOxFO4LCu6GQtGLXuGoUCwe/MNTX6iAQ6xFZZiVWDpxGlf+v/JE+S53s6W4Hp2H0Djs4VBffNogwRDVSjoeV2Cob0cqX3o4qLQVCZeYiOMKJOVZ1aQOG0azqrJHE8TNGK2LYAizBLpfw3lpVZNT94iYg0F4njPSaxEUQzqO7D5MkEVWo7N9UwEl1MfONtUvUogdzhFp5Ad6ZzOrd8WdfKBVDn+73VdwEY4L073IT/zoJR7CxD0kJcsxQZ7ySrZqrb7XqOFRvvR0o73+9TgE6onWjKvcjSUrlVpaLu7Ew9dYXAARndv3eCNSFtTOF1Qb7OrG9IPytcACVs7J1N00VqnScc8vvl247KXPKnF2+50h/OqQRDqrh3GWKKiP89GuYv2lNMj2Ng67U2dXyca4YqHkMempeUXiD3WLV2q40kXniM7yo0CHiUs2hd6bTKGiJ2rqpPbV9dHMMHmEYHpQuifQ90Mjyv8Vd/4+jzup28rYr5ByY5XHvi5lrPZq97bP2kyTo1KHj1CdaMbJS9r4NKqr4nkStcgN+RLt8/g8xnpoWt0ksTim9kuEfUMEDPpAvr/5e4GavROsLAjHgeRfA3X2kEqNrOPZXqpoZ17yiacWAqUnveNhcs44h4TuOhZL6DE45W0CjKnWan7em5vjAoKLap8MEUiM+Qrh1Q2/DD/Bkw0ZpzmVTuPDEpZXa/A1t0udzhTfz2b3K6lQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1+af0EjM6kGRz1wNivx+IDihRXY1URaqigbRUqU133FppM9IJVybhSw+7AGkykmCcldQU0O0AhWu67OYzIu+7QQQjohIqfLeBcQp5o6/Rx3uZDhUT0GXqA/tIwqfNUTAZh06DPmLlQ4gYxelug05Ye9roGeZAdde5YJMTYOPA1CBMUp1mzr6xhJ4Qz2ICTuYbxbGDpq+kpUsHYN1qV8iVrAAXsTQQofyR0CjPNSJESEBXVqXnisit3cQyH3Hy1/9MlHU2Bwhdbe6m2s4T2vKIxCBQnlUrLyffZ8+/RnY6qwMNS6tDR3jUzr3iWvOxrFUkx1IZfzB84i0zyixyddbM3MVRFXGMW78rv4rEm7s569rcWOam185X2yXBZNG7xJ/0k0hsi0cW0/gpyoXglO8pX0B7JZeuTYMlWPjtvZs4G58wvORP0dw6+Nwg5EGW/BhtKFa0it/p3NCMpCNYocx7McHh3DKirRPXiEqAQpFycdxZdvbBDv5E0aW6nC/nFP0QCNqjJPl8Sngm7ZBZ5z5XpHaOjoD6TMQIsELFORsmZxNjY7pRCwxGv6hnbujlhB8JkajuHo9DM3ys0hsUaFOjoMquD6m81SrkTkgNyjIqfkJD/5O2vRmLHTGtbQuYp3RMHt8RWIA1lbwPx9S3WQwLGZ0RZYe+he2QuAS0L/QRjaXyhFRAnB/2+DdcIISQAijej+Ud8noImgcmisdI7RIp5HKkFVT3op9cRFyQZhYdEtG1nc6kIcR70zhfDH4MSe5uu2KamsGUPEGNaTbOZo3IxRD1BCoRF0mE8llN2MUW3YTFHJuIxkK4j+WgR4BDryVMhTJAjnL3rs1MubxIXQbJ3ZjeXCW5Y14gwDc3kw/GaGnFKQHWNrP+gxd0yUlDtgdl1eGcxsrC2b0m8cX3GlkpLQEQoFb+dCCDUgO1oAijItxiUSRaKKqGV6ky8GjYVinFG0FcuzMnLWc0mNQ5Nzuk1QZBTOxoMtjHJ4Il4pwLJnnjgbO92xcHvUilJyxy0eb5xTzbLinPton6bTdzCaQFtNqXXQ8DOuwcZ0RcAQrxsDVtEPjVe+GW31KQgOmmyHrhjY1XgKirkzDHJk7suwN65YlPnKsb4bbKSw82Le4Kxac/ov28uuerNgARDwiKrTVaw7xUPAqedgQC/FAplJkdctR/U4X2dyzwusvSqz6nnK9cbfGEnBAA+xGDG04HH60+8S53uP/72Puo5mN0XNqAAIKltd5KgDxbf+wjbNCfJeVkekrn4eyCQkjsTucW2hCCIFSOjJVdHKxr8ly4yp+147eI2AzcVwUJL8GFe6WlRwm9EyciAy4hd4jNFEZlPutaIE4d2vtiQ5B7Bjjgj4QVhSUt5I6g+HtjC+XvHFi3si4i7Oo1bYanG0K9xLxKgZ37qTOeeYz9jle5pFFcr1yyZhKqBYNUy4CZnN7Mj215oiZEyS7WWSBwV3/Uw4v8a4qOIT709jT8KiNr6VkpLucuDc4EFBH9+1ipZDKrtGJyLo6xGKott9yBvOldW64JLF390V6ghF3hDLKfbu4R0I8dkWtn9dy47nw4SDhTP0bOl8zLaFpiygp4G6+NgHtil2Ot9+fyaadRBFuBDQ6PoljmsMa4sf2vtF9V4q+KXlWfvs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4921c33-cb3a-48a1-84d0-08da02119066 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:48.8246 (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: cBUtDhXke5Qh6aZy73o0Sq3ARvh2/33wfqPkhsXhtEdJNRID2wJCGawb+NMuhsuKOdwTGjNdHSwD/5SdtuuYyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Manivannan Sadhasivam When eDMA is controlled by the Endpoint (EP), the current logic incorrectly programs the source and destination addresses for read and write. Since the Root complex and Endpoint uses the opposite channels for read/write, fix the issue by finding out the read operation first and program the eDMA accordingly. Cc: stable@vger.kernel.org Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics") Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Signed-off-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- No change between v1 to v4 drivers/dma/dw-edma/dw-edma-core.c | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 66dc650577919..507f08db1aad3 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -334,6 +334,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) struct dw_edma_chunk *chunk; struct dw_edma_burst *burst; struct dw_edma_desc *desc; + bool read = false; u32 cnt = 0; int i; @@ -424,7 +425,36 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz += burst->sz; desc->alloc_sz += burst->sz; - if (chan->dir == EDMA_DIR_WRITE) { + /**************************************************************** + * + * Root Complex Endpoint + * +-----------------------+ +----------------------+ + * | | TX CH | | + * | | | | + * | DEV_TO_MEM <-------------+ MEM_TO_DEV | + * | | | | + * | | | | + * | MEM_TO_DEV +-------------> DEV_TO_MEM | + * | | | | + * | | RX CH | | + * +-----------------------+ +----------------------+ + * + * If eDMA is controlled by the Root complex, TX channel + * (EDMA_DIR_WRITE) is used for memory read (DEV_TO_MEM) and RX + * channel (EDMA_DIR_READ) is used for memory write (MEM_TO_DEV). + * + * If eDMA is controlled by the endpoint, RX channel + * (EDMA_DIR_READ) is used for memory read (DEV_TO_MEM) and TX + * channel (EDMA_DIR_WRITE) is used for memory write (MEM_TO_DEV). + * + ****************************************************************/ + + if ((dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_READ) || + (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_WRITE)) + read = true; + + /* Program the source and destination addresses for DMA read/write */ + if (read) { burst->sar = src_addr; if (xfer->type == EDMA_XFER_CYCLIC) { burst->dar = xfer->xfer.cyclic.paddr; From patchwork Wed Mar 9 21:12:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775614 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 84C51C4332F for ; Wed, 9 Mar 2022 21:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238383AbiCIVNz (ORCPT ); Wed, 9 Mar 2022 16:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238381AbiCIVNy (ORCPT ); Wed, 9 Mar 2022 16:13:54 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2054.outbound.protection.outlook.com [40.107.22.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A502E1705F; Wed, 9 Mar 2022 13:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXw6TLsLkh+Xj79RKNAd1iywWKKwQNbWXDtDvLbmZ2DEC3YnH2+38DtDd+sYmYGJrbIY4eh3ASH7fyof/xZ7nAvbLXu/wQc2xKl/Vwon3/tH4uiMxwbQ0OvQa0YYVS+uozO0nu1a1mraZg7EKvxnl0ayW9AXBHc68I5HzBcmPuSnxwfI+/hkz5lFptjgk8Y0XrDxQTwVf4l8SyMSFXrz0WmhmY0rUrDLyBhiTm3rQuu6uhXZVyzNtMSHl+amG2OHOIzykplLKLqqGfzTFA3Wm6rdkBIfatO9VprbmOxlHE3IjQ/aGo+dcw3mgVhYxRJfGFU1lo9s9qduCECPtK5ZJw== 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=Jyi7o8htoSZtFfaUUVXb4rw6J+dz5BzcJ7SUvPklTFU=; b=CMq8v8ddMszf6FV/cxcJ/0hpqotUwL2QBjXJNiL4ssI5P3QXcyvHDFTBQ1etxwfl+k8FqKv9C9CWrnhDtYVuOinKF7UAVAsZ4SQEDt6eN9rGf6b27TSf9ShJtoxlduRhu4Sidnb/swdltm0RKLOYMDUeuBAVbJnDZSRUdAxvMn4Ky2fksy6ueBec/wssor66OpmyZC1buXvCQJI3XidHSXkgOwRlmRn56lRVeW7T/6w0T+UQJUA4DgRu3VZrcb9TNs/IDl4pSnnJRTGjvUtgaIwtEJ6dQk3NVbYRmu3pdLfMMkpTIURzXft3/L8gLN4AnnfJZ9vdDVvzlGuc1Nvnvw== 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=Jyi7o8htoSZtFfaUUVXb4rw6J+dz5BzcJ7SUvPklTFU=; b=e/Ewv91TXLYascTc/5a28CAQ+NPwNWEZhmw4q2kQKdT7/1+YrYFyMOboQ+ucAGFNR8+nj41o1l8unSu1pC+sv/XiMCJ5UkXCF8O9B7EHNkmGft2HRaeGCfEPiZkXhmYw2VlWrxpBFi57/5AmrqSmYD4tj/lOtmxda8frmPgOqZk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:53 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:53 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 6/8] dmaengine: dw-edma: Don't rely on the deprecated "direction" member Date: Wed, 9 Mar 2022 15:12:02 -0600 Message-Id: <20220309211204.26050-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb6afece-a6fe-46f9-114b-08da02119307 X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S2gUi9AeaUGz4rcF3Bh5nrfgh8abdOdddtrkkEKorO/H/YtsA6s6xVzscueEptg0ySv0u5gSWQghA/gA9vsf7/OcAzVhYAPR9c54qkqIzrxsKg24jq9wa9hxoO5DQ8XROanUcBc6bTAXoN5r0+1sBqX9Mw5iHODue7qcq5NKybNu3bzJGul6Zz/JlVqtNCOHglHDfLexRh/rMaAW+RYs64KO2NezwlaoewPvEyc0GTFk8K+fwC/uFa8PzPsi4vB7xMddlky1SlPHkmYNv5+9RzZRJduBtn/sRJAb23cB8AhZMuAJ6WXZCmreSu6ZHTTXZzZO9Ba1o8nDQATorBFuzvvCSZ7FyTpPBeqeoCPTGRAMcotMdBscKp+xJEWHNMPaQ0/SJOJUJGkZuuaSxai94Bq2Ri13O3XdEGMGO/L/93VYynVCuaaAM4rw/jLzI/QGlJswEapApZLwkJSv99S0Yah2zVZKKMqJN0qkL50lOz6u83jxnVDHCwfPLTViMpLPBwCfLLnyrCFkyDgcXzRnBMQAIR2Z6FzIivYfrF9xirf3Ap+1nfpjyIVqsG+XVN7p0sKRcctC4pBTZcisXlOydFx1kTwn1IxHSVOccAWpYL/IcyQBpnkugSBHiDQG6lsnCuriOte7FDuqyxKIOjCsA+BKHfDE3vwoBVH994YmLK5jqVHzWVisK2NEzcgGY4RzRctbHnIe6u4qPA5u5Js4mg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: me5PMSfW/yVj4KEHuhWsg8LUTx4paVzf0Fxx0Yt1XVQQU7VU+3Fd3oXdFTGj0u2wmNqnTpvyyhJGK+G/QsApzaTdvrFvyTiF1Ei9g0AXXNfreSVpsBIL6m/sdvLVLs+R3XGSYB2NtRltS79lMztKRQ+/u8CiyIbkDfT4bpY7EeIJkm1j5iird1tfURT1q2AtqF3DEr7UvxcbRfHuYooU8hfCGyUBchwf7/e5AnuzYV6QYwCJxA4t/W6Z27fi+MD3CR5QkcEqz3pb46J4NeeLnJ+cQqFwzBZfuYlKRv3UodhMvPvlTPMNmfFgdPSMnOgclis2svee+qkMN8uCuqhBBb/GsAjLuML2B6R+syMLdAYDkuLZ9JSMEQ/kptIkNhySSZr/LMjDRK8JiPmVgWlh0jhjOkJNM2FcKFxTy8Jz/o3OQFJLJKQWaun0zZDZMHzQv616m2yc0TndWVUFAI7bOL8eu5EicONZ/+AsimVbaGmaxvem7KeweiJ+FlYljOVU5gsIXhZO1OpNVOasZdNVd2sihTdkrUD0weJNHJXzh/NDir3OZtYotWm3+KcOgBcR4A0Ck8ZnmAClkzf1FZTVFMYuvu5eDYFz+z7adLQ7avSLWMjzf460mi92HSPvpuoJOtIZcneQw3p5eDeckHeMWko9LXmeWvS8l80iKYnsgyNWs0mT6WGy5TT7C0SLlONvtMAVrwOJ2ZYiTqkSdtCv8nJ1FrGkgy0kUq5Nr0UapQMT8r8VWWa8zLLf3mRNC0grje6Fp3JTrdsqYA3Qm04S24BidQVI31YwBrAyAzxcjxVZq2525xABCGKvIjygjYlw87zINTbg4jCUg09Q/unPwszmTodfQtHnGA5zCx8AGMX6YqSieA8rFEkt5T8JEtawpH/oDs/mt2gCPKeG0QmD/bMEttlcckCZH24wyhvy2WvPncR4GidTVitIRutfA/ThoTIWmBLzRjt+XjiUNAiZsxkMswEOfOBlaTm/kxNSEXMvBAkQdDGgIsPjCnA4JwuqgO/LwHrP4+5A+ekH6/iVWxysLzmuTTsFO9l+eH6sF1+cGfp85X7qYb4jEClfBNJ42RBKw1RszJYk3eg4kYRNPwtP5nRDdChVAN2t0f7fhu02U6rp+pDBNiwqDjn+2Zp0eCQrEwjCvOyRgPjvwJLo76ImYmOuZjgjw4Z2p+gbV5+dsi5hJtULcW/lz4XnbH6wDqgRFe4umS/tTNtM78TiaHk2/CB+xtCcuITx9eAKAaMy2XPmA91B6AmxiQuELNq3QTL3a0pQCCcvOOg6Te1tHnqbfEjAJjWqXsJFi1lxb5s0Y1zKFNGwHfz/IzZ8gmxG1EgTmeRwpJHBp0Q8mXFEjTkQrjMb1Yw6ext32+b9eX7DXr4xVWAZBizjlgZDepfqpzGvjL5UNniuvGwIxiEvLCVl8WPeMThhSacbfrrbzyiD8H/IcJw42xTIo7ywXeIug2iJyfbOC/4AvSZnP8/e1jzszuB/imtxB4ObFvMi0XHkisKswIfSQMI7ut23FEAzEcxnSSAPEBO3Hun2njM5AfcHq4vEwPDzKhG742SakXmrXc552gKteoHmPF7RmdjrwwZecVT++854ckd/5ZKdPQzSB/SLUTO0/iwBLxrc8/4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb6afece-a6fe-46f9-114b-08da02119307 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:53.2322 (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: hHUgItYdsUkuQr9U7Qd/29Y+XIY6mdsHhJfBDqwV0JPiluSF6HYWRd7aVAo2T/GwKkSYsoaSvf5xhHRdcpA9vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Manivannan Sadhasivam The "direction" member of the "dma_slave_config" structure is deprecated. The clients no longer use this field to specify the direction of the slave channel. But in the eDMA core, this field is used to differentiate between the Root complex (remote) and Endpoint (local) DMA accesses. Nevertheless, we can't differentiate between local and remote accesses without a dedicated flag. So let's get rid of the old check and add a new check for verifying the DMA operation between local and remote memory instead. Signed-off-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- no chang between v1 to v4 drivers/dma/dw-edma/dw-edma-core.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 507f08db1aad3..47c6a52929fcd 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -341,22 +341,9 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) if (!chan->configured) return NULL; - switch (chan->config.direction) { - case DMA_DEV_TO_MEM: /* local DMA */ - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_READ) - break; - return NULL; - case DMA_MEM_TO_DEV: /* local DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_WRITE) - break; + /* eDMA supports only read and write between local and remote memory */ + if (dir != DMA_DEV_TO_MEM && dir != DMA_MEM_TO_DEV) return NULL; - default: /* remote DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_READ) - break; - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; - } if (xfer->type == EDMA_XFER_CYCLIC) { if (!xfer->xfer.cyclic.len || !xfer->xfer.cyclic.cnt) From patchwork Wed Mar 9 21:12:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775615 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 10A4DC433EF for ; Wed, 9 Mar 2022 21:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236652AbiCIVOE (ORCPT ); Wed, 9 Mar 2022 16:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238395AbiCIVOA (ORCPT ); Wed, 9 Mar 2022 16:14:00 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32EFFF9; Wed, 9 Mar 2022 13:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQEQfNUJOzzc3gz1IHHz+Vkj2sjn59CS1ykWDRJvLgaRw+63yd4xNy3s+wZdQ7sHUBmlrv8wbmcjrEY06gKC0FOTBJDgZThOKmRt+Upobdep4gwe38vXID/BwGRoEYTY7dE28jXvYTmbtXjp665tAQd3cEZw8ELF645QTngq8/chyykGfjcT57cutvYjHv5UaUAgMiTTYOeZ/NjLfLxBVtJHfaWhTyxQHIPZLQYx8v9DWNxxSi6QkSkuokQOkafWEjedLzKdcpNrPKldsf3/i6QHFf0mVLi9ZlMKaDYjEUCnlteTvMaHsUeBiIHoMlWFkUH8ftI8+P3719kQzoX4zQ== 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=dEuLhUL2Hq/d4MR+mMw+BsgEktHL//nW4HirvMWbDLc=; b=lyDg28qjZaUs+5O3zU7jqiYN3rasT+dPpm2ak9IL8K7xduDAUAlqxVlXOXiwbvv76ziCO5x/w/mhLOOVVPd9wioGa6olKUCgYuF2npwYF/OoD0MTcd9GopRV501igf5rmMANzDnv2Mua1pi94D887171lxdhoSRgZ46XjCki+0pN4Q3xshwqvTYdK5nks1y7k9rcIyatrt2L4R5xiwxCxgCYZUIZjXhTluP9En+pi27cMi7G5h6kDp6D7+GmPH50y25FAZyTPLwvbMkSxOW8GVXnK6i2b0UyBtOZ+yNlpfN7do44uirdzqrEoYXcusRrWQ9ryHeePr1Mnva0vnigAA== 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=dEuLhUL2Hq/d4MR+mMw+BsgEktHL//nW4HirvMWbDLc=; b=IM5JFD8jb61Kd71TwBTHaDnjgrY+2LDGhXq40hErL2cFlb/rgM4Nh5aVkdQjTATUZNBHlWuF3asFmiMyoDSNq8+Ft6I0TtXKbdFu/IdPe4gTSzvPgrmFjGQ1xGW1blUkziFrudaJuf+azJCPaHtZL5g7QQ5Y3NOlvATr1qMBwkk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:12:57 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:12:57 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 7/8] dmaengine: dw-edma: add flags at struct dw_edma_chip Date: Wed, 9 Mar 2022 15:12:03 -0600 Message-Id: <20220309211204.26050-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7b40e59-9895-429e-638d-08da0211957a X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S2xrXvzvbmnT0NLtqqDHWGGU3MaYckF5e61X/YJXteC3bVbb8h+OBUbgb7KK8FgYuZYRQyXntkztc6Krwz9krrEaxh6et5xKg5CQ3a0l9VchqtFK3xJ4pSlZ3/dzRbIXyEVkTSZvIVkcDmWHbQ4iy8HLXD2xn3ajaoy3q3ngDuWRtPlLBPTanlla87NhW89pd1Tb0ZbVEa43vhk0L0LeWzx6RaRQatkuzPjU97u5ZvGkBEnayaPGOk8XNO8r/NRpfP+pmHrOZw1Z0gpRQA6OTOpCsLUS0lx7kowf1T5uLtHQfvesruTl/TKBnf7UkbSprICizwYZm4Es12Dfye7dR6tfkRyENqFAB7QKhM6HJQTGTDIDaf0QLuvOJ6yBZO9YgRENJgOwAMD/u0mGt8fZLJz6F+8YPC+Mrclew4aIOdbspa0/SkICvl4PL63+rDIZgX1afSlCb7bH7BmMTOV+py2ZyKxr1jkPQ28qizCyRhkrJUQrjKCTLHQVZZFlXKzNUE4pf+NJ1qbJPk7VVUD6a8jxUZk53DiN7x/UEWRNERVJsJ1Kkgz2sRT7geZ3RBaCzOxTCCpyrA/+PVFG8Ie2CRCpsUnMksKyncDIyjBB0t3GYucXn5MQtLtLtBoq4W67PgywUfnou92VLlm5OqmpR71VBJ+mfrlWXlDWyVYQhhjkbCs4kDaCB313BFU6d8scZp91R/cIt0y1HXQDVz3teg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(6666004)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f4vdm15bUlk8sorsmtPHTOExBIRyQInAc9B1m6KGD+Gjgw3Hxy+X36TiiWaKbt6hQJlSM3oUPwfHKXRhxRo550cOf65AQQhncofwtyAH2J07DDK1NAnQLItTqI76sMR4YtqmcnvYnWfvvs5jfzH6NloXSGqcNoyZV22weMxZJF7n1dkRziA8IdJYoajQ1ub+cu1wrbiiwYxVpfX9XTtcLQpn1f+wpplZ1iFt/7Vpyrw4z2NxctfO9UyTqw5TAZF1kgVzTB6T/6h3M0z7Yp2iMuRLHmNjZJSatwIy7JPT8ZbEMWuTrycHr8XU/iJPZ7CDvm+A1GSRLUmgFvgqLrVzAUs6+5SMeZvobjdHMplCpLs5ZSSsH10Gp60PGGtbp/JycysgaBXgw2id9hiOR68Jq/zzfUcbL55sSJhuT8RMOoe9duwDX9czexXr5M0/1S+eSpOJmXo/07lo4h7oHvs3ddhekPvN755Tj6KXhCjDCKHpoXcfelJaNwrOhMN2WIY7BVUijG1nRdJ/9C9BeBEkOKfgy+j+g6Cx9FgP+aghW/k0irLH4IldBzyV9YDhektRrdp4iZStl2MB1CAxEo8nHwgWyJLLzRtMPYIqOtZV/gghJ+Yr3LEGJ+zG8AzvCMPiJFA/G7iUsxBdTwBNg9T6oik6RdYspILkTLg1MnCa4qiKOioppD1dXb8/ql2YSa+NIk4ab259evl/JPECrlG3xLHKMZg/kt2zzKKTP2iFUSjXilUf8MSB7W2F5zCleHKyc1oS2aP2i4WRD4FihBJJHxsyA2gy3BTHp02koz6wp79SS/nn+w3nd5mugO2LdhsztjRZ8vOtfaAaqnYEvuuohc+jhSiTNeiARQDEFrkTWqahBzNuc+UX9xSGfSiMgOogSLIQl+E7OGi2gb7q/4/AVlib5h6nwH+etmppv5ITXzOBCY+Qy3arJWSweshUJOKow/XkSDJcry/lAlW0+GGv4KyzYIFRyI1C1b3GoKGaQNo1KlY7XRIyuasfwHPq+igWRzBt90W/gKCYHtJrnWGOsjPsGugIwJQ9xTokT4FFkDFeNQ/vnrzMbwOxaSsV0P9VrgGTIynYv7Q6C+WBjTBFtU31ySFvlckoyd+xLbomFdkn/OSIbpPProtsEULg9sOInijL7p1CxTczIcdDjbfZ1fzVJZdrHwCNvkumDUZlkuOtLxM4Sw609h0Ch1tdIDCVpPlpw1Y3+QothOalvThBIxDDLR7f6JlfSN4evjm4Ph1TnURdPMKPJ9x6Rg4MlcjAmNBNLUzMmzEH8VhOhdeaQ8xL6efsim5/AHLpPwPXmTCqgI+hk87hhjI54GJPIgiaNoLx8H2L9r4C5/LwYT2EifaGUpah78L9BfeBsRZGmx+v05IgHLhhXcxADoUdixHVn+eJnrJXfpCYtpdCNTZkekf0reZd4NfTpxYEruTHctOUeeTspmZsT3WT1yw7rWmy4rixQK/ksXJ15MBjfZR2Uz6HRDsnO5EGWykeIzieDm/wo6HQA+ZbUurJvlNtrAeaJpveP6CjJjHjMVpzyJX43ElaTiNdi5dl+tdkfsPa13eALV5Yh+eHo+ArDiCgT4qKDxK/vobeN5X9dtMaxZs1mPFijO0tqnuZ2FsbbyFzzS4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7b40e59-9895-429e-638d-08da0211957a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:12:57.8290 (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: 2YJZOIuZHN8XtW+rnn3nGRvVlcc/ex7pizadPKCGMV4OXst8ghmouIoe4QriSdzVdq9Q6UyVoSuBix/P3yfQxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Allow PCI EP probe DMA locally and prevent use of remote MSI to remote PCI host. Add option to force 32bit DBI register access even on 64-bit systems. i.MX8 hardware only allowed 32bit register access. Signed-off-by: Frank Li Reported-by: kernel test robot Reported-by: kernel test robot --- Change from v3 to v4 - None Change from v2 to v3 - rework commit message - Change to DW_EDMA_CHIP_32BIT_DBI - using DW_EDMA_CHIP_LOCAL control msi - Apply Bjorn's comments, if (!j) { control |= DW_EDMA_V0_LIE; if (!(chan->chip->flags & DW_EDMA_CHIP_LOCAL)) control |= DW_EDMA_V0_RIE; } if ((chan->chip->flags & DW_EDMA_CHIP_REG32BIT) || !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(...); SET_CH_32(...); } else { SET_CH_64(...); } Change from v1 to v2 - none drivers/dma/dw-edma/dw-edma-v0-core.c | 20 ++++++++++++-------- include/linux/dma/edma.h | 9 +++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 35f2adac93e46..00a00d68d44e7 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -301,6 +301,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *dw, enum dw_edma_dir dir) static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) { struct dw_edma_burst *child; + struct dw_edma_chan *chan = chunk->chan; struct dw_edma_v0_lli __iomem *lli; struct dw_edma_v0_llp __iomem *llp; u32 control = 0, i = 0; @@ -314,9 +315,11 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) j = chunk->bursts_alloc; list_for_each_entry(child, &chunk->burst->list, list) { j--; - if (!j) - control |= (DW_EDMA_V0_LIE | DW_EDMA_V0_RIE); - + if (!j) { + control |= DW_EDMA_V0_LIE; + if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + control |= DW_EDMA_V0_RIE; + } /* Channel control */ SET_LL_32(&lli[i].control, control); /* Transfer size */ @@ -414,15 +417,16 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, ch_control1, (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE)); /* Linked list */ - #ifdef CONFIG_64BIT - SET_CH_64(dw, chan->dir, chan->id, llp.reg, - chunk->ll_region.paddr); - #else /* CONFIG_64BIT */ + if ((chan->dw->chip->flags & DW_EDMA_CHIP_32BIT_DBI) || + !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(dw, chan->dir, chan->id, llp.lsb, lower_32_bits(chunk->ll_region.paddr)); SET_CH_32(dw, chan->dir, chan->id, llp.msb, upper_32_bits(chunk->ll_region.paddr)); - #endif /* CONFIG_64BIT */ + } else { + SET_CH_64(dw, chan->dir, chan->id, llp.reg, + chunk->ll_region.paddr); + } } /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index c2039246fc08c..eea11b1d9e688 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -33,6 +33,12 @@ enum dw_edma_map_format { EDMA_MF_HDMA_COMPAT = 0x5 }; +/* Probe EDMA engine locally and prevent generate MSI to host side*/ +#define DW_EDMA_CHIP_LOCAL BIT(0) + +/* Only support 32bit DBI register access */ +#define DW_EDMA_CHIP_32BIT_DBI BIT(1) + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller @@ -40,6 +46,8 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @reg_base DMA register base address + * @flags - DW_EDMA_CHIP_LOCAL + * - DW_EDMA_CHIP_32BIT_DBI * @ll_wr_cnt DMA write link list number * @ll_rd_cnt DMA read link list number * @rg_region DMA register region @@ -53,6 +61,7 @@ struct dw_edma_chip { int id; int nr_irqs; const struct dw_edma_core_ops *ops; + u32 flags; void __iomem *reg_base; From patchwork Wed Mar 9 21:12:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12775616 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 93ECCC433EF for ; Wed, 9 Mar 2022 21:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238399AbiCIVOH (ORCPT ); Wed, 9 Mar 2022 16:14:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238403AbiCIVOE (ORCPT ); Wed, 9 Mar 2022 16:14:04 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061.outbound.protection.outlook.com [40.107.22.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335B65B89D; Wed, 9 Mar 2022 13:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UmwY3Ju4XvuzEMGy9gTs4WR2SOeOM+M0Sb8UhXCqYudqAj+r/5ewyMnoKFcd7Fgz/W2GfXxTsVxdE3iQUOFF2obrl1+NnsqmZ9rlGxlsd3LrV6p0JYNcc5WP1c5ASGoI38Qpive77kX7vMpzQFQFn2dKWxrUTrY2FigCOEY20c5JFfFk4sSJaTc/DMz0i8+ya8VZC86ES3XZSOVteOp3nUh0l5SOPa1PiR/aA3LkqH6XELUZCGMc8DQbo/+vjScZASk4tbnVDO0OILUTqsFCGXzkBFlyhiq0m1cKdjRHw8oRsWNRjjZ2O7eEEuaguziLqcMmx0/CPyrEVQ/1noVXpA== 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=QoH5+xnf51thSn+tNBhcfaJCTYOPly/hZtbnkzVknfo=; b=ogf/Y7O7abxvPWmaHTRF9LxoC2aAgBps7Ssk7TSh3BLJaYNvIIbXVGzSEgHvVXrGwljH8dDwPIkdZflevsNVKaiqM+aN74MAp1SW3OCmpvobc/xRYbTuFS7IInVF3gvByrTP32niFRxRUS5Kmwvb7PTH6YDlHJK5ITShA6yE+nos/Lla75+QZfQublzT6JjE5i8iT3VO8e/0hdb1yijSceANkslG+TIxpHYXCBfGlbJKNofbEYhs+GVCSd7KAUxC97sInbwYp4VrN7PlFqLMqZEOgBmy/LdN4RYTbUtSGXn0e8VduH49k4GwIiCi1W2iHQAICUMtWEinQd2hEGkWBA== 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=QoH5+xnf51thSn+tNBhcfaJCTYOPly/hZtbnkzVknfo=; b=lwMFgZWqwR4ysIZUu603IQDWe1dAysdSoC+EA+Cn3y62XXlwCYQy4uTaI9d18zNdDk+LeRkiZWvbczTAadAdZIe8gd9WvAdddt7pO28Bd4/VMWEP3ZyPux+U5jBgvU6ur1U9GT9uSCfxZU87iABtyLQVVZoxZdM2p8KrCGy97MM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by AS8PR04MB8358.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 21:13:02 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::c897:1bdf:e643:aef8%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 21:13:02 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, manivannan.sadhasivam@linaro.org Subject: [PATCH v4 8/8] PCI: endpoint: functions/pci-epf-test: Support PCI controller DMA Date: Wed, 9 Mar 2022 15:12:04 -0600 Message-Id: <20220309211204.26050-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220309211204.26050-1-Frank.Li@nxp.com> References: <20220309211204.26050-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0170.namprd05.prod.outlook.com (2603:10b6:a03:339::25) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60501543-c495-432a-67db-08da0211983c X-MS-TrafficTypeDiagnostic: AS8PR04MB8358:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8t5XobC/eK2xqPVhgMZKj1KMvoxtpZNVcsYY7mmU4SXRbh8GUnOqhTAiaerhPXFQArKrPOuG6sjybV7l/DTu1yCOfB5Zd7HM/XFOqRw/zr+2LN9c4m57EP2CtST9xufTJvwXfZjKITQ1mXX6lUG9bc0FouTRPTv4oQtM8rMqfgDvX5IZNFmL7i2jQuRSFbwiG4rtyyGQJdzwdrIRygEZN/m+bfvA4v+1WexKCcK+6bglssjJBKUG4NW+NKOfGATpJOjPmCqsEj706sp+tQECiGOMiSPv33S9pGp2Cr5nt/oXSY2DkbIodPeRCJUEUsrenYjqFTc1MXvjsYyvZ1/8mSmo68BrNgZ5XeSyCfaZ95SAasZ5PFi5RTz9MkdMGjupfK+aJvjYDIQP/rNGYtsOZnKsrbi2+kswzR3bp1kcskdx/Q6S2kyJSk013YmlktkccmR8/+k4NyHBPGIkAWZyQ7r/YjNDZOUE3Yk7ewYYiUIxsUEjsj82MdtF3v6d4G0BDN4FimySLtfxMkNst2oE6KcS9Eio8JPoJTsiT7gDCSrrUiJKHoa/4gErXEGjqbLnLeOnUHHKVvhUb4XjKqutG8MvrLW5NZSgjNoKPRWneB4fLg42QM0ScW8b4FHh9w6oHDpUJBlgDtbdBtwpxboLxqTWOzTF8VdB40epYOlX3XF1qRLQn4r5yg8QK7S8m2o/05a39lhQcWobEPNsj1zX3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(186003)(508600001)(2616005)(1076003)(316002)(83380400001)(6512007)(66946007)(86362001)(66556008)(52116002)(66476007)(8676002)(6506007)(4326008)(36756003)(2906002)(38350700002)(38100700002)(6486002)(5660300002)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xRF+XDH0gdJzE5zfbyn23bkrZfN62YqFPI3VWAfymagLHqMQwY4OaaL+xOngwk/dVmKIAtLlxk/l0n5+ouXGrngTc0VDDp2mNknJVExi4LMTuwFdf4wj+ZHFV0cdYE7iCHHLlYKetgXoqqh1XSYTd5XKnEKb/5t3f4aus1A3m7JfppIkPM+3hhacLNxHyd5yk/CUPrEPlU7xoSTy+owRMaApyx8ae9s0kl8sVPddHIWewsnzbFEE8pJXycjVmjMzZHz/kw+UdvCncz18mOUncouAHMt4q3puIhs08grAOQB8YCprvCqVXUfjSpqmwTsq3a2No2NAjPWGuuWpeMvNR6ayZlHfuMXcPXxzzQRESwfO2xPaMlgsWUaG1XZd08/iJzjjtuObs+sJskG3YttegIPxMeufwGOBf14tXTSbVGg9eiDuBFSclnvkJUZMm35zsnx/g9hbbvv5WfhJL4IwsoL5ePjA1DuTJv0NmTrj01ykfB8lJeDySAKViBMy0guiPJbZ7K7j4HPDNfysOfgqGIJ0bSekSsCX+S8FwpDf0yOIJZ6vsWgIBBRFZbxlEV5TTWkgT5uzMSKU1QLAcHRN2tufMQg+doC1OmmZ6kZU4zTh6ux0xvYt8kPCx/InWpf3NifvORYPuHz2E9Ai9igyo1KcnF4YN+imFdhERhZ31QSgc7St8EH3ni4Ed5+D+yPy4Og1jEIN9ylvlpovLby5DyK6VVKKj1ukJyswQKMJ6ma6qz3j4sQpSAb5tJDQHtjhBj3h/fvB+fN9gthG6TGCZdgevWPPnxG6A2aIVyrTx0SNLGHbFxK0RD+ik5RvQxGGcFdhl6uUt3dNhJZdwS0P6vo0ijimFqCO8q+uM9qDDKt2KETEkSu0Vki9HJZMGXv9EPVY9ZfqxLcBGClnqg74DTBXfl8upTwQsNgzfglYs+D5NyQDLX32v+6TB3IwYo0ZaHHxN950I3s+s53Z3rTBdBFtUNdbRmZH80PpCSm9c+TYX9elmPSVRKDMdIy/iNgEmp+you5qObPildb5i84cltAIkCyxRijf3GFaHObhMNGPtW6ZT7CIoWUxLVEuCmWLrdE5J3yXKAC+Q0Tz2pfRz+0xOsUbC/JvNYf92l3DcOr6euwR1ty80IQYPs0lL63EEbpiGAjCBktDyD+oyGYERG6rDCXbXE1XfmZD/MkUApUsSPynOJQ9WJgGYALDydECH6TxAvF+8HoT2GZ6/m9lsCrV+8TUEaTBdxkx0DJ1MqdUigEELSKvagB8iq/kgI7xNcBxBm3qTy7I9cCgv4e7MU/Snl6/eCXQFOQjEIn6St17uGBxzYNba5+PSPzbyNoxflJGo2x8vCrShTUxkpHNCWl+j4XiAHJkM9UjZ98ZeGhGx6swyGKqzVdW9+Q+A3kyaUQKbt3l81GOgBd5Zq6gC+OScUK6nHf9g/cDMCfduKBDsDA6lY4KK07/PCNud8WUjkyKfGDBKtPvhq+VIH6Lc2rud1OD4YtqxSW+TJGzljLFhg7LwSMEux51hIkHT9qbvuym+0GMM0nMLiJVCLihucNdf0xAZkGSmr+xtHHYjbNsd0lCnWAzRy4jJj2WjNAh0Bu1qXLBjig9W6xl/jzS2tx8c6lViKpveVFfJz4t/rY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60501543-c495-432a-67db-08da0211983c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 21:13:02.0015 (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: 6uNWJ25S3YVdRyU/QeZ8hn3VRczEWwq4RkYn+9oeSv+9dpEuRwo7JxEKaI0Erm4YgyyyZABCaH1SdKYhdWnZrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8358 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Designware provided eDMA support in controller. This enabled use this eDMA controller to transfer data. The whole flow align with standard DMA usage module 1. Using dma_request_channel() and filter function to find correct RX and TX Channel. 2. dmaengine_slave_config() config remote side physcial address. 3. using dmaengine_prep_slave_single() create transfer descriptor 4. tx_submit(); 5. dma_async_issue_pending(); Tested at i.MX8DXL platform. root@imx8qmmek:~# /usr/bin/pcitest -d -w WRITE ( 102400 bytes): OKAY root@imx8qmmek:~# /usr/bin/pcitest -d -r READ ( 102400 bytes): OKAY WRITE => Size: 102400 bytes DMA: YES Time: 0.000180145 seconds Rate: 555108 KB/s READ => Size: 102400 bytes DMA: YES Time: 0.000194397 seconds Rate: 514411 KB/s READ => Size: 102400 bytes DMA: NO Time: 0.013532597 seconds Rate: 7389 KB/s WRITE => Size: 102400 bytes DMA: NO Time: 0.000857090 seconds Rate: 116673 KB/s Signed-off-by: Frank Li --- Change from v3 to v4: - reverse Xmas tree order - local -> dma_local - change error message - IS_ERR -> IS_ERR_OR_NULL - check return value of dmaengine_slave_config() Change from v1 to v2: - none drivers/pci/endpoint/functions/pci-epf-test.c | 108 ++++++++++++++++-- 1 file changed, 98 insertions(+), 10 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 90d84d3bc868f..f26afd02f3a86 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -52,9 +52,11 @@ struct pci_epf_test { enum pci_barno test_reg_bar; size_t msix_table_offset; struct delayed_work cmd_handler; - struct dma_chan *dma_chan; + struct dma_chan *dma_chan_tx; + struct dma_chan *dma_chan_rx; struct completion transfer_complete; bool dma_supported; + bool dma_private; const struct pci_epc_features *epc_features; }; @@ -105,12 +107,15 @@ static void pci_epf_test_dma_callback(void *param) */ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, dma_addr_t dma_dst, dma_addr_t dma_src, - size_t len) + size_t len, dma_addr_t dma_remote, + enum dma_transfer_direction dir) { + struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ? epf_test->dma_chan_tx : epf_test->dma_chan_rx; + dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src : dma_dst; enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; - struct dma_chan *chan = epf_test->dma_chan; struct pci_epf *epf = epf_test->epf; struct dma_async_tx_descriptor *tx; + struct dma_slave_config sconf = {}; struct device *dev = &epf->dev; dma_cookie_t cookie; int ret; @@ -120,7 +125,22 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return -EINVAL; } - tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + if (epf_test->dma_private) { + sconf.direction = dir; + if (dir == DMA_MEM_TO_DEV) + sconf.dst_addr = dma_remote; + else + sconf.src_addr = dma_remote; + + if (dmaengine_slave_config(chan, &sconf)) { + dev_err(dev, "DMA slave config fail\n"); + return -EIO; + } + tx = dmaengine_prep_slave_single(chan, dma_local, len, dir, flags); + } else { + tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + } + if (!tx) { dev_err(dev, "Failed to prepare DMA memcpy\n"); return -EIO; @@ -148,6 +168,23 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return 0; } +struct epf_dma_filter { + struct device *dev; + u32 dma_mask; +}; + +static bool epf_dma_filter_fn(struct dma_chan *chan, void *node) +{ + struct epf_dma_filter *filter = node; + struct dma_slave_caps caps; + + memset(&caps, 0, sizeof(caps)); + dma_get_slave_caps(chan, &caps); + + return chan->device->dev == filter->dev + && (filter->dma_mask & caps.directions); +} + /** * pci_epf_test_init_dma_chan() - Function to initialize EPF test DMA channel * @epf_test: the EPF test device that performs data transfer operation @@ -158,10 +195,44 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) { struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; + struct epf_dma_filter filter; struct dma_chan *dma_chan; dma_cap_mask_t mask; int ret; + filter.dev = epf->epc->dev.parent; + filter.dma_mask = BIT(DMA_DEV_TO_MEM); + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + if (IS_ERR_OR_NULL(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_tx; + } + + epf_test->dma_chan_rx = dma_chan; + + filter.dma_mask = BIT(DMA_MEM_TO_DEV); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + + if (IS_ERR(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_rx; + } + + epf_test->dma_chan_tx = dma_chan; + epf_test->dma_private = true; + + init_completion(&epf_test->transfer_complete); + + return 0; + +fail_back_rx: + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_tx = NULL; + +fail_back_tx: dma_cap_zero(mask); dma_cap_set(DMA_MEMCPY, mask); @@ -174,7 +245,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) } init_completion(&epf_test->transfer_complete); - epf_test->dma_chan = dma_chan; + epf_test->dma_chan_tx = epf_test->dma_chan_rx = dma_chan; return 0; } @@ -190,8 +261,17 @@ static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) if (!epf_test->dma_supported) return; - dma_release_channel(epf_test->dma_chan); - epf_test->dma_chan = NULL; + dma_release_channel(epf_test->dma_chan_tx); + if (epf_test->dma_chan_tx == epf_test->dma_chan_rx) { + epf_test->dma_chan_tx = NULL; + epf_test->dma_chan_rx = NULL; + return; + } + + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_rx = NULL; + + return; } static void pci_epf_test_print_rate(const char *ops, u64 size, @@ -280,8 +360,14 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test) goto err_map_addr; } + if (epf_test->dma_private) { + dev_err(dev, "Cannot transfer data using DMA\n"); + ret = -EINVAL; + goto err_map_addr; + } + ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, 0, DMA_MEM_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); } else { @@ -363,7 +449,8 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test) ktime_get_ts64(&start); ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - phys_addr, reg->size); + phys_addr, reg->size, + reg->src_addr, DMA_DEV_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end); @@ -453,8 +540,9 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) } ktime_get_ts64(&start); + ret = pci_epf_test_data_transfer(epf_test, phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, reg->dst_addr, DMA_MEM_TO_DEV); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end);