From patchwork Thu Mar 10 19:24:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776866 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 01B3DC433EF for ; Thu, 10 Mar 2022 19:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbiCJT02 (ORCPT ); Thu, 10 Mar 2022 14:26:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238418AbiCJT01 (ORCPT ); Thu, 10 Mar 2022 14:26:27 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 707EE136EEB; Thu, 10 Mar 2022 11:25:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+h+P1DhH+U09L2736V333KxzXx9kdNRMPz2ZH1XfnjjRLXRV/qRNfdsRSWATt7SFb2tW+AowbrJYnd3RbWfbjxHibdkDadH55fLLlxFk6z7gEzlk4WNVrCugdlSrXu2IaKKhqw4nVo584ClV54am5tJVt7fueVYXTMJbi0nDu9TMlCp5QPFUEqtD10i/kkB+nM4DjaJVtyWMIiKnYmrPnXSB0s1FMg5Zu2puZ4CvcoFwI4XMTId9Wn688SU8Xz7vsUwR0N5lQXeU0NnrtT2ovS2O9914rcVpESqhYDqu67tSq3jSagdodF0fXT1y+wuWx4CLYWJ6TOM20FfG5r8sQ== 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=CiSNsMKMUNNyHvGUkJniYCmDvNd5D3cxWL/bl2gyenQ=; b=H7VZbH/V351n0565gumNbKug40t1R9howg/0qJElqAMisP8mqP6oW3BYnWYiK3ZtV8pMKUIIPTy/Qv6NVWZuGQYrxoNaf+/QBysLA9idbMOuAMR+FIvFQ0XWicAO/7AWNnNFRJHybNba6SykKunV4aXeq3aM1gyrXM2mw9he+fXdAOfMcXej2PO/4B+oSPYPa0AmThXwU6icptab+nQ0dFp1YuwOUfyuzJgKvWvsjk0w6eKfuVfPNTfzFv2WySvwre3PisL/Gm+o5rW6s68/ka5jsWBVtOgNt4IDm6WAgCYOWMGayl5sa2LHdW/GoZTCyVF5wUApAnwTwP/sCXnLHA== 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=CiSNsMKMUNNyHvGUkJniYCmDvNd5D3cxWL/bl2gyenQ=; b=L95B6iC45VJlqmVCmQm4ZbGKAMZLptREe7BFPN92m08J7Nwei01SI/7SH0Y1JD3LkqjyV9Du6G+910LFkpSYgYCbgH03Mg+cIJ8VHxAyS2P9qkkCJ1VfkNfC4ivLkPN2+TkBBLs0fkIws/JvRYJa3MYHj7phZgE5ijvEdYf63XI= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:21 +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; Thu, 10 Mar 2022 19:25:21 +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 v5 1/9] dmaengine: dw-edma: Detach the private data and chip info structures Date: Thu, 10 Mar 2022 13:24:49 -0600 Message-Id: <20220310192457.3090-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 46463df2-6638-48d0-b4cd-08da02cbb7bd X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: OZJH/pqzwOvfSDPC1+MZBTQYeuFTQ5/4fzKITs5rzDG0IGQrXLV6F0LHXPj6qxN2qKJmfx1Flbij0inKUAUH3hUe3H1JHsU9axxXOr3FHE1LbDquPBhOs0LSFaQah4I/+sPkmCseYStxWv5PYQ14EmMZdHIEBaUW9wcUquv1nIOnZnbkwByi/2/MoXecXa01DAjETGsxyzQTUNPBBGHTRw04TzGPRan2INVvrYjparUGprcQ0NilEAx1B0Feo4qXPxuEKeaGWCMQomNo9f+Lg39u9zlwQ3N3i6cMfC76QuWBJDFxTg0w0avQBIMifbAhIN2eJR31At1y2gehzP5wYrslas2cacJgYzuJZELk36FBAO/iYxxvxJt6ofg46i9587uPMUXlNvFJ4s1u7ybDhQGG3ekWw8/6GUmRipnj8AUO7gdu2YQsuZnx1oiaqTg13jJco8Xryv09pyujc6rcwcy/07lQGpxJgbJxhU9iS/q/KS6OPGuorIlRhx4qbzod6kB6DFWXDQO2AD3PMs/YBPstHx9qDZJK9ItkkHk1uRPL212LjZppQ0Z3+Rk7I8I0z3dsKHu63vNI5ITsSzPFOUtRmgEBEVeJHUZ9+c9rSG5JtEX3vFsTboMhqZQRRY7tX03wL0up+iJn4MVhf6vrKYYmcyRq6hbdutpg4kFwUKJ1NBNIOXIH+pEE4O/AoSKdOnBjHw3FACfwesbr9pnSpg== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(30864003)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O/GVJaL3BiNFBrkQrTvwXushDS1hLtJjTPhAwZdQdosDs3upfll8HfeJtN4DGtkA6Shp6mcND0pEhwVK98T/TTWYR6eoqOUGP8cMnGgIY1F87XmPVFAIcl4sBNir5MV44yciCwUtcr7H3/ImFV9ymdp+cqtrleGwmIyyAS9XSmWeXMd+RB1EKG8GFhvgF3ISqp8Gxyq6iKjmd+r6YI/7C1enr394wGD+U59NrhfE+Vs0omfAO1ag7dGcETa4NYb9MVFXU5opz1Db4OzKwn/51KgvBvvzcOEsCiZ2kGNL30R/pbuIS7sUxwVaoSozitk7gJmSfVTCbgTOWgSbUQidKW1Y4DYZP+rMTUnqBZ3SCYTAaxZ6pDbmoGQ7Or9fvqZrhKjzzx3nhVmJZG9VIxfQiLty37XQsaI9A9KM7LhGnofz++MtQs3kMuAuxsK0TG6E6nnAojH+HYh/j05B3Ry2EWCM5Xjk/j/AZZE4eRpQxsdfSw1SLEfTRC1vMsGoPGVzVt9GnKoOD0PM6y5Gu6OzQzZZczrGLfZ2BIOWT+FUtA5gXxgZJwvKqyTqVyYmm0vehjv+l1C6nS3BlOIHp/CzZk2EFvj9xHWM2sWrExiSj5ITYtz7CFWfL6caSFMMHyNJQVhGmFDXZts9GRkd9u4ANml8YbJ//n6dGWOyFOEPGjIR19dTpn+gT2jD1c7OzDVI/xtYsxt9IkzFZNqAjVrMYvOd+MV7+kzNvbuBETBzguvX0h2YeLtELinSTdXHd7NQi0uFlK9pzG54gFUbjo267Ovj2DPY0hP6NmVqkG3PfdVxNK1CkivATqhFsWfonHJnCCbfGv/eKnLwWXCh8tULNTW1zysZPSbYPHkZqraG29PuR2l5T9L7mYuAJB9LwbqVkL17ic7PY8FDH49DGPIhVTgmhyPA/KuEq8kQGyY5eMrZI4yfNfPBIQ0sjaFZpsoiT40qfvRiwg5/SWIn4IFPNWlkD1K7MfRgGyR4idTSTr35FxlFme/VZA21cN2Cq/7/5fqAS6fRhJXLXRcsE2iLFQ7Iu/cqV5Ye7HZOVPqcf3gtc1AxLCT1+gUIiAQrgOvCE6cLlJ2XoLsxeyDys6pFWESHSD9pAX1MnkFHb7kMDR+iq5HK38AoA9I+B/wSqDa8PK8WLgBPXU+ZPC9qFus9t74BYpWyPxu/+2ccE0xk2QwSoE8CsT8UjDByCykstnPueZyTjm6u/C/h1AvaDXkMuDf+m0END976dEGpMrs3btFAp14MXoLRnIbh9QTD91vePMcFUUetiUYqkc/UzG+UEfZ/PuO5EORhRmxIO1Ud9kEkXwVI+Ghydm6fBTQeXax7I5dDm1bCrHJTTsBkAo8NgYZD0shHrxQscZGUiUOydk+FE5OOU+rH2dvMYUBihj1zPvS9vNZGbi0E3KCNfMEsTH1iAUEFPmmW+VWSilimGMKwTeJuWKp1SQxD8rosy5yf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46463df2-6638-48d0-b4cd-08da02cbb7bd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:21.5156 (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: ilmagXOWZAnum1zMXNdJHfswjqvScczlrVQg+MyjDQLUyw+hLzQmDXNpmTW0EtFYb5qx+DmWuRXR6lAsRkf9lQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 v4 to v5 - Move chip->nr_irqs before allocate dw_edma 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 | 82 +++++++++++++----------- drivers/dma/dw-edma/dw-edma-core.h | 32 +-------- drivers/dma/dw-edma/dw-edma-pcie.c | 82 ++++++++++-------------- 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, 143 insertions(+), 131 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 53289927dd0d6..2503f1463f07c 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; @@ -902,20 +902,24 @@ int dw_edma_probe(struct dw_edma_chip *chip) return -EINVAL; dev = chip->dev; - if (!dev) + if (!dev || !chip->nr_irqs || !chip->ops) return -EINVAL; - dw = chip->dw; - if (!dw || !dw->irq || !dw->ops || !dw->ops->irq_vector) - return -EINVAL; + dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + chip->dw = dw; + dw->chip = chip; 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 +940,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 +968,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 +988,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..21c8c59e09c23 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,24 @@ 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 +263,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 +289,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 +335,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 Thu Mar 10 19:24:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776867 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 18780C4332F for ; Thu, 10 Mar 2022 19:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239810AbiCJT03 (ORCPT ); Thu, 10 Mar 2022 14:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238418AbiCJT02 (ORCPT ); Thu, 10 Mar 2022 14:26:28 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D00F13700E; Thu, 10 Mar 2022 11:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EMZW4m4CI8aetBbaZqrDkSEAH2nvswSRQs5uXrBVsjultTSkP0amjZ//durfW7mNaWV/1qnMKyvLjaW+LShvrTg2DkmE+cGIhJJwmgWbaQeqI8unrJo6P6/7pdre/cJoTbWJgcmw9UdZeWMHHFKIevfwjq1o161uzgjPVgZlZyWwF/Nz3aPvNegk7tGy2JCrrPYNZRMGrV/pV5fdViyPOHkCugmkOkbcsS45EmX/bZwyz84kAzknmHxyIPjIVW11z6od8MGAcuSi+3NpBgCBZCmATfAT+fs3Atll6L8d1PWBGnbclw00QaL5IYtXPnamab0SN12xqVt5Idm3Rwz2ig== 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=YYF4fW+VsXQBRbFMpYnxf6fGmn4O1QU+++8Z/MnDsMI=; b=Aly7HLJoc1v0dmNkbFRyyGeeXk15JnwKaeZHMd4TIh+Cabat37XZpfFZ2lcWJ1F8sNu5TWC24l6o1UPyc594kiHhQhRZD5Ok0fm+ImQZAdRUEiGRMy2qsWtPMmOralQt25GBisIJ9e0yXziKWMRHQI6ztQt6D22QjkBUeDhvzZvB3Sz1wAOPMohZK4ZMcwuSjENXd3jg2K9EX9Dt2iBZ7mscWljnkl4+lsjTKl30/pSnYQquqRayUNg1zxIx8hxYJxrWO9Vu7whlAmfBC5ndp5EbtkmE4aEf3NEQsmi8XgB0Npwbh+JSPfHZWLL1ERSYldq7pZyeq8ktGPA93vy9wA== 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=YYF4fW+VsXQBRbFMpYnxf6fGmn4O1QU+++8Z/MnDsMI=; b=CZwtVHnP0QWlb8riFly/7hdSgOUPdwgIr2J3957jk4bzxwb1rvEZpDcurlC0jv0zhZ/1gYWW3zL6H463wv9Bvqfb+pNa6iupetR6KTPB7/gYzxta2pFVn0VIAzlGkyyvSQnDQyk3l2MLX48RfV3cmsCYCoe6ozazX46S+BYf1Nc= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:25 +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; Thu, 10 Mar 2022 19:25:25 +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 v5 2/9] dmaengine: dw-edma: remove unused field irq in struct dw_edma_chip Date: Thu, 10 Mar 2022 13:24:50 -0600 Message-Id: <20220310192457.3090-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 2211cace-7f9c-4511-cba9-08da02cbba1c X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: z8hARnsk78avM9jpqqfqbmE+F/pNNjRNK7zRQDZwuujD5K8UqnEvLaGiRTWlGlm6yQm9UotsDnmDncCUljdyfIRhoCd9klowTleM5ueblLbVLPhNfsTIlw4e5F2qIA+0ZEjsukStTvhGGklFxcPzh8PRbxGo/oBs2YAaIZmFDoD52wTBFcFmsetC6HQgItMkTjdkCrVqxs317iz8IA+iLoysNGmx/VtcKd+AkMymyjxeiNHG8V3yaXd1tWwOXK9UN49tb8UkLrH1GOzIcbS4nOCFpgqK8bcKrlHZIF/RNn5lyICnYChcTOYBNO8rnUiyPH8kw72r9itkEUMnCdsmz1iP2tlH74cIlD7ceCF3TIqp27+6O2xLrokO0EH28PAkRcbGWoaasCCzR+ULrHn+UGrFk2d1T6ak+8vadW6v2XSN3+pvbtZnH9DURnEIbQMF9ypKOhVzar0DGReuAx9bQZg7rhgIyMCotxIq9DZW9gmDhMLmyIfGz1KGMv4xnpdPZhWUp4b9ZGNohIXLfNf8ZtwvWZHmiC/lzfUJ83EF/Gf0+EoTePRTPlbTW0D5yKYg9tPqFH/lioXCO/a12nh/mzLi9sEToVKQrO5TR+7K+BhCg4ojYy5end2nBiVvXM8ExPayq8bEjP4qK8Uhu3U5wmaFimeOLCG5MxUSzk2N7mwo+RsF/7No+HO6bRHcVuEWHLmbs8BC2RnC4YQmd5s/pA== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y3qNQwmc9h5Oohca2CI/dJfjLStUsgbjxZd+HK+501EQ7M+/dxNcKC+gzIKgISzYy4k6lFBLNwO8EKVUw7yT0TZbslniWOCcKhd+3t8SKlbPz9PvE/k3BB7685KVpO2Vv/gbY6lYfvIxJwfRfegPWTnEVrtM20a21lPiNzdjIHo6mOxTXTuc1fz1uxmTfFgnp67+TBzvRik8tWB+fd1pafiUR5FXHrw39ljFcFXNBN0Yq4jb/nXLdvangNXICKLrVU5W7h3GTW4DkCu4a5HUPKlF6VpHJ2P6kkoml40ojGL7+Lr8ZkUpwBvsxft4yngA4FPNgzgjH6hJ+tQmXmMcD+n77RS1ICacES16wLF5UNW8/G9t4iAm24K8JkBkr14moJ1VMEaG3Y55ulNQOdNL48ejP9d4OYxk3h21g+12HqWsC6NoHrFZzxfR3Tkm8Cm4740HbA1dQRLnRnR0Dpg+/DxC5uWm0omzYRoZ2mhgNV021p/uQ+LOENCKdkhAcQ2rIflWpZKyReZRfI0dh9lpjaDVzj568qjofOZ/09IcfDm9E7bdX4DRh0MBMfWbslPpmL7hnsqRbdGHELKSNQRrOuFBy/EQi2oSG0xvozpx+3dC1bj1+xfJwNqKJuyVArJKcdlLBKm3uXrHjrSggBVvRqPk6ILlksTqpwlgSZjuXyYY9/tEDrwnkTtleuOWKAsC3QNq2PDBHh39iyrYq4KO7H2OLE8GJgaFaOw07IoAzDh+Rq+cN8FazI88YZY4mAu121+bljrafWbcZ5RkvVBqq0d4b9ZS8gSt5SetiX+tHUUT3m3zZLePHoACKM+hmIQ0NzfB0dotOH9rTPptyOo2eFU389lJ6AfOXYNuPMQZlLKOhessit9OOyWHJe6bHviS0Sc1ChNkBM9SHFEv3C+ZlPUyFcG3K+pD1S8LcYDsUlQ3IFkBW9j60LUABQOyWcDpiUUPvCNfrGxgk1GrsBybOcolFX0ntJBfKgXNSxxQuBkaK9oTaVBBmSA4i+ZmGbxZIJdBzQk3sp+/3kdwaaXcesif5icohE+wjZDqTic/CijPmHd0QlcU/uOJj68ENhTjlZIsCzck7eRQYxsFRX2KDm+v/k7Y5/2QEzFEH/1ucLBS0Tx8nrGZzIXNVDs9kS678b4uvZw9+iI/Sc95kQCBaUjRxqAzmTx5w9Bz4UxPAx/KtGQc2QJePZ6BaTBKvC0I0GyfN/44cUjLm7HW38eJgEAmezeJYLi/wk4zG141TBz7BI4aLK5Y3CmVRPly7RM///2EWVsDq3VAR7QHn1BSSk+5hzRCZEV15usletwtKGHS8OK6wl/djtReK7gQGSZcbL5tqjN0avUa/Nd9WtzO53ZBGooYG6GB1tWkblVGsy/pY8Ke4cnO/aafp4eLwcWz/hYKfBXijnYg9yhu048dsS6/DbHX4fHhSDFNmWAPZH/AnS5NiPoqVkh6GJrZ/ZlF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2211cace-7f9c-4511-cba9-08da02cbba1c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:25.1974 (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: Rsb4qk2mqjLZpBVose49+558WBa2gNHQ6saxzPIgsG718V5vp0Yr0tZIdUZNGv/hZkjCf3mV0IUKF1UafD2qMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 --- Change from v4 to v5 - none new patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 1 - include/linux/dma/edma.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 21c8c59e09c23..2c1c5fa4e9f28 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -225,7 +225,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, /* Data structure initialization */ chip->dev = dev; chip->id = pdev->devfn; - chip->irq = pdev->irq; chip->mf = vsec_data.mf; chip->nr_irqs = nr_irqs; 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 Thu Mar 10 19:24:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776868 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 2CEBDC433F5 for ; Thu, 10 Mar 2022 19:25:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343543AbiCJT0e (ORCPT ); Thu, 10 Mar 2022 14:26:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238418AbiCJT0d (ORCPT ); Thu, 10 Mar 2022 14:26:33 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2076.outbound.protection.outlook.com [40.107.21.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFC7136EEB; Thu, 10 Mar 2022 11:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZHQ9F7t1wxl/PdjbwiwMbPclntDtxgWtJ7B4NLC2+QigYx1EunZ/4Vec5cxd36+x5jeHBmK+8h7mBmDymD9cMCcLr4KHeJzaRnzG+91kc35KY7bfoSUcLcynTTwqfX9e3RzJFeAUqb16rrZnh7vxXQQiucko+QZGT7+lo5A7GSQoJu4QRFAQdsbxpb5ECQkJGcNnzX04KyDnWn50TWBqqpqEckmwwZp+iwV5TMNuv+XkIT0m4APmKXRXm/ojmVWv5Haru2/JtyF4oBYu/Bmo3YuoW5KbiKk3Mp3a1qGCJ1zY2mEyAWUddixniofgHgTH0AZsAwyKq5A04U2Os+Gziw== 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=WeasK1dTjuEvl76APKErmWDRMk5VOYUISu3D94dQ9Mc=; b=hreuAk6ZLwxjM3SATKmng6r5v71w4Qm2G4lEn4oey3I1Xn6rI+KrNeyS8686I+GRsdVVJEbcyyE4hjAk4/ZdZ4hL88oDzhHNX0r6gV1rtpuGoZ58gCZ0JeXkCbk6/TJGwBn3dska8wmXpSos5damQ/S16TLeqBPhf6akBxTF6CbvD8s+AbF/R1iTkAoQ6MWW4PzYI/oZ/o0JOl8Rne+I9yW8TSK1NLqDLZJoEdvMsk3YLvRRvB8/NnQBZ2dmYNq7Q5oDDcNQPR80UZ/T3nv+zQrTokPSWgeTGKQC1KLXoP+sYZk7USKpqYJUUJI4DJqpqVzEd1Ggd4LHCYK78e3rhA== 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=WeasK1dTjuEvl76APKErmWDRMk5VOYUISu3D94dQ9Mc=; b=r4K9VU0OU5wDlQD1AAgBieScelP58+1zPjWAN6W3LHaGfqoYTbYZaUec9sUOxBaGZo43l+rARl5L4dN6FwpI5tMvVZsOGp9C1wmmMSgT+c4veGV/hOqmdDyM4xOUug52xaV3AozUZAIJGSxM2cBxZplbBTSQQoUI7LviR3S8PUw= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:29 +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; Thu, 10 Mar 2022 19:25:29 +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 v5 3/9] dmaengine: dw-edma: change rg_region to reg_base in struct dw_edma_chip Date: Thu, 10 Mar 2022 13:24:51 -0600 Message-Id: <20220310192457.3090-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 8c4ba5ba-1160-4dc0-a8ac-08da02cbbc62 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: r/wsEt72sthr0kEsChO1puLwALKoPZ9yBK+lMe7ml5HmBxMeenwRZztQjxso1rqkhCV3iBW9Uobu1EGQ5LYe2EetTIeJT2AkH4bLiaE3KvIzFGRCzqQKQXEzXTIxEmiZ4p8UmdMEfnFMAxgPZ7yWqR1HbChmF+N3FN8LfF9S/SzovdRPLkDcA0LYDnwKJ+ic1LDyBitsRbsHJD3G2ahuPRNB3KdWO+cVxIC8FJsRu75LIcHAy64c74pa7+YnMwe7DOkNwzFQpdG+wOMeXKt6JdJbJ5Oe4D+NgNuR9u7RRZtQ8KgPtn82HunGPfn4HFphDoTypkh2NVFP5MK3ty9/Z5zgCWlXIw4WtnQYvFbMz80QdSJpXYIACv5pcM4YHwAiCyLjDZBkwBrCj7+jgExG2c9F/ANOYfoYb0yI09+WQWV0t3OoCEZKlJKHjojv3D15MNlHVrJYkDFggeDwf5tq8AfMsSNeJ8BouENEBPiRnjZRyDlgL2KQ6Eoyj6mf3XL2HbFHIANXA5HubQlJmnSkj5X7uw9orJRcpFqlqMmmhkIRqIjz/56vFYM2zHFF6srb8jI5QkXB75FtaYuq0Tt5yIQPE+80uM+4sx7c++PP6trEkBaGy1TYCoz5yZn8k91JBpvFiuCvJw7rrvXjvLltbD82dWAGK4hJs/GEFLpHnlvKc/4yxIW36BxJYup/8WBbS+FwnpZiM8GHFg597pG57Q== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MHf4UIDhfkUXnIf/5/MpdJY3eH0MGKXP3LUqNjzSQqi/Xog1/Ifig+Y/udauZn9bMMlGoBqqfneM/26N1vDQjJzUn05VEkqNkpgnsm2TsHAGyFrSSiKJ/HoJc0BMqEG92jNj+BK6KCV6rdZ5wcJBk2GSI2xHvRPq+EvA3IUJkpdR8nl69wE4wbL0FDrqXimVpRsNEbIlUqSYb1uYKO5c1U6EQJEvnlW8MsgU3Vw+fXvOWk4PWZsbZtUn49e/7OKDFzqzH6S4K1MspK6baCKDePJwJqDmJJkUBaQx/8tLyGyHaqAHQokKzPUhHHA5kaIh60nvLUEJ3NH7yJSHM2D3OfD+TPyBLK6rQfUpEDxLdNffNCw31wgpYFSy1QYBE81n32jqwOrfLMKj9uTaj+msRxEmY3PCnKXPIZcBa1YifirG0iVyxKOJlAds76b2nCaDVTnVUtQLV3WvshQmp23FapJJNBB33vmunS98JnfATSSjwci/U/JnSZ9dl7DZ/MVlExliIiZR9KUZ8eTGiraf1S8eLUQXKVi6+3pG9dB2XKLvbcBLJK11ZHbNPAykXojw8NtlsTnhQ3yWES9MbLKf7SrE8VQspp6jl9ObQx0m239e1y0fa9BNuf0m1HI98DdtB8cWMqjUjTvfyq2z7wMDNI5cLaxh0Ljk1f4MklfYi56/IgDoeVf04VzB63WYTqXIm9j/Bm51VymJeVFPyVl8bxNwb97X09TBdoizJYwIp9uIVgHDb8LaJ494hwccx1ryCGP1DYL8JLgosh2oAh4z3KGiOtvKLKXIb72uSyMeogOVol5eXj5xP9BmLOgXxgYmyQdK5hJtAnE6utPdzqgeRDi6ttwV+TnkvLo8UiXOKeYeZVogxmRNa7TPy1YUqlwUbK2hJA8pUMBQOueTmwJQc3ntxxXGc7iPQ+gXhUIQwLxVn+I2sfVXhU7ZtXetvH/XDEr8+VjzNRFVEV9qtWaVdMVZXdhC+TCeRaKPmx99qsfQGlXCQpMA/MsixUSAcFOEz5Aj0RD889ew88126elIseyAt5gzCGUvlE8lAcGp18LdSQf4plb9bm/hIW5/mWpdvUDlT+Mn1t8a5rT20Tqs2urBotymf43hhoedN2A03UbLgZKwA2noiZjYWVfrDUfL4kaOl4JU73y3hLTk0tggQOaBsxM2f5rQDkJSEOqmE3UaROgtn3JCXP7cS+DGkf5nJZ94d9RbhDHct1LpwafFctgD+6CviAAjgpyGjuasgjKiKFD6odtVz+S4T7rp50Ekeev2QMIVcEiRu8gTXazY+f3sSBq9mP2bqcFXai8HWaKGVaIOviA4wIIgzw7+kO3rlWRfy/kalq0lKOyE7TxU6wJWKFI1ou5XahllZfliJM9Ohj9FxqIJifYtJy4qyUG4Ut8BQsb2qaFWvFaYFImaCGkpFDO9zgiEed8DZP1lNKCaydOMidUoHyu/nk59KwRm X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4ba5ba-1160-4dc0-a8ac-08da02cbbc62 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:29.0107 (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: PaK6LiwCkM0Ahd6FvBJ0ux5c5Rsr2Oh9tHmq/G1SAo8z8o1PN1gSWCVDexUzXf1hobjw/gOTw0+2DvPZjGC45g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 --- No change since 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 Thu Mar 10 19:24:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776869 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 A11DEC433FE for ; Thu, 10 Mar 2022 19:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343546AbiCJT0h (ORCPT ); Thu, 10 Mar 2022 14:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238418AbiCJT0g (ORCPT ); Thu, 10 Mar 2022 14:26:36 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DA6A137032; Thu, 10 Mar 2022 11:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CH63z8r17hl6cHRRh77r6lE8zfiS+8+kiHO6WWfKADYYbjEoMlUO/OZsz1RQHfUBLHnyBT1Ij99Phst2lOh3JFiOk8DzoERn3Jo6GqEurftNGUpppFhNrMmrgaVPWxvT4c+dh+HBa8m9/fi8YNwfo9Z8Y6jORvodq4esrfCjPZckjzgoVyWVGSfCjHlpk8dr6T+bDSFGKCgJ4BH2hLCZBvEuJLC2xY7yzal8OOLv0tkaLHrA1ToCCe+Z/C30LvP12cLRQHn7fDEthLaBnRryOTEDfYm9zRDFeQISpDH5nKgV8Q+O1beiwIiffrRPchDQojxizAYkIIQ3xn7bmEjH7Q== 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=bBuf/46V/Ze9YP9pq6NwgXJ67ZwsOok+jFz0xvb5MZU=; b=cpSjcWVFafDwWEgxks+5ueY5jj4OSGfLDvmDip6rzqxFS9nI7Nw/e+euMfUvEewxjbBjaPZR5/aqv+H2ROwWeiq/jQt0T4DSzIMB2kWBz01ZQefAtGsBxzO0v3TMypXmf4ozwNst7gAqeuTk4cugdQusryfNl6clyKGtc3+l3FzQRxxaoF9+Ww/Q8r+l8jWnYWllWxmc1LsuV7gqzVKn8cOBRSBMcZDYOfVXQRjhvBVHoAVSbPXAzLs8RekylYX5vgXA+c5lOstZGiemMwezNG2CkZZn7rE+ZNfWog070RwAlFhbUqKq7to2lCAcpMxCeDh6QbPzbQk0DJfENhq7+g== 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=bBuf/46V/Ze9YP9pq6NwgXJ67ZwsOok+jFz0xvb5MZU=; b=DHuyjbLUJZYKm123b6DhAvHgPjhcnO9ShfgYZFaLdnDcpKfT4GXDpRrWwFz9EsLQGenXc60aATructGNAy7TBFxPDXzpVVZlTXN+Z760P9huZd19nSGcSkTiUIJZXlNezSPz+Mz0/ek25nR1HwdcnFyHszudTezieQwsKBdLsK8= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:32 +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; Thu, 10 Mar 2022 19:25:32 +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 v5 4/9] dmaengine: dw-edma: rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Thu, 10 Mar 2022 13:24:52 -0600 Message-Id: <20220310192457.3090-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 234e2d1f-0155-4765-41b1-08da02cbbe95 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: czuNe/ufirDy6fE0lov3Ia0+GaQnQQmPvI4d+eK4ndREkQb/mbgmeGJzs5pTDYILmwfokMN+h/a9k2ZEOum7xVvH1rgDCu2CsZtTb6M9m7/xFURuA+JcnCGtUR0fxVKJYYV3t1BRb/t0vjHvXqv7AMJo36IICi8UHufo5GaXQ6Uh4D96RJUie/l14jkT8wkpVqnFqPUdRpxYPDjJJyQcDEIS2RwAX9BzltIP5srmsexR0JcZiPsXReVlHORBfF/CHuB4ZNxezO99goAzof4HLFlBqmjFpwkfxnQ2o8BRPykwb94/ha1eotn8g8escPqeZ1GH4JpwO0xpquAA8ikZuH7dct7Mzz1UjcPXxMRZEQWxItrGDQlyI5KjfrExx/KukbjhwA+5BaFFAQKrXeMoNZx1zXuRkEOQoSKPXxp15yx/5wPipshOb39s1lHZMGPkGrxzP2G7MoI6URwZEHg0mwktPmbytQZ1I3ChReVJWXDBQGGC/muMfqB9i1bHg4IbahOP29Bh/YxofhZ0tKEM3gXFXR2ghYuDmCl/Tv9Q/5Jlx7SqgZMbbuy1gtYFiO/0ffFwUN5rWhJ9XAmrQEuaBl8cookzSTyKAve8qNI+rzJLCfjPEQnJbfJnhfKWZe+DMiRlNVa9ArVFkUB6nYfSgp+uPR9CIImYtMXWNjUjcu2G0Z+qaaxB5y92X5Pva1osPqT+fmGIy5H/TzAscjL/EQ== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iF2wepOsehL1gfziHmr8aFRapXaGDW9sEz0xFDTVf4jI4J4GeYB4em+ePbRZqSG7He+KJtzme13rK0ro1u9BlKU7x1n3sogejMPzs7GbNhS6twaPw4nxeLurPi+AWfz1er6BCu6x/JTLzyZ5YMlXx1Nw+zz6aS3a08UdfkT69CgCliCye87y8fjDNTGFwrp00NYdOk5TBX/Qi0aurY5+NjRHwLiRv43MmYAPl+B2DlHNDWinLkiWQwQFM1aIYrS990JMtCIhenyJH8b0lwh+reelKUrLfh6Q5ECkwGMvptsSNK5RDR+S/dHWbdK+V6iyIQBdDefzxqZi+z4+gtsXkna+1MzCOBKtqS0M+c0WJAw6ROgaN2iuBad3eciUGNWdSfuKPijZ8+kbniL9o/zmAznRleDPYi6BwKj5OctLAQofqfYsVYyXaXVeyGOgtedrpTryzdIKCWnYAFOcbiaP9d7oSbN7Xp4BiXvk5cbZCeywJ2zLtv+4ZugeE+5e4SO+SdhEZMEOOZcj9affJ+9VBa8vHPkgh2xAKM/YvrnKI2kQGnUJYmiyoFHY0hcxNPfwiUL4/aVP3vhfFuCBFs/4SdOnIwiFq5RDaP4ZcLBrTu9L5zJ+1HYbRcymtXKVhoP22b4fgR2NPW8QM1dCGl8BnzcHIi1AbscsN85qusonSjdWZ4ESVfxR4J5eMpQfwGQob4Tg9Yhjrat8Xmdty3ZRteX/JEPIQuom2OPbCstDup/8y0vpiINSRfbSAkvV5JfD8h+0dNRUgsvGgAbPtj62bev7mP+DzgTACxAWRkLGUHCKxvPoP1KFx1o6Rhw1nmtZj9TvB4iVbXoroDDQUwsbrNvp3To3YXPyv3mExz5ouBFCBxbjz+Cc6CjKAnZbn5JJyKIfREDiu+a2f2lRUYLsxEBBPXuUi8rx1/tDgJHVGA3k7d1KKDx2fGR4IfTZhTScTNlrTV0oHL8YfyHnnK2ckUvE+yZV1mV9pxTcHcOUxq2aIk8Ka9UXfEyN5D71CqUSCyIHSu7vDAf9K7DH6rBCwdJex1f3nGY3PXlEFkeMVpH01dW9aOHYA6dF7fcL4ZjI/UQ1pige0LU5IIya3V9gn2GxijhllQo5ILJh1Tv4yN+DK2K+Cpp2g8nkA9zHhiM1Fj15KlviB0I228A11h9ZT29KyoI+e92w4Ht8dWRuks4yh6bO52cCPXTR4PrPt7cZSwdlkk3568YGnm8v4VPZkpglmJndTqbrOKV8sprHFXj3lfU9fBL0TYt6X8UuKOLLKXzdZBdJx2Tz5q5ZpQT14oHRCxMRj2SQZ9QFyELynASC7gg6yp2Mny/zJqApHsXUGjrW+FPJRojA3Rck/fpw2kmck1TuplWWPFneNoxuPtx9HRQfdWZQVHuQtZSgRoHHpbYHSQzugjvkPbJTTwJvIxop+H/FtIQ+y5Jhj2gvdSro7xyxVtNAWrxjK4QEakuU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 234e2d1f-0155-4765-41b1-08da02cbbe95 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:32.6681 (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: BqihSayEvOVOIoXFe0jRV4LBUeK7l0y5rQPQYbzXylFMGjOLgJTPIAa4/SfkjclDZDIP4hgEkB8e9nm0yCgMBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 --- No change since 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 2503f1463f07c..3e4850cfa0b72 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -915,11 +915,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 Thu Mar 10 19:24:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776870 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 A7949C433FE for ; Thu, 10 Mar 2022 19:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343547AbiCJT0l (ORCPT ); Thu, 10 Mar 2022 14:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238418AbiCJT0k (ORCPT ); Thu, 10 Mar 2022 14:26:40 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2074.outbound.protection.outlook.com [40.107.21.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B7D14076D; Thu, 10 Mar 2022 11:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aqNfj9cukz/UR2/eyufOsdgsLWodow06TehV/IliKhDjKLhBUXeuV2LldgrA7AzTOI4+cYCGdef1gbhHcx9FwUJbaYFBpwH7eH6y/GOCSdGqWZw04A9nOyIhjbzUoQGIQuht+8RDcl13yll4YN4N79hgLWhum+4GX6aC5awWFat0+knLAgfCv2+PRnE83PIvBvY04hURlo8maVAxehjaIHujOB6PrfC40VEAA9HnLupviUpH/x3PaCeUbDBZdCDMBlsMnrX6iGMZ+6QEeWUpRKqThBA0bZ9J0abOszMFXX8vejTkCCB+S0K9LKsiogvn2ITvdJznHKuTLkQOGZicww== 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=HnEeUzvicxWIDQw6HTw0cOCQHwjUxaABrk38tzjF6x0=; b=gNaR26V7YGGD19AM0gZ+O8q7dh+Ar/uE7IjRgfXv/1tNkMwr4JyzQb6ZCRDo0dkfkLGmEgI8a3fzac5FwcoyraTl+kZb49rmB93DG1nqWXahNpuTINfpEkTZFRWM7XbQzL4TcyASlihvNBsI5GfTk14KVmHtLTstMeyv3o7h3QNQcCjpWQvraaBkb10eMIKzA8/iIpGzhS5vtDyDw65VMigsMPOHYzn+owrsINjPnqsViz/vQcsVS3cieaOGbPxfPiyUYOY61LfP+30GA2fvH8fNELU57GRqZk2DtceWz1FOjL95YpIL1tQrHOGyaxOaNOJX1cIsYt74uvWE94GMsA== 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=HnEeUzvicxWIDQw6HTw0cOCQHwjUxaABrk38tzjF6x0=; b=qQlR2jm9SZ0uNXwYRS+3drmgQQUWxp0TF8LFTj25gV6VVg2zQiMej+TsIy5fe0BnVrL8Q+ZYLiW8m2p8UqV5SV+oMpFWJ5THHNFkFPjuR7oCcRpOvFDD7of5+elhlqD+Mmz6F5dU50pXu0ApIU6sDXvW/L/7UWCrnmDB1RZr8o8= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25: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; Thu, 10 Mar 2022 19:25: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 v5 5/9] dmaengine: dw-edma: Fix programming the source & dest addresses for ep Date: Thu, 10 Mar 2022 13:24:53 -0600 Message-Id: <20220310192457.3090-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 0b5d1c7f-d82d-4082-cdc5-08da02cbc0c7 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: DvRqqigMmQga6ZK2EU7CILHxZXrm7fhDm1l508LDBnjfYG/741+CXMu67c6vLoETLMfdgQLYfV6kvkJHp4vfFR65v5nStKdMGUSqfF9pOAIXQiSVP3p0sZEZjRrQ1lHM11E68WQSKJfb+GT39YTe8/S/Bj5RsUn3JG+BWqKysQsW+icxQnos77ncTc9p/J+ZlWJbhFw9MX5tnUZr/z0b2vCQF4ieklI//LU9J0qTuoa78nQyZTsVQ22VlowTL0wdEQOaaFvxODsL8PSMIO3S08gAcAFNDIT03I3Bx75L6HeC7DYREuaivCa/GE7td0s18CBNzoU1MgLfNM+NhgSk1l0i5I34/Il5ljJlqBJddbZj37bfU5He6CTER0HWJU5mA+SrW3IAvJIu3AFIOKxg6tCM4x6AZVrgmyQ2buREMOM08D64/FnNLCp/r/rXnbKlSVlnAs+BQOQ5Wu+Q/2QQ/d60kuYuoMBgXXaIvKtUpHtOsoEH3UtrBgQfAez4OJVEIpmqGg/ImKiJyBjHHUOT3JbVe5GJfH3vwGof9Uiz38TEqZCHS9P36YlwL+RjuBKCwZzDRozP3sCRB9HTTO/CnSwFikv2u6Xy92/Fueljxre+QQSk5EFL+3+58d+VtO25OIPlyTl2s1I0im7UHdnZIAzZf+cFk2V4d5OAqpvO5Wz53YKSmuLflF1qBLpd4kvmslq1FDAfR3MT8bAzb7ia7A== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ojccBwwpTdqQUgZhGy15B2a4Wte5mI+uQcrtMRjEJvHW354/wLrOfgImMDBfDkqb1BRshYE+HSo9rEYbJfKVZAWHTIEhg0i70rCEHdYGii1ekQXJy/G9LZc9HDw1hx9CoR3ADZSXCwoOnbbpFM83rSRZ/b1i5K3NlGdvr+RWQSQF59hfZLFtV35xgUBYSMEFxWI4fTtfkY2G7hL3mKSF0GVBdqGSYiZHVh7DtycxPC/Az9PD+XrdvYnSb0/Az2hwwt44lXc8WQ8K9KWoxWEIBcKTLEE1OP6BXCHt0Y5CUq0Ufc87WJBINpykuNViWAMmqg67hhhj4OI+ceKb8Nn3QQ8kR6bf1HmNKaaO41mQEom1kU2645nuWMq2Nh3vCzg2Tbk/rukaePPOociTWqRHs2bmvExtA8L+0YNfjp03dz/pvC7Ke8sPoKE1OP++IpCUNtNg8KwCUgB83PktuyH3WEfhX8OQmzvEP148z9vGDAgLKHmIzGMffogwVDD++PPzH8DTyhl25AAn/6TbnDOy6KmS3MV7UFaJowoJTkorGsLJZ7BaDgKO/pe1J7WDMRN8izC8+yur2X4pq4ciDG32ylqJFBq9zzTUQdyGdred4dTC8C7un3i9luPkmSeaLm9EeLl8F0/aN3pxq11y2AEab6FJmzVZXWU3dPEefS7TnBzApPsT+lhMiuPXKUKuZ9z9gpuLrMQ6GEQQGLrQvk9RsanRjX+AstozVrDDsbS4/QL4dHIxb5M403bMb2xOLXEdU61am8IUhFcg4lxB/gt0huPEU4o7XIDnBrE55er5XEn9LsVuFFrMFMhdSq+DiEo+cGb4/kqrbcb6lUiunSwzSSaGLojax72n/4bVm+5ncJ+9V5aLYbOvL0l+or87eWE4orrUr1f3d0H5ZDp/no6sWuegqdJkbbLee/GITDgLUn1TyIYZzfmitGYJwbuUKHDjcEJEafN4NjGkIv240EUOVdZJWoX5YWkzsq0WBhj3vBZlgJQNhwkjlmM4u9+LcZg1ITWrOV9ANlFAb7oVouixZmkiX5+bGf/RZl8znVLijIcTlAVJUgE/qCSPyVAkkhP/aMpsODZsT/JuLgUVIAGyLVGmEwS58g+rj9qWFH0aUZuaHafSA9S1HSNxmtaNZBlf3E6o1QmC44k4Zez83rL5rcU8fp/qxZ7imX/Z40j+L2xUzgFsh0rYDUnIVOW3PuCqf7Cwb/02OfAGaorMBq/S0CsKZWM47KF5uS+bT7lNQDmRnWW7G1tE1fMrWcvNvIv6tgNZK3Cm/Yr4r7lPQ1DJTB+VkLYSccK4ndq5NoFmWH5bc9550YxXlv2FyOKbvlQ52IX/Jyw7qWRFtT5P+gQUmuGchiXW1C+/palLs2JWTxE9oPUrKJry8S/p6efbXrJ5kVVG+t7ul0AuuTFHvNLggB3jZy/4lECWxJgSnDVIOIq5pHuxOSOXfAHIm35AzgNH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5d1c7f-d82d-4082-cdc5-08da02cbc0c7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:36.3532 (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: p/c0czBXk5lS/3ITpI142adWdCFT7PZTxwWDH5lI2UCNJ/bxO2pOjsHxMhQTMhh6Jx8JrA/gCQHCWGkK7eY0pQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 --- 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 3e4850cfa0b72..924f220007362 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 Thu Mar 10 19:24:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776871 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 204BAC433EF for ; Thu, 10 Mar 2022 19:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343558AbiCJT0q (ORCPT ); Thu, 10 Mar 2022 14:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343549AbiCJT0n (ORCPT ); Thu, 10 Mar 2022 14:26:43 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0176136EEB; Thu, 10 Mar 2022 11:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jri4Nh2WkUlAmtUQId5S1jatGT/PuCUQs6VuGjge/YfqR5RlxvKK/B22q50u2iiv0OWkEV+YKdxj4oGBKAdHEF31U/K/5UYrSrfv4gZd0FqL9/5kBfEZv76VV2ViyS4luOsYg3yjzaUYj9TXJn+SaJO8/Frynp55sSZDgC+4thzlir2STPYMUG9jir5IWr4qh8hUdHYkK3Emq4LjX6w67tla4LEy1SGDTxFN3DfhXHBhGFIDA8LZTlqq9/v+/6q2DKOWWdL9yZv18q2itz3KvXG+PiEdnHAT3biOX8dAzjwN/bAHu5ep8tfH2g2y/qfjL2m/zfMxaNn2Bpje5IdLCg== 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=Hx76ESifDLtWBd/iZGEWlZtG4L9DEgCYhYL0APpe8PQ=; b=iQ/VFouLBjsLEWAfu0LSENwN5FrH5V79hnSykYLV2Xy3WFS1x3LTLSOX3wuC4HteGFOJrcW3JFXi2minffOOdNEmLjks3D9xDBxvHvHsP+ljlgfmMAL8dgq4HYRR/6bX+zBzR/vS43fGY3AkIcK8+VTIhdLXM5HI4s4mxoUZcu0MWTJC1c3nGWNywLSUF6ppiR3yhcRBPLttQIAQcEeF/pIc9huNSv2de3Dt0kSK40vfkBaLCg9+PDuLDOg7x6DI7gEipPEgj6vw9LpqrPSjUl4QDrQB9sOpAzdpiIlbgDWgdKaNEdVZ+FRVZM6gwUwre9yRaIGkYOc5TrSiJfLHXA== 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=Hx76ESifDLtWBd/iZGEWlZtG4L9DEgCYhYL0APpe8PQ=; b=DLDn7pYwyVmHKV21CMI8ja3dPKKAkRMO0CvOb+eovrkd62Jz5D5zEJz4bGSHwkxzjK8yt3BmU7iE8MDieHDh9REzm7HToPBRQAOmaO0oqLCgr097+bMqwXXtBD5aAjC7z6ET7P16EEoyAnSXuXxFg+kbeTwmV51Pw6GvjOBsouc= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25: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; Thu, 10 Mar 2022 19:25: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 v5 6/9] dmaengine: dw-edma: Don't rely on the deprecated "direction" member Date: Thu, 10 Mar 2022 13:24:54 -0600 Message-Id: <20220310192457.3090-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: 363b8a28-1320-4cf1-14aa-08da02cbc30e X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: Vf+29wNXrLaZ52zpWQLRArfsTPcsXPTKBwOPH+nKHmO/P1JhTKAMawzudBVw6sv3Bc/8QJIbdo1n+/Hckm2MVLv6wTT+GJRPGhOf5Ug6dTxDnyYuafsi2fgr7QzUbdujVqQqJXNaAQ0HbS/5MFXvb5pQD2XmMqR96qYibX8LJ+vdYZUgp/sQs4nqlAMZPodu7bC27W6nZaRhsL3xXq3FN5V5bcjX2JGPowvq5+nd+mlzSDs3CNazyDNHG15f45we9HVZaRyWvO4+kI59UQK65j4V60rKuaomGcxpxWn1/hiyp+adgCacrm694KEus4jWvGB9u/A5sqFM8rUbDKsl7ytV33tN3tR8aYnyQkDG5H9/IDqdJz/IMQwwbArT8+5GVqNjrIUULsQO/lOsCez9L9zKnw98VDnqIK4oIUaS4mB0S8tNGvJJ5YfF7r3kOFNMBuXhuWac3fGZAxqrX0pBvY6TpyNPZn2WrwEZTcKAyXfHXUq+ZmnRtLMO8oIBO6kJTFgxydpeTTBxU5F0oShhROkLUmj8U4hOfM/11OaHATixl4jbH9LlEdQ4xg9U6+Ufww1iwm9QwQuxUWum+GVQRuwX00j9zfRoB7a6sYAwlSE1mTUAva6gpY/jwtnsCI2EimLsB3NKdPdE8YG2PWbdHajEHxAQ/T6eF6jpGxyx6iCBTLM3jAj8/K1LOQQ4QcV2j9ECOXry21V+SlIQCpBM4g== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /rsn9yJBVIi1Ae23TUijrMkUYF2hapG6ZwPRHSKpP6uPkWXiv/ukzIuKX+AZloe9jJn6Y0ehKkj7iu5oD0aK2mHi16c1Jt1UgQQFdq3t1ligxbQSdJYFt2AHn/3t+ImmEKL2tqsQ2+ydDcBmifBqfz4rh/wOLeWbzH+FfzEw5slid+2ztNgmVcos7Hu5GckXIJhlzMYFwwJv65ZCqCUieGRanOj/QR+i6TUx09mNFgEMlOrDc+Csol6zOQ427DuH7QUzU73Q4dQ4XynQCZ/GNWw9ImU6PP+D9vamTIuKORmjRrWxzAgEWhXaXwUC4jniN1kl8KP3Kgdgo5K+F6Ph55Ie9aRHfagHSFuCjtqMZh3rj9ZxLqJBvynLjmi63od8g+/rPRkuMMVnDt1XypaUvAJ1dkkmXDh8O1bH5FlwxJZtILuguumrU12uITvvAAIugntk/YyhWahE9WQBabdRWAco5twHrWv7p4oVANYBg/kywCmwkKvyqvQy2clfntKu0gvcl0HPnD8VipFXK6XL//fGvP6VXDjoIMMaplme6Ur/Wxypy3jg6naAH7RyVGFK1P3CAWaPqAOy6JjxhgSaaZvzBvpOU4NGLrtt7xm2+obRaVYhXOmVAeWc0QQSFGAqvwQ/P2f5wSynR6rwNR9dx4hFyQfnPaHcQeR2AiH62FwlexlaDBZTJhwZUh4jO4kDAKB5+FZAh/Kqdt3B+SYaVjWMLSxXGrqa/djppXUvom2ZpLSLVhTumS9EFuea8HVYVNtP07BPFQucKhYW/H0QZFQbsVC1qQzKG/IIQ6fhBJaJNQSvV1hXtaa9rNhIixyodm1Gw7mm+Q75rmZ4a6TiQ0hjdQxii3Ebyse6YTu/gLrht8XePYWD9mULOaRwqMpYfh/DmOdM86EvZQOn0oDcR3IB4cZiky5Xj6HaKF82vyZyBr4W7T5IvrTG8ixuWYf6HgPMLLcfBVK8YKL8mLAApQrw4eT1tNC6L7u+73oThhb++4+FTVlZHRmqo71Y8EQl6uD3nCahVTTtjsILfqPLGTpRBlJ/v2An294/rD+833bgzbVPqyHOGi/2flAeg9fydodJKCNbJYfQQHMRNTMql7Aee/JI6xtcrBYvaueJf9czg2X7HcFwjFeIijz3T1WjwBhvvmxvgldpDrcJECABOnBI9CZ++QcpuB0+P2DSHflaXWstVlmoDz+gnQ2cNgcCC+jtXONDjRRtHgFyMJwbKxv3zZZLeWvFfQbG6VctgALLP071aHd3ZQal7ifZ5jmqUwUXhxQ9BJUZLLWV+1O2DNtg8Ozd0omYynTFPTNcNQ4+N3obNF71fLZw30fPx+uHNmJeyZOkDgErrkHi8nLXnzzbPemH0fV+7DErBQokGw5c0/wbW4Z4RJiL3/gALh5pHs66kkIlm44ujh9x9X1UEbm+WOsVkvxAURL48Y7cbp+032NkXWhY3vkTY4c3mY5K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 363b8a28-1320-4cf1-14aa-08da02cbc30e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:40.2787 (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: BX5AydNa0lkDHHT9mozZ1Z1/yhg0NHTCYnj6fBFY/WSryen+GeOGOhxuDR4gWsEMau14FcGjyQl7UpazWROTgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 --- 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 924f220007362..156255ce7744e 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 Thu Mar 10 19:24:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776872 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 AB5A9C433FE for ; Thu, 10 Mar 2022 19:25:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343554AbiCJT0s (ORCPT ); Thu, 10 Mar 2022 14:26:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343549AbiCJT0r (ORCPT ); Thu, 10 Mar 2022 14:26:47 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2056.outbound.protection.outlook.com [40.107.22.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F853136EEB; Thu, 10 Mar 2022 11:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKTdoD2dM0ItKzgUrfgdDeQKWLFlkiBFaT1wlesLRO9NfchT7D/vk1vgyTCty36kSpfQV5fey6YUlthi2Jn1/Au5TYMGMBkVXeIacCKPo+xIUkUlvKNsCqpNt46L9bgEe7HwvNaFjy3RTIDKvfzeogRgDHCTrR8wGPpyn2iJ7R9r/PaouOzhxMC/fRmGnkcAj51lfVcLJ3HKqYxUMaBklLNdf+YmvQlKCeoUVJcMKRTWTyvso18/bTmFu6cSGMkCwvLLJvcssHb/s24HNBJXRcV5ysP3lLn3rUpq2leX79vRPRuoG5yEs2Eziyhoe3oLoI65J+hBoyUe74rxSmk1nQ== 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=m65v4UP7o2Ej1q3jDJdrf7FtoXo4JVDfG1MASIb78/g=; b=bKVeW3R7Zt3DKSuDqKToLu532rLrV6zO3vX0eZvuLaV+5TiCUPBu4iLQU0fyQimk8f3LQJ+XVcHvUR2yiBwdOeI1wu5TJpGHTi2nF/pwupxZag6lMi0jwV5ep6kAEpK16bJG/c6gek167nGlW/Nt3QcPadLb0/uYorsjl15zpD9+BsqGTidfHk4uhMZPUN1RbOhhSfFfGPoSFJDtc3qcanusywpeB4D6oYZNyGEhg4Blps7IQpRTZlKnAQ0eCluNK0XC8q7cHa+iK5dvUlp21P/covvJFMpHLiL5MNhCw1/UEHYtUclTQzHuZZXu+w3PNezWjmaH/dMH3aS3u1no+A== 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=m65v4UP7o2Ej1q3jDJdrf7FtoXo4JVDfG1MASIb78/g=; b=rPqCV2VXeZnB1h8R+MrVlvabGFBp1LyLCjZ+URaZH7+W6QC4/QD8FZurHg6OhGxTbeY/QmHn/qa5Wk0S33iQs9eijJfl4mviqTg8/9N1qopu3S3umtmzlgAlWHsT4NkaeDWwk2LLtlRLjLUBGY2AUlWNLmpn/peiuZD6MZdfEXg= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25: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; Thu, 10 Mar 2022 19:25: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 v5 7/9] dmaengine: dw-edma: Add support for chip specific flags Date: Thu, 10 Mar 2022 13:24:55 -0600 Message-Id: <20220310192457.3090-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: ab0062ed-a6c1-4b62-959e-08da02cbc552 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: CN7+8duKIUW9uySAES7asFD92fxfAJON5onGLplN+l+vFJivaW2kZ3TV/EhThAeodV8kRlVTNz6bXTgt+PZioM7T0wc1FSYwiSU1WLryE4XScsSq135m5bnsC92tvn/spD5lHp8H+uDIa4tEJYJdEFULgQzrSsIAoAdWMVTFbrL0cUWqBjZ9uv6lYhnabagyy5Shy97/pcMPNWfznLtOQO2Kx+ZLEnPUrz2orqVoAgBYAgb9q3V/2d6KeBoPcnCiO533mVHpwuXNxFDLW59SNLiFHbI9rX+gnLFvnAw7P/QL6h8oRM6Ekx9LYN96ZDvhn5NRqb/s5wpA4e8ATnMJXou6g3VGuPxBNhmNjS96oVx9nbEd+IhxzHs6/lLqYGAwHc1j0h/+X581REiFUySKqdrFoYpeNssLijZOhX75E9cULxgnZMatSFcBxgRu4wQk7eV7nEIMmlmviW3UZIUlWT+6EngrDe0UMNRUQ6iuYVIgIJCUKJE/XKPvqniKk10n8qStTAGx+1oDoBenQEWgdORXU3HzaInNGMu3obbOf69jzvp/W0Avut4UiwuKGwSZBABUOAQ304aBmyJ3dkNkLlMzwPw3zp5gBwVez7NQveUn8JdpT4dWxn/upk+dnhq5yO6rQJ3T7vOuQ6kbaf60W5jqDw2R2t4FqEn4j2a14GCiLv5qX7OknhKn1ygTqsngmPb/tjcHPzY1GU39dg95ag== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TY1zNgNN8ci6CfXRg3kkxhbRjIPpDV3kfwfW8MIwLIlKM3wK9wPcOe0dP12nxxAoo76y5Xh5DEwmUcG+RPpBzqt2QwaUlNA8Suy3uJ4vXQwYGLiNwpv/olGuzjUdh5zGJFASAXTtLxPlV1iW/KK4j0FeU5d/w7Ovdghiy1slQNkVRNNg90F9OZFdBhJYr0y75ihBEmXXodxt1hXabUHiAGrnI/PCLCsH8mX2/9IoUY4kB4CrJtCmsGklG+6g0JPL7SfJoEk6LXWYQRl06aIkHsYjOHOtI6xy4pwnFtFnlmSQZHv65H4WeWpd304saGhqOdSPuTtGmxSOTu0EhMS7KwVqR09pTcYK/NYWpBcO9S3qapqfUVOkDW/IDqWSkNp75iyGP43XY7FvwWGhoiw60byKD85Hsmu106CU3w9/wjh5lno13YbKLEcWj9s+FP1kQHzSFoNOAJEG8+j91fPjpQN9hgC0D4VfTW1IlDpnI4bvi/Woq9HHxpeUw0thaJT7jlg+c1ogIJomqnwKtirUC0BVbOsAA7K0whNaxTVaHgv2nd1xCgAaszHHBOxQo6H0ph7fDnsJu2jHR9X9DCpEIEjvrCuQbDNV4qFjLY/VJ883fzuy7INXR8fTxSs5hmyiJvHmehg04AWLo222AmjKjTNET5njSROZsI0QqFkqGkwod3fERIlvMomttQgys5h3LbSsUfhynGuQIpxvtPKvb5cBWgR4DVVAXdmTFV6xm8mKm2ZpyOlk21HgADdgEWNnbselxIJvpE7hqkBuV4hjkW1e7b1DKzMAreMBHN8DFGOpBOZ0swO0FbVWcHIrpfUjRXCTLREdZFqkGfhtR6HeHDjEpY6xIIbmR4A3khL3N5JfKO3HQhQBqUkwMaH3uznaoC1ixXCop6v1VT8besBnFC/sJiLYP4WY+IZc6VDNc1vXmAHUdK+/5YdB5PgOAxbr8MOE9DmEalg2uVoCoem8yLe0DaLbPvuZF/6Og/UkGjRqbg++6RuNY8OBa2vC0AxbVhEwa58qtV2+hZM1nc6vAoNbFiUsUw3rNIZzqA77Pr7nQg3qPNykNWuC3pJYcjYTnpZZDJ+LHZarYStxn4szxOlotlJ/d1mTKcjZj07KasCFwCQi6T2zeogoz+AUIEOrfMPFQ6jRmfeSh2e4xGBsN8njP8Ehbkd6mcnHUI0mZsleTRr0mVwdg7OER6n623I+M2ANG0uyHLYtN0CnmTr9dN/nCAPEgz5UDebmxMaRs6pzTHT8pTADSLttQDkv2ubcBZ57VNjaOCnGvHbNoeW+FK87+7GdY/zY/hBMcJwhrlslldon2bVxPzRIqaIZ7yLiRO1GkixO5xsoOfoOkBmMIrrePPhsCutT9hv8BizksFVp71gn8wcOYMOIJy68XbYPe1kNy5ap9JUggymCcSQQUTFAhyreHY18U2i6F75nm04NHb2nGdhzz+bRsi/j7rOf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab0062ed-a6c1-4b62-959e-08da02cbc552 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:43.9892 (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: 3ikzgrxycx+L5fSOmI80bsEI/JUzC9AW2VmEDvmMz5zuMp+femHmb6NEjQZwHvY6l3DMEOJkVbsjLbmiVoMwfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Add a "flags" field to the "struct dw_edma_chip" so that the controller drivers can pass flags that are relevant to the platform. DW_EDMA_CHIP_LOCAL - Used by the controller drivers accessing eDMA locally. Local eDMA access doesn't require generating MSIs to the remote. Signed-off-by: Frank Li --- Change from v4 to v5 - split two two patch - rework commit message 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 | 9 ++++++--- include/linux/dma/edma.h | 5 +++++ 2 files changed, 11 insertions(+), 3 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..30686bfe1790c 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 */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index c2039246fc08c..5816c8bdf9a64 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -33,12 +33,16 @@ 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) + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @flags - DW_EDMA_CHIP_LOCAL * @reg_base DMA register base address * @ll_wr_cnt DMA write link list number * @ll_rd_cnt DMA read link list number @@ -53,6 +57,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 Thu Mar 10 19:24:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12776873 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 2F9DAC433EF for ; Thu, 10 Mar 2022 19:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244083AbiCJT0w (ORCPT ); Thu, 10 Mar 2022 14:26:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343549AbiCJT0v (ORCPT ); Thu, 10 Mar 2022 14:26:51 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2085.outbound.protection.outlook.com [40.107.22.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173A913FAEA; Thu, 10 Mar 2022 11:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k9KZJ8UG2yLGjtsWeHJDVMor16tkNFmh6/Ta8O8deRmaWJ849I2azMZ1qmmW1nWsNYIRSFe1O+trdotBTUR2U+R5CbvJNeXvpmpaS/MvvDzNxRu8Xxz5FVllLjyU9STCTsb8+VP/Q4Xbk9bDUoyaZjsf/WSlzL3Vl6XVVURfPAX+OZd16l8bb7U6KzMkvwIVgZS15TsTbT4m+MtJgSgnzpIAj+MzoK7fM4/oCSRvMtGm1PWdr/ci7c69a86y0iCS/VL+mRyTv6LZDIzXM/AkbxuDsUueMs2ANZxXWpOM/SkpZfqEpYPiokkepX5ChYqN4V106lb0gV89tInDCEFbQg== 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=MlVD9Tyh91tkr2rqYUEdNCSzxssBGww7nDgILoKvLKw=; b=Fl7AGeTsT1jLsM9ymeDAJj/2xeq/Qwpfs8MOMP3+ZpBsUmISq8nsAc69TfAams0DOw2/7UAnzDLnSBkI1cLeVgSnHg5DvYrn8b8uUGWa074Jee5+NoUSiAq6wao4lkxlmbKQ11/k8Ysf8Re4SRITPeWzXECyQpPORwu3gvG4P+LLL5vEwsFnu+90JwxWOJIPBacsQLvus5wumGzMMmXpkvvQEU5KD6sLNb2pg6XYOXO60N50jGEYa9N2UhlUcagIU242tbTmUyLY12hOxBETtWmc6Iapbcfoz/UTW0Z+UkZaMim5BWF8ykZr90nN5x0uYWeBhh2GYsdMfW6x/pO52Q== 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=MlVD9Tyh91tkr2rqYUEdNCSzxssBGww7nDgILoKvLKw=; b=UQIBOpn0QnvUsdQFrnoRKTDj3MDI0zw8RrcoK1zTlw6/GWOjMNMCjxGxMv/D+T9j8LElGs8YMppGCyU2FG+wOwQN/JbQpzE4IMXyVY8QBHtB2RpsvPjMroBTmf2EJQEsdCTVmFFG4Z77ymE3XNEr6aiC6mrUssD5+UZUHtTho00= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:47 +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; Thu, 10 Mar 2022 19:25:47 +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 v5 8/9] dmaengine: dw-edma: Add DW_EDMA_CHIP_32BIT_DBI for chip specific flags Date: Thu, 10 Mar 2022 13:24:56 -0600 Message-Id: <20220310192457.3090-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: d09d442e-d634-4589-63da-08da02cbc785 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: wjhH2ln/rmHBBfe+2QXo00a4IeoHk9m3f8vz/u3NbzE/uM1PeVFyxxwN4tfP3irOkc9xtcI/MjF3RyDSCXNMZoBICqXsEoqVxEhbviL2PNk9i03N/5POkpnOvmQ/D6z4f3Y1iakyl2WQ5p78aP0EVydWN/+pZCTVBgp+DGpAS/43BocNuINJ6cRVkMqAfQyt5ZaNSWvHq/JiwGshxfi4aJX5Y9/3ctivJULj3/4q3iyiQX7ri/Hf2AbD4dHEEqcQzQ1xjPDxI1y3OqUES40t/tQEGbE4DHN7/UonrQVUgeOU2qag9IZ21XBBuIu52lm6HG0g2SsZylRsX+b+1P6ucPTJKxROf62wmuiGCdn2/Olda0XZF0qBuxuMDDVN66fg97HTaz38T+245my9lIbWY9qAgJNMZJRvg5iGfCg4pvvGCskKtfjEY4ZZOi66uo1RxIFjQwQtZVnbI4c6n2PvUEk36V4FntxmYazHM+RyWfQzJOxwZinDp8mdKrNqXDx72NkUQw5YganAVQAjpfRh5cxD8aUSbmncqRi9M5iLUmwKeTl4qbIBMWhQCuwRL1bgWIRVzD/pkW8uHhEozoqgbB7az2a7LszAZJwZ1IxUnDeC66CtRn7chBX6MJuNABV9LqdtdNqasygMSe2sNCvzOgUpVT59c74Bjnzw33raIhtqBk6PRD/I7gSaT/wZBC4F 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(6666004)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3t7VxpG/FEdsIlEjXovMisiJmap5wIqkuw7JlRRdXvaIO7ECeL+VkxsMDkHjV0a4dJaKychgsGSm/EpgQCrEFUgD1bA8XTB1XrMZoedSG8ngWDKWNknZRfEv2uhy3b5wISwohV6mutukbrZFVv6z6/D3TlEvgwHW0a74lilmBGPJ6mRkyPWpRuLKo/8gn5CWQAaHFCix0RbpUVJervL8h1xo6mxjYXWvnq6lXQUoKAzdQ2tJGGPUrMyzuhB5Ttp8m0p3pnUqgZGy8RVNiV2WsHor8dRh/pETGkZ6Vp3RYD/XbBuPYfYIIlYkNxECK+SD7Wc4cn7GZCCb/T0Smlmfu5HJl3FL8mvIu35YArBlAKMdPFAwFd5MWIJYrtrTdKuowo+433+HS92pfoR6CYeyR+n+xMm4ur8b2x6JhW+wWA2/L5rZEWKoA+ndsj31v0Vxqh6l3WhzFJGczuGhnkKfuK+t0eYeJcvNwzmam+MEUKDrVGCZBr25p42g6HjLwzDcS5eJnTwO7djHq6Y8UB5R60vhbNO0RGVuFqZOmPH39G05Bnnj08Wm5hExYFN9G/+7Wgai6h/mBhQbkB433kgFvqkC1X/LJIdVP/5xDAVPPadhT37VAgTOufUX+0vK3c6YEMn7DXwQU8TED9zHp2Rz8ssAQid1FxadUhcLI1+muJSqNr36NR4jxVLv/yuJcBwVrLtGMQ9m/qF4zFATtBzWje4nWTqZGlxODaFPGJuP7V/GNciSkkQ06nccEV7w84LUozREag4MUB/DZ8FvyS1TIxgXqSkOfCJmwDimWt6B2uLQ0rZjJuntV05wnahQDSBRkd7se3wf24+h9+DAN+gYo+GZR+22mLDodXAWW6lx+zQOpo7gXTNj1uzv6Jty1RSzl6erl8mttAbi+yAjcHuMsq13jsJRzc07a7S9JGUa850TJdCMEKoM1+ZpF/lFfLnl0b5FkQfsvEQRxF10tonPWmwDZqdmbA+69lu6EMwTYU5JLOtYGvXwfhQI50poG0KVhG4I4JkipBrSqc2Y7ryvKqdMgBrF0S/0hgAkjgReolJy2dw8Re8/c8lOuYl7Y8wQm4AOyBJ7TtBPgSO7GL8mJNDu7T0ypbEt41duhUt45Xd3N7XpKFWEXZeckr97+Rb3Imr9T+Tz2zFvxEJi5SbGf0+Zq9QECT/wmbXqtbqUdAShAARnYgB2siy3MMrZ7+2JFBYmBvrzl4bnqMVGHqcgqvA/juMZ9L+Bc9CEh/6SWoZryTtO1uIkdNSnMaFhBdwHG8aBzhMMop7zk5929EFVT4IcvgMksgK5c2pPHoR7IZANm9R9bDFXQGCsZjcUOw1NRIVD9AA3tF599dm9Ypib/iM46mDefqKJF3Gp9/x+KwMtXuOUWi5UmsCR+D//8JwWBibMJ6DbJ+ub2ctuD18/s7dk4SAjKVTZ+kFR2WkzAhRQkyjKc+7L7E/ae8nV7sK5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d09d442e-d634-4589-63da-08da02cbc785 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:47.6776 (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: truE+xvouu6XUQrZIBsIz9feCscm629v+E9O+0kF/J/CMSDzd9uJzaioYtteqtfPecFodzX+jOo8I7a0ENRHRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org DW_EDMA_CHIP_32BIT_DBI was used by the controller drivers like i.MX8 that allows only 32bit access to the DBI region. Signed-off-by: Frank Li --- New patch at v5 - fix kernel test robot build error drivers/dma/dw-edma/dw-edma-v0-core.c | 13 ++++++++----- include/linux/dma/edma.h | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 30686bfe1790c..013d9a9cb991e 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -417,15 +417,18 @@ 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 { + #ifdef CONFIG_64BIT + SET_CH_64(dw, chan->dir, chan->id, llp.reg, + chunk->ll_region.paddr); + #endif + } } /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 5816c8bdf9a64..8897f8a79b521 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -36,6 +36,9 @@ enum dw_edma_map_format { /* 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 @@ -43,6 +46,7 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @flags - DW_EDMA_CHIP_LOCAL + * - DW_EDMA_CHIP_32BIT_DBI * @reg_base DMA register base address * @ll_wr_cnt DMA write link list number * @ll_rd_cnt DMA read link list number From patchwork Thu Mar 10 19:24: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: 12776874 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 8B60AC433F5 for ; Thu, 10 Mar 2022 19:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343549AbiCJT04 (ORCPT ); Thu, 10 Mar 2022 14:26:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237730AbiCJT0z (ORCPT ); Thu, 10 Mar 2022 14:26:55 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2049.outbound.protection.outlook.com [40.107.21.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C20D137032; Thu, 10 Mar 2022 11:25:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZrwJe/GWCEWTRA7Jm6kJdI/jAB7ajon6EEw1shr9EHvs0nv+iMSFCZtF/LfgNtKpyL9JKdxW5F5KT0S3ezo+IHTk+cyKS3UgCEjO6RLoLJJf9Mw25/WmxSlkm5+cEF6slQcM4fgJA1gZK3wXdSKG+MhYHKlrVnAV7gIgxvGfycAD9r75IS9Q6uYTMNlSInk0Vdtlk/D+j77A+rY58DLp1yh9zgOOv9Xn6t3lsyePz8LSPPy/E1ZlzEaoHE8YQpoRi3D0UHUTy+vvNIoNJZ8ilzwy6kHzDvYk5si1KcLzFJvChn6k8Gr47N5sfjYZGrcWI/uOjFTut7QPg1xQmPUMbQ== 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=0bzfzJG5ma+hOdOIf/GOHIp/ZCbgsvfSgRFHi0BBcoU=; b=MCnF35Sw/DqKsmusi+OznCpSjdhFKWLdLWc0vIAO++Wd6pMGTY6Fww2N8cj8Da7iG1Iev87EIDJURAXpa93yHx6KdizVj0WBRFwsKAtkUthkGrR5q0YpnsDAn0dU227xhNrVZxQfWTivV9KRRK7RmiwyyNo1GTipqKGtb8Joj6Bx93XMnH814dO/4XbWPeBCgbusUb62Lu1DuS/uFqe9XZhxw2WR5Pd8EoOxl9/t/at6mAlUwDbcetfF8DsojIbG1hrzigQrxVCSpoMe3q3Eak9+0YsIR7ha9KpUcF883E5uPBpeWzP+UkGosfzh7bX8sGDlrOWm6zGb4j0AlZrq4g== 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=0bzfzJG5ma+hOdOIf/GOHIp/ZCbgsvfSgRFHi0BBcoU=; b=Gfe/WrVF0hf+cCNUjJ7lwBJbfb/6dkZMOvGSmQ3dn9JTILVe5ED5czgogMznGfc7Sq+1tDZuKVv8qkSPK6D9we3BnIE4iDDkXXfzSo3Mo7rK8xkMqPE4WwLquHwCsWgdwnHJeWCAMvbaYIQ4zUb/lfUH8xUvqbCzeI03EWi5bG0= 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 DB7PR04MB4858.eurprd04.prod.outlook.com (2603:10a6:10:1b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:25:51 +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; Thu, 10 Mar 2022 19:25:51 +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 v5 9/9] PCI: endpoint: functions/pci-epf-test: Support PCI controller DMA Date: Thu, 10 Mar 2022 13:24:57 -0600 Message-Id: <20220310192457.3090-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20220310192457.3090-1-Frank.Li@nxp.com> References: <20220310192457.3090-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0051.namprd05.prod.outlook.com (2603:10b6:a03:33f::26) 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: c3369698-1a78-4bd3-2d15-08da02cbc9b8 X-MS-TrafficTypeDiagnostic: DB7PR04MB4858: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: b5T/atPdeIYi36gcE8duTVX8Sb+wusMknjx717E8HGDklZwM6HmIjcElRtlifgXBnVD69s+6jKbjy+he/tMBrH/P2NGWexKVMXKHLqsiP3F5DvviJGbm4WlguFgeUFDy1t2w5wFgEP5d8yQm18m08i4MIrNGk2+Cyql4WLWp4wfDqQes+Hh3ZRb8yQNBzYvMciiOXpCyl/BEdsaHVQuJrVBAk78HiAGU2Y8GCePBzQGY39SvpzcTWfhv5dGFK/hAc8FwYlK8ycUKJaahbUwg3c0KQrskCX/w5nn/uyQJq94q8wOstY64j4+gp4jh+l4WG6yeW9vMs+f5KpkEt+ntB3JlVOZ7xepV8fkIAGnLZ8765SkKQQelaYpQ5bmjPHQNiHTMyRwslMBpmtSYlgY4ZrUTktLJoosLJsezm+V5Ra6inv35p2/yWqi/KRQXqMDid/HdrLbZdEigFXKxQaWvj7elMYiM5ONlTJOm73F6awjDxmj6KvVgmWs57g6aF2Xy0wgHI+ID0OCVX5EYv88nmxUfoP4YS5Us1ovd2NYJpmoWJoYmWRA6QJNB8ao700F9WuT80ztUje3QhDPsHm4Bg2E/lAsVAIH6YEga+1Pg8oL2JHW9R25Sffq94L8otbh+4IL4I6dzSj6KkDzxUpPqsowN5Cdbw2BTdSzqh0fWlWEkAVU7dMEcgwgkEGieZytDAA6QIOSb/qmXCBZtLEwfIA== 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)(1076003)(7416002)(6506007)(6512007)(36756003)(186003)(5660300002)(66476007)(52116002)(2906002)(2616005)(86362001)(4326008)(8676002)(66556008)(83380400001)(26005)(66946007)(8936002)(38350700002)(6486002)(498600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7sIjDg8S3u/DPFtO2nbi5A62ZM68pkcbuibK72C4Z/ZDI65TB04ESsLPOpjbv3BrXIl/uejwn57l78SEkpcA+wlHg608F1xAXVF1i9GUpyiuFu75/DK46fjiWtJFF17UzZgbsyXwLnlDrfmlseKU0NaaM/Vzbe7ivrHwJ0AWhAoWnQbkM8yxt4BTdPi71lga6BHmjQNbiox+XNrm0SzvAXDzt2iYHSFHs6sc/ljJR/l9ltyazGwvh1o3l/bfUQq5mp1qNkeTlnJZmzLqelullSygK2eUo4N3Sz2JZESxXs018pcf6xdFkFv87fl+0zjCjPcnriRgFV+aUK8FIGwA7bmldUpXP/YQelMKo6DJqL27w9cH2pXBljqDTR/vMy+oqykkoDRdG6NyM5Dyhe6Qekx+wnJgMkCMUvlLzvtHOu+Ac0J1VTA5ZkqXOAfa8xJ525wYJsvEhDNNQMH/WXUATTeFxe7mboM1iAtEDWvMVy7a0TFW6ZXs+ZZ3FGs4SugZaP3HH+yIX88RtrRtesbMPGZhAc+jZ9icrIwothtthsZPmc378Q0rkZgD+SeVE8t8+oAwLUY+DSSlkCfOqcjBNH6wS1qW/he1qDQmJdaxlIZnbIrx6eNf/dDDFWWsQlSG1nc8Eo9YuUeqfplQR1sjxhLbriP/1H1naWhrATMyi2/J5+MeUfr02/bQTrECgtKLNccYXAgu30C4g1h7pTrcb8yh2bjwz/2aTrmoHGEgP2uzYJh9dEjQnneUKbkxdXzCb8lQ5Rbgl/6H/ccC79eXorVJh6GX56iZArxCow0PIuvwe2JLC3ySB20W4WMd4ZtkhJ5+e2nO1aWfs2J3p0McJvXULrFF8dBTMVqMwsqmlTMnXSWzT8k869Ws8gcE0iNJCzZw6roRvPdnKcmmGBJuYgCCm3/G1xjb9btymmzpwk6wItYqWASUSWjSFMV5lse3m2Z4kRC1tC2YFs87QSajlayVtMtM2tuO71yhZk1Yeb5H05YNqA1NHze4ozVnWWSRLUAtRKs3XgNNoCPCvfNTwJfyT7+8ErcBS1YVGEelaKxk13gEaidxDCfHiyHX2Q08/4seVU+CSS5LuXzcV38avDOqdrr5qog8MuBOl9EnsGQnAYv8rWAA/iX+YNCE/hyZtJ29gl7otGyliAet0y4G8NINTIMwlP7ZRXtFu2WYQ7OoTAJlbdjs+cGqGcIpTFeEuT2J3oZaibgxOKV4r45bBypbUKp8vZcU3fsuggcqwe8Cher2sOctevwReuwQ1H0IHkmVLFT4tuNrSd+nhEqA3/Jhaa/M6hBwZ+IqwOuHryfCDkiIwA/7iXuc36s0tWd/3+rDHGvRiByrLiaA+FAffbtgYnccp6290+DlZaen1tcr4MiShy/5vp5hKdRLWD577d0iY4jgA8djJ2GTOQdV0XrRhLDHTT5x9+4F3Kj7xpsBI1Qat+ZDMOpI8WydApxZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3369698-1a78-4bd3-2d15-08da02cbc9b8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:25:51.4913 (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: Z8vDUDcnNwBNT3WDzqbcfTkUt5lCaO4dfoX/Vmkgh7uEjgm8y3YHX4DvW0+Qt7LxXxWQ+s2Q623JI/sRV0Q1uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4858 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 v4 to v5: - none 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);