From patchwork Thu Nov 9 21:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13451754 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2740D374E8; Thu, 9 Nov 2023 21:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="pitp5c7b" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2083.outbound.protection.outlook.com [40.107.105.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FC363C0A; Thu, 9 Nov 2023 13:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RS9IJvfKsXmOgPlah5wHlguZVciNL+kbtCE7mF9d5cCoZMvMPsTw1MYV6N0HOaQtzP65xNCW7qwtH668+XOv0az6f+1O5nrpyo/bSUnNvC1xTaT0VbaIxUXk5eCh5ZVuvcNtbk0LCFM6kYKKp20xy3eudwF88n/m0VRUTINYGAxs7ulFA3mw4LqXZbzB/1skscXqM7sPfjHc4uXuudiaOWvcPSVFNHpA24i8wI6YbP2mmOwXUNHh6fPy2vb6zZklW7XI1v8Q3E/EevS3m9OxMlx1S6EOS/gKE+VKXn0k/klvBIEy4oH8NZKGegBSJdjnmf+z3YFIi7eduPCUIY4/xQ== 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=uZ89+LfuS0wEaJjHZ0T4E6Y0YCjCxdeIQ+7QlqEDYqc=; b=MRdbXo7mJH+xb6Ds/fJUvdanfb59RTRDjpz249baqKe4ibMy9KZi/H47c4R169ptfcBHpgzs4LMKR5pE88L0QL6PAqT4ZsV/gAAHhBoXZyT0/Ixd7+wn9Q2baUKqyrvcuSLDhPOlo7QpHtaG/L7A37Xyu5z/hm+ClxUvmXl9spusbHvUHiE2ppNr0QMxcjwEH4d94k102vJlOF+Q5S+wmXgzl9xM9UaSQWVckDW7UhZAFf76AoScvDtzt9rAV3ho2vlvHwgrB4py0H9fxY3axJjSop1+NUeAtUgJ4Tw4v83MyS/ZKHf3pF3x95GT1iBUSv++TjzlC+jH8xXAVT0TJg== 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=uZ89+LfuS0wEaJjHZ0T4E6Y0YCjCxdeIQ+7QlqEDYqc=; b=pitp5c7bVykANoI/DqC8Vf9NQ4Pg82Hmo1A/M9YXO+1IUxaW1YawXoNX8pPJfaqpmkXlGZgKD/iFEx88FA14rNx5ETrN+b2AlM95BDzEJJye3xGRODb14r01poytXyL196ClBmEFxpy5z5nYTpdwmux1mwHBtLGzvdFyj74v9bA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBBPR04MB7836.eurprd04.prod.outlook.com (2603:10a6:10:1f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.7; Thu, 9 Nov 2023 21:21:37 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885%4]) with mapi id 15.20.6977.018; Thu, 9 Nov 2023 21:21:36 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH 1/4] dmaengine: fsl-edma: involve help macro fsl_edma_set(get)_tcd() Date: Thu, 9 Nov 2023 16:20:56 -0500 Message-Id: <20231109212059.1894646-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109212059.1894646-1-Frank.Li@nxp.com> References: <20231109212059.1894646-1-Frank.Li@nxp.com> X-ClientProxiedBy: PH7PR17CA0013.namprd17.prod.outlook.com (2603:10b6:510:324::6) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB7836:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d2710eb-ca06-4b3e-29b0-08dbe169db20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mtxURoLNxgBJmNZd3P3rreoPgqIjY4aj2oaEIJZ5iyV5px/wIhjFYHuBxH5GwVeWD2yzPrcyibBP+CaLLGMaxtHKGT5PjU/LTNA19/L/E42LobiiBvM8TFWzXrNmBi63a/eX5xwGsrTHgKSbFKvfiRVwwVmXsjk/453QXjoxEOHs5bxo+FYWUU0TIwOzf9qMbxJ9UyMQi4SE1enipjWywRgxz3I/hY+B85bYKBrYk4Oo8fNb7p19CYDFP+Y5O1zYtOsRZxkDfN3FSWdL/NO7O86E31dUCiaCgLT9P7IEi7pqKjIVf0mDnQFjdAgzJ4D83VmzBjPpWLfNq/VzTQZf2rpk/5DnVGLHp9k0lEqzj6njdeglJlYao+rnAnsqrTUkTAyPSoR6VI4cDdnUWkPL85HtRAitp2JlTEbOTBEwvnuk05DDlGAxz1dR/8e676X4uRJldDFGPyzOlisDWi+NRgAJtKbtKimnpjw5x+wVfZAdpu4OLCVtX3G3Bt0jqGNaeNvb15qEZbEgzRYIm2luuStYzoDsaIOBhSOaiKEaV6GY0h7jzrMFSj6TBDZHsZZSmKsAQqWIdTBRSoXBUYEFuide5iPdjTQhvOaD/sNzwMOS+yZfPY5jkySPVpivgNBc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66556008)(66476007)(316002)(37006003)(1076003)(6512007)(6486002)(52116002)(26005)(66946007)(6666004)(8676002)(83380400001)(8936002)(6506007)(4326008)(34206002)(2616005)(478600001)(5660300002)(86362001)(38100700002)(41300700001)(2906002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y99l/i+I4ujUYi3wLgh4ObBdidB/I/tGi3lTmmnT+Ia617WF9NIs2BHLz2SsNNxeTSHxBl/wL2LnSFO3rcseJP0Ni4WqizhtsZcXwrXbEaR+HCAueOfz6qz009W5+VtaiBw4NgSSQDW2bayy7uHb5Ngykf17yb1TQgG92wSGz94ED4aPrfMtIDxsfTGTEK0R/C0CzVYqG0wlFMDe8U+cI5jm/E1+vLRofByJn6DpJMK5edO57zU36uM6zr/dv4yATEMeBGpnoeAD4Wzqw2diRK8vFJCLn5tGga9eZ/4WwMX6MPSNAeVJ2i+WJLFyDguYh8D3qHiOXXVd51v1X1GlWSEzXYBguCtc6wHtffDpcku8SkdihQ0KZgPhPZhcb2TNBbyJhoKS83ce2l6xTM6Yv2w98yfcwYLXTj9pI41FPoXf1yYMnFImqDvP1c+UPJCxP+mSj6Yspn/glLzQ5wqpgK8kPfDftW1mTN/ydOOn+oDCn7wZ+rtI6ZVtdiq9sMBDo4InMvBby8U+rGvxS/E0aN8fnLrvLzMBgEQrUL2lurFhhRg2/xSVy7Kz49tHYnAoGkXLTlUqUhQ76Mlvzf980Brak9u3IawaHK5nOx3YBBiW43ovj/glpYDKZSS5XU4GaNWRSyl/UjeVsj37j0392iBEL77eDuk9akeVaZ5HH8xC2Vx00lOxMduJHdTa9uoJr0RRuZFQgnsHRby9iRpJxEmVGWUWhdNWfVO6GB0PvwrM3k9PghSeek+HoeJaUCJCUpzWlf/O204zF7W14hSlgQA0uLPP6l9R9oq/E5qBsHfKVnfhGDip2axDHLs8fS25GOi5Y4n3gtugyoOZC33mlx7oNYqEZy1aB8539By/z/MqLiyQA3K4SygL5sVXz3H98kilK+8L8b+R+Q2IUnkxXIh0NGvb89hBsW0GPSghQ21KaY4WI9yueYAUi1NEhOmcxpc9jqKNRDb2w8gNpMBnXDGDUZ2n8TlyV455cqgeQtRNMFkmplm/lGmphO1uQTrITDxrnS6cJJDY/nsqIR3UVJ0M3w0iacDadDKpWNNhFMI3TeeRFdN6eX/PyK84g67ZumObJt4SAjdJ6smidkDGkBznhGSrj6iHWcZ8evXoUst0MzNA0hMvdjWiAJrq6ToYyHVh2BL3kYbTC/n5mOU0oidOBTs/ei4eMRVNU9Ak6h5ADlMlsmkplaDzqkyAbvwJESHQj9SNbD9vcAbpKuSsTpvc0yOUQAJhPRidsBjCVbKzg4s3XGejckufjuByFCFuXzn8roU0kg+tHAQbwTmtJxo5xv94Vp+05nmLGGOeKTA6x7sCw2LAIYrP0OPo23KDwL34nkS/S+9GshJMxumgstMn17eKN8CVVBosBuar7zYYf62H3JiHU607JyA6/kSbz79TDhuYxORmzFtL0qCEVZLdGNMrSK+RueLYNhTqUddUmk9KEULI6nobfdaMWPgTUOo9s2iYPFX8Pk/MsCKE35hFvsracM6wKq78LSSvolcT9OXLbMxUYl85cSLyaiaXrq4qYA4TfAAWNX31PoEp8etlRn2j8tBDc7TX0LOV7BYJv1ryzJrquRSOqi2ZPY9Y X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d2710eb-ca06-4b3e-29b0-08dbe169db20 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 21:21:36.9123 (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: 1et9vcmP9x5mJeh6eOOp6zbHGH0xcLKr4UUZ6OO2I2qEC0lFMYucA3qfLmRTFR3nT3/REksVymfJwjncVWBiuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7836 Using help macro fsl_edma_set(get)_tcd() to handle difference field size. This is not function change and prepare for 64bit tcd in imx95. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 61 ++++++++++++++++++----------------- drivers/dma/fsl-edma-common.h | 20 ++++++++++++ 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 6a3abe5b17908..1cd9cf51b16eb 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -358,10 +358,10 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, /* calculate the total size in this desc */ for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) { - nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + nbytes = fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, nbytes); if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); - len += nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + len += nbytes * fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, biter); } if (!in_progress) @@ -374,16 +374,16 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, /* figure out the finished and calculate the residue */ for (i = 0; i < fsl_chan->edesc->n_tcds; i++) { - nbytes = le32_to_cpu(edesc->tcd[i].vtcd->nbytes); + nbytes = fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, nbytes); if (nbytes & (EDMA_V3_TCD_NBYTES_DMLOE | EDMA_V3_TCD_NBYTES_SMLOE)) nbytes = EDMA_V3_TCD_NBYTES_MLOFF_NBYTES(nbytes); - size = nbytes * le16_to_cpu(edesc->tcd[i].vtcd->biter); + size = nbytes * fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, biter); if (dir == DMA_MEM_TO_DEV) - dma_addr = le32_to_cpu(edesc->tcd[i].vtcd->saddr); + dma_addr = fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, saddr); else - dma_addr = le32_to_cpu(edesc->tcd[i].vtcd->daddr); + dma_addr = fsl_edma_get_tcd_to_cpu(fsl_chan, edesc->tcd[i].vtcd, daddr); len -= size; if (cur_addr >= dma_addr && cur_addr < dma_addr + size) { @@ -439,26 +439,26 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, */ edma_write_tcdreg(fsl_chan, 0, csr); - edma_write_tcdreg(fsl_chan, tcd->saddr, saddr); - edma_write_tcdreg(fsl_chan, tcd->daddr, daddr); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, saddr), saddr); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, daddr), daddr); - edma_write_tcdreg(fsl_chan, tcd->attr, attr); - edma_write_tcdreg(fsl_chan, tcd->soff, soff); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, attr), attr); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, soff), soff); - edma_write_tcdreg(fsl_chan, tcd->nbytes, nbytes); - edma_write_tcdreg(fsl_chan, tcd->slast, slast); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, nbytes), nbytes); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, slast), slast); - edma_write_tcdreg(fsl_chan, tcd->citer, citer); - edma_write_tcdreg(fsl_chan, tcd->biter, biter); - edma_write_tcdreg(fsl_chan, tcd->doff, doff); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, citer), citer); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, biter), biter); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, doff), doff); - edma_write_tcdreg(fsl_chan, tcd->dlast_sga, dlast_sga); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, dlast_sga), dlast_sga); - csr = le16_to_cpu(tcd->csr); + csr = fsl_edma_get_tcd_to_cpu(fsl_chan, tcd, csr); if (fsl_chan->is_sw) { csr |= EDMA_TCD_CSR_START; - tcd->csr = cpu_to_le16(csr); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, csr, csr); } /* @@ -473,7 +473,7 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, edma_writel_chreg(fsl_chan, edma_readl_chreg(fsl_chan, ch_csr), ch_csr); - edma_write_tcdreg(fsl_chan, tcd->csr, csr); + edma_write_tcdreg(fsl_chan, fsl_edma_get_tcd(fsl_chan, tcd, csr), csr); } static inline @@ -493,12 +493,12 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, * So we put the value in little endian in memory, waiting * for fsl_edma_set_tcd_regs doing the swap. */ - tcd->saddr = cpu_to_le32(src); - tcd->daddr = cpu_to_le32(dst); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, src, saddr); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, dst, daddr); - tcd->attr = cpu_to_le16(attr); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, attr, attr); - tcd->soff = cpu_to_le16(soff); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, soff, soff); if (fsl_chan->is_multi_fifo) { /* set mloff to support multiple fifo */ @@ -515,15 +515,16 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, } } - tcd->nbytes = cpu_to_le32(nbytes); - tcd->slast = cpu_to_le32(slast); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, nbytes, nbytes); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, slast, slast); - tcd->citer = cpu_to_le16(EDMA_TCD_CITER_CITER(citer)); - tcd->doff = cpu_to_le16(doff); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, EDMA_TCD_CITER_CITER(citer), citer); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, doff, doff); - tcd->dlast_sga = cpu_to_le32(dlast_sga); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, dlast_sga, dlast_sga); + + fsl_edma_set_tcd_to_le(fsl_chan, tcd, EDMA_TCD_BITER_BITER(biter), biter); - tcd->biter = cpu_to_le16(EDMA_TCD_BITER_BITER(biter)); if (major_int) csr |= EDMA_TCD_CSR_INT_MAJOR; @@ -539,7 +540,7 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, if (fsl_chan->is_sw) csr |= EDMA_TCD_CSR_START; - tcd->csr = cpu_to_le16(csr); + fsl_edma_set_tcd_to_le(fsl_chan, tcd, csr, csr); } static struct fsl_edma_desc *fsl_edma_alloc_desc(struct fsl_edma_chan *fsl_chan, diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index bb5221158a770..72104d775e562 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -246,6 +246,26 @@ struct fsl_edma_engine { edma_writel(chan->edma, val, \ (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) +#define fsl_edma_get_tcd(_chan, _tcd, _field) ((_tcd)->_field) + +#define fsl_edma_le_to_cpu(x) \ +(sizeof(x) == sizeof(u32) ? le32_to_cpu(x) : le16_to_cpu(x)) + +#define fsl_edma_get_tcd_to_cpu(_chan, _tcd, _field) \ +fsl_edma_le_to_cpu(fsl_edma_get_tcd(_chan, _tcd, _field)) + +#define fsl_edma_set_tcd_to_le(_fsl_chan, _tcd, _val, _field) \ +do { \ + switch (sizeof((_tcd)->_field)) { \ + case sizeof(u32): \ + (_tcd)->_field = cpu_to_le32(_val); \ + break; \ + case sizeof(u16): \ + (_tcd)->_field = cpu_to_le16(_val); \ + break; \ + } \ +} while (0) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. From patchwork Thu Nov 9 21:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13451755 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E8CA374FF; Thu, 9 Nov 2023 21:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="JumnNJCQ" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2072.outbound.protection.outlook.com [40.107.105.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0A23C07; Thu, 9 Nov 2023 13:21:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oZau2FZbnG0tcBRa9aZo2mgdiPoCXcHd2Ll6kmJ5wD+7S2RB2yUk+OOqpvFgeFWnHwnD7CDIlg9xer4sOsqIBLVHBFROW4WtM1/Kb6GP8VA9gwQnIX6dVmR6bu/Pmx5vO2EcaaQq22Hn8fJM+W/XoatjjpIiF6kO3M/jEOJt4f0muCID2BK166ly3vArBdeSRSfGkNUs39xeFkhL44MQpCF6n5yG/lI7Qcl9/HpFUHo59vl3vvV1m6PkmkOu/sQYPkrgDxwDE5zbMtT+9wKGDg9ESQQZHgVxcQw3rvxHrqYKVt725AtquUPvEUCTQes2/7/v+hhfAF0uVGUQnWvYIw== 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=1ebDjC6WKdz4ri4or89NXecFxL+fvMRYseQbEtVB2ss=; b=HktUl51TWYIFXrXTCKz5TIsUCgGf40GZioEAiIUQh/tm33uc94++7/lv1quJB9D7MtHqvXjr2yXBCZgwEzXc7JKY0DFlRqEfQOWiRHVG80izio6RZd4iB2/GzOXSXO3GBI1oMqLQz0B5Yz0MQQdr04Ac8OBudhm7RG9boPz3+isCW+FRVPdvJ4jipDGDIzoHN3wPlriE8udvuZRNeXNe7PUJgLKwWais0m9AB1kksTb/+CvAGuxc/o8vVyuUnSO5Uv8z1GvD5oQIOTMFzSm6I4Br9kNl7Q1GCG0hSvzWLIe22xtO5fT6BHS1yDztiI08a0n9VocXA4VMZ9fTZ/xSaA== 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=1ebDjC6WKdz4ri4or89NXecFxL+fvMRYseQbEtVB2ss=; b=JumnNJCQRU0CY+oRMUFt6z/bELYcwzFEOP6NTAMC+RsQZLbEXatJuGWDRDjwcVAhz7M8D0oItb4klaY1GTMdo7OD1EkujHqjPDn1nm8L2PGXI2h9+lxi/n3PCPTGtGDAY2pouuwXgf8v1orbA0H4vyZNL9TNmvlOLXz0znFkM8E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBBPR04MB7836.eurprd04.prod.outlook.com (2603:10a6:10:1f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.7; Thu, 9 Nov 2023 21:21:39 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885%4]) with mapi id 15.20.6977.018; Thu, 9 Nov 2023 21:21:39 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH 2/4] dmaengine: fsl-edma: add address for channel mux register in fsl_edma_chan Date: Thu, 9 Nov 2023 16:20:57 -0500 Message-Id: <20231109212059.1894646-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109212059.1894646-1-Frank.Li@nxp.com> References: <20231109212059.1894646-1-Frank.Li@nxp.com> X-ClientProxiedBy: PH7PR17CA0013.namprd17.prod.outlook.com (2603:10b6:510:324::6) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB7836:EE_ X-MS-Office365-Filtering-Correlation-Id: c0ced4e5-6023-492d-6641-08dbe169dca2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Kw00kegAalyN5bBsPc/LkOU9oHHt9Lv0saMA4mwybp7PXdjjd506N/H1DQuUQVHAy8+jGTJER3iU5COjbKxW9U8IaUh1oYy5sbr/pgRi5ddmiWNZ4ij9xhpuxUWCNP+7gjla3UX14zZATq1v+CGx89QhxgJ+CoAGZKXOgCdQrycI7s9I9wByIPoCUF2lFdkWh+LYCl5q63qYS/hy/511GS3yB8Cc8T683kV7Dw7GcemwzBuKP0yV0F/aiK8zXuLDPMRePMsATfAQBhCNK5g7ypordCltRR2Ge4vBQqAtXZsO0yPMiPly9iWzAYSK94ZMxOmeN00SkRdEmfNxlvQJyQiI8+UAn0h7NSqSYy96qKP0XUvaDATcz6iobt7a5OTgxED4wAXEeZohp8xjORKQxKLdJWYWrdKz2ZahlDo58nVxhw8GamIrLvkLCEegUFE4p7J5jIh4BA41BWbXc/+9jiLP+/mQQWboifMfLy1MLvZU/cL3BNzkyVmS0kPjxlNlwyKmtPqRblHhgs0uRCK/+JApDKGRso2babFj81sogCBVjPfE+xA5OPjPacKU7uUmF6sno/7FnANvCE3jraaxkrW53GJSgwkpb+NugZj44fScXo94MpflKZwv1hHQYFW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66556008)(66476007)(316002)(37006003)(1076003)(6512007)(6486002)(52116002)(26005)(66946007)(6666004)(8676002)(83380400001)(8936002)(6506007)(4326008)(34206002)(2616005)(478600001)(5660300002)(86362001)(38100700002)(41300700001)(2906002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uw5KX8qYlk0/mTdq0NPN467og+qs19wAPfDdQu9vHYuGgs26YwUFahQ7Phvjn2HiFiBHtyTvpyj66G538VKrSHHl0hqwTglkZOwM4rL9wkTOVwkWaMGu0BczyB7/J4xE4ORAJ24jOdl6BurYIpV6GakyH2MB4RmRxlUto3oXnL6ZcpqjVxXuhNweUbmhzS/ZRf653HF405xt9BFgAGNTYoye+p0Gigueh6tltZ+7L8WSBxvxE1nH7mEDFSvNVbuediNXPEl/IByperK4t7K4L/1o98CwcWrm3T2g1nFID5rtTZrw9zrqoeQaR1C3VpV2jWB2KeQMTfX6yTBArcFpJLrcpgOieO9O/uR+zxwYjBkj7sCCeg1JYAKEngQUzTAz2cFCqCSoZrBy1Elf925EzhOEVsaI+DhCuoCxoZQmhLTtJO+zKZKhGDkL1NWYx4OYoxum5xE4eB8nw/0DF7scvPM9PUc9vEjSpiCAm57AED8oWKlLwq1+Sz2yAFnU3phG2Wl6ysJKpzKQkjPwP5iLxGBwTe48hN6UUt70VovPZBz/QiRt1vVvZXh7hAYT9zNz5J+ZHrsN3bin5q9jg0VcT2V90oHK8DCMDDLnHFYMizA4yFhz/0NVDzB+ddvjBtOjl1/zpYmgpcRAr6lXNS+IvptJzBSkwfVgqWu8NHhAzMFB24ppgpBQMxtwzkZD7R4XB8NfCWUU+pVco2iUsrgtk+OSzqeGAwiW4kKEnFbGtRgUVOwZYrQFE2OOFqorhQQYD/us+nQqv+3EqpC7ARRlVcXvYCh5oIBhYGu/cmFpNjz0vvWuJs88AFBrZ6u89WGLK7EJbHKR3UFhWiAf4525QpOWyMF3dTK4gt+FpWnb2adazZWThJka8MJyErRcJuIHKIpnJtFR5MD1oAzhRIiZq+n4bmKjfWOdjlTZrtQ4JU6AUpIUTThDOG6gVLEHuwX8mSngGvss+HUgTVNxdV5RcuweQaxq+5jsAdqoJNYUPhFOtRVMeqXOYPMfAADIY40p9PbCB1T191aOdVFj42Q+Xz8Nu/n2wiEs/lFfgJffwDLlbk+lJkUKSsjbPmdGrr9mHrj51DokCJE4CNNyMA92yoRWZV7bJTSGUwCwoaGFgRnjjvSBWfZ3MQDT5FkCE4MIRAIXsh8g872gGF4qKx1trA4F9nD5M2rLyVgFM70m9uJWTBc9j2K8hBCPMlbkWK0ziXwUmdJdv8YLmNAiC341NHcm48uFok+CMxus292P1fec/WIPPV30o16nwMq83pVdin0Bhqp0a/Uq/PYtTcfH8QG8uQ0KyN8wB4Jw2ukwnvH1RmS2XxVechAill4ZbIl58GPrSXZrHFFJ25l/JR2skVHGyX3Wyn6DjeLa9lSylEx6PGrwThfB2a4b0duvz5mF3JqUt6eVzXVc50T1Yl0KRp7hCCWaiT2FOKGuMUddLKs41pVo+ZTq/IWH7jmLi4Jnn9Xpgg0w1AYp6/lr/s77I8i3lrG1HZdLkNLTszEmw7yEpjUbfVOJdKvMptIBbzHo3Yitqic2nffBnU/Ft0bcmsrZytmUSaj9IVmRiaDaI2R9yszW8YsWr9dmdjbjzSXH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0ced4e5-6023-492d-6641-08dbe169dca2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 21:21:39.4061 (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: AO/NGGYunwvKBLY8aRLQhaXogaHa00fgRq0q4/Rm9Y73/c2PuM2b430dxU4bsUjdLJsO/D5bRzJNHVIuChj6Dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7836 iMX95 move channel mux register to management page address space. This prepare to support iMX95. Add mux_addr in struct fsl_edma_chan. No function change. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 6 +++--- drivers/dma/fsl-edma-common.h | 3 +++ drivers/dma/fsl-edma-main.c | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 1cd9cf51b16eb..d29824ed7c80f 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -97,8 +97,8 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) * ch_mux: With the exception of 0, attempts to write a value * already in use will be forced to 0. */ - if (!edma_readl_chreg(fsl_chan, ch_mux)) - edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux); + if (!edma_readl(fsl_chan->edma, fsl_chan->mux_addr)) + edma_writel(fsl_chan->edma, fsl_chan->srcid, fsl_chan->mux_addr); } val = edma_readl_chreg(fsl_chan, ch_csr); @@ -134,7 +134,7 @@ static void fsl_edma3_disable_request(struct fsl_edma_chan *fsl_chan) flags = fsl_edma_drvflags(fsl_chan); if (flags & FSL_EDMA_DRV_HAS_CHMUX) - edma_writel_chreg(fsl_chan, 0, ch_mux); + edma_writel(fsl_chan->edma, 0, fsl_chan->mux_addr); val &= ~EDMA_V3_CH_CSR_ERQ; edma_writel_chreg(fsl_chan, val, ch_csr); diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 72104d775e562..6c738c5cad118 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -145,6 +145,7 @@ struct fsl_edma_chan { enum dma_data_direction dma_dir; char chan_name[32]; struct fsl_edma_hw_tcd __iomem *tcd; + void __iomem *mux_addr; u32 real_count; struct work_struct issue_worker; struct platform_device *pdev; @@ -206,6 +207,8 @@ struct fsl_edma_drvdata { u32 chreg_off; u32 chreg_space_sz; u32 flags; + u32 mux_off; /* channel mux register offset */ + u32 mux_skip; /* how much skip for each channel */ int (*setup_irq)(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma); }; diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 4635e16d7705e..8e5ddeb5e887f 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -356,6 +356,8 @@ static struct fsl_edma_drvdata imx93_data4 = { .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA4, .chreg_space_sz = 0x8000, .chreg_off = 0x10000, + .mux_off = 0x10000 + offsetof(struct fsl_edma3_ch_reg, ch_mux), + .mux_skip = 0x8000, .setup_irq = fsl_edma3_irq_init, }; @@ -530,6 +532,7 @@ static int fsl_edma_probe(struct platform_device *pdev) offsetof(struct fsl_edma3_ch_reg, tcd) : 0; fsl_chan->tcd = fsl_edma->membase + i * drvdata->chreg_space_sz + drvdata->chreg_off + len; + fsl_chan->mux_addr = fsl_edma->membase + drvdata->mux_off + i * drvdata->mux_skip; fsl_chan->pdev = pdev; vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); From patchwork Thu Nov 9 21:20:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13451756 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E7B8374FF; Thu, 9 Nov 2023 21:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="VEACC52d" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2071.outbound.protection.outlook.com [40.107.105.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 519253C19; Thu, 9 Nov 2023 13:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HoOC3rXq2h88gdwfQ38FRYcSkpFRu0qXQDJu1f9HsIbtgoGJdxYu+OFr/c3Uuc2XwHIMdCutNJx4dTMick9Z9A4o3iOcfAGEd71b2t8cD9UElq71rqviLYfH269IJiIW6TFBEiwao0vBvs2bGyfizlSdyeTRmzcItQ02WRoBj7hyJ3h3qy5acHAmiRAnKdZBbAIOA0XFZwu58t5DTjHr1si103lLpf0gY7Yo1Lg7ZbMijC6SBxpPD/d2VJWEo6L8jXO1J0a1D32fnDrGcBPQBlLI+R7ESDfJnt/Z1/qDjzLu2QFvP8EvYhO7GZQtkzZruOcDuwNcxdHMQZfkGB2w/Q== 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=hJn9rPmEqPh8qns19uoLafsVSH2809OkuewFxQ1wgEY=; b=ZKhL9H/c+DjawhcYTksaNHhWIq2XsStkJxJMf1ejdYms59XvrYZUZzimW3HoYNIK/iM9kw9UcQ7XbF7jZ5wLEfkE5YFEI4+pquQPIeHhY3o43KL9TizNv9bWNbHLQhxqT8SJ7AfFqsHGL1GVxFBhhwVoGdwuvCXKIfVj625MgmOknG7brkVj7+0qy5ESi5tV0yG8nvNRxTfxr9M31PjHPzHPriS8Mzmhyt0+fFIuToGdMVTT41pnyeHP3KlIBnZ+qyJLKP8u92Y89+4JhLF1B2YYz8OVQYaTYFjcR7PGnIKXTXfN3lfFNab57lwJVYlGM89Mm6Pg4biGYfKod4QCqQ== 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=hJn9rPmEqPh8qns19uoLafsVSH2809OkuewFxQ1wgEY=; b=VEACC52dLwrQuRsabdc6dAm4SArQ5PFpTUd9lJorH8NmEkyRVFJEF3tKfTabih0ad7DFRKTnhV88Y4PCyPIIvvdCLOy0QHNQcJjPJxZGUXEJYEyuSoY7e4UAAlIck3/vlMd3Am7WThueW+EzOHLIScGXiP5KFvb0pXOiyg4jT/E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBBPR04MB7836.eurprd04.prod.outlook.com (2603:10a6:10:1f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.7; Thu, 9 Nov 2023 21:21:42 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885%4]) with mapi id 15.20.6977.018; Thu, 9 Nov 2023 21:21:42 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH 3/4] dt-bindings: fsl-dma: fsl-edma: add fsl,imx95-edma5 compatible string Date: Thu, 9 Nov 2023 16:20:58 -0500 Message-Id: <20231109212059.1894646-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109212059.1894646-1-Frank.Li@nxp.com> References: <20231109212059.1894646-1-Frank.Li@nxp.com> X-ClientProxiedBy: PH7PR17CA0013.namprd17.prod.outlook.com (2603:10b6:510:324::6) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB7836:EE_ X-MS-Office365-Filtering-Correlation-Id: d88c6d73-756c-407a-4099-08dbe169de22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2jkdWpu2nVgmCB/xOrBNn2nD9+8MuFAIYRsTeV7XcvJU680x3q/rqqgyfrzySfMmbP4yTSDSWIgoeCLQ4LsGhRm3Qro07mzT59KmjZ94GJH8VAMmCto5eID0xZN9sRq6vS1930gH6nE8Jo2G+399kiBvZ+QoAfR0Ed7RA6qjm7AEixTjnM1YA4niNEzh08mR5+CwJpiiUTzMTyemke2ki+LgOBpMrtExCilTe1IHBCbBEhDmc22W6MhSNmxrkQKunS1jgLglqETK7NUzEDy++UCdipnABQOPy52GvEUXFO8LcyvkBLqg6VKv9Rt/dAMTXNUG6Ew4n9+wCfq6hCkfEsCkKCYuUNRG8zgyiZuJTqt0hZKjL7qXnBA7++IFrq9dpb7H5EwwoAuASrv+yfYfgDyDhduZlD4lS5HWtZk/RQEilXvcPBlEFjLhP3MU8YZqXdRGGs6SnIX47zkAXMHqeGsKJ3+O7jKz5vZKHqN2vTWlR44/4qCoerT2CncnonYfTzbStxY8KW5Mggfw2Vg1qgZUfdRtulTeJFHAjI+VoEc0bvRCxuGvqscK+k/TXgf/9wWeOC3Yz5p2dU49yaTvoFttFE04ptIxjLdmJ9QWo+XE+yy7Y7d5/3wxGDflWkiM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66556008)(66476007)(316002)(37006003)(1076003)(6512007)(6486002)(52116002)(26005)(66946007)(6666004)(8676002)(8936002)(6506007)(4326008)(34206002)(2616005)(478600001)(5660300002)(4744005)(86362001)(38100700002)(41300700001)(2906002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qgM+2A5GApRkXmoEOkEo71oZpibbv1pH6ZG0Km19kf/3TgKySP6BrJPNASKo4vLpjSWjbYYXTlRQQVJeqg/WNvhnhx4YGmNzt76GVaTtcL5mCUUQTwtmsGn+wIDdaP6lg3j49Nk2O/3XxVOKZlGIlqPSyqhPzUw/q/4Mk27FVMK2mwsLNPvwHGT0z0O8UtEwL/0LXq1EETvXaUSFkTxf7u+F6ZbJ2LT8qgqPBDcIx78CHVdmXoG4ovxtvok5CsMbfD7rFMOI8+it6JeiLMnpZawonRa2AOdjYP0hVaUNeQIlIikvkIfJOFjoyMLBC34f738+EnYN+eXDFv/P7P8x3P0jtf9AYONTEtIlPuViKX+SYfLpwHhWOgGWnGQ5++I3geimsmyAVhNMMAk8Ec8CTgVnyAHLnCiujiEB5hMrQS0cdO3WZ7/U7PUVcOzkwl2M3KWGBsYN9+p2jxvR2bL3KKuyFr0mf2nOZtr83fwHHWD+fuX2c/qZlhB8CHkuXTa6V/UsuCv7rtt7+z5Ezxds5Ca/sCtrXGs3Iiy+6yml2gjM6Cfoz/zijOydhyJzXHrMCV0cOLBP9r4lCMtjmnt5GRrHqLQIWqKGJaeD0Mc/sKaqt9K0PPN0Bn/IKvag1u41hoGVB7G/oFdCR1amAs5q12e4fi/xH+NdAZf24nUahJ8LWA+gjXnzyUibEVqmFkSyuVwybIjo5Sat76bSFsgL4Mvc1XaGt9M0PsFF18RdrGokNKBQEoIl262ll3DY2X/yTMCuIUejTCbSlCzJvRsmiK+M2PnD8HHzPU0A2ZH95bbw7BmcKqt6YBfGpBwR2ow0e7KmiwnC0UCnCnCVbcnEWjF+SpLVsbbw9ZMP5xN2+1eWDa2urLPKY2h49SXMLZr3qY9BAyvYCGRR9mB5Rqo8kp9g1qpcEPEChGAHbMVSDS0EOqwtpclOKFSqwjqCJpFs72sNR0GNTA8udrCK2GSS1ZBZjBz73p6DG8E4/IVgyMg7vtJcrYOgRV97WSRPGh9OXyCSsY7wnZTjXy5qLWHnAlHjQLq4L7GnueIFRUo2cfYRKLRV/uc6RYwsbmr8tn5Bt5W72v1EUEzN0msPGTf1kJQv/YyFbpJyIdOPDzGyS6TImobCPQoLPxaNZDc7qX4sziiwUM8BfEJ7czdCBmdaYmEsUPPgc+Q127JDa6W4YpUUz6FqmCTRNlcOEbNNe21p7JrSdRJeq1UrQ7VAX9bIT6y444PJzfCkieGcqPNDaFCFysCbXytxcgdT/7yfvJYuZoUgEq2NokLBspkG/7UV0mCiXIvLlnqsEtJ3z9WjhCjFp/WFwDc1iwBWZ0kTI4JwIUydm9rMQ4lRp1OmYu7jGUY0NNWbHdywSgaZJstjd8EpDrgjYTh25w0FPC+FdpJI85K3FEDrC0yWfI7xl3gNOu1kv4xPeUgZQkYhTPBwOIbZRjqjHWxZ8OVX5xaIeCY4Jko81xiGpLh3FfA2HWIlJiFQPN8a7kzFDCJGmEmAqmDmoTPK2MAXbcyHBLBHPZ/vYyqQcXhYAe4L/MPEloo39Nl9bHJlcqhIb7DPf8zwCT2Akj3wMeEvRjI8BurQ2PNw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d88c6d73-756c-407a-4099-08dbe169de22 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 21:21:42.0637 (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: PM36FdaENoulVV1O8qBKgRUaFb+Y1ziijVH9j+gUBnTKFSe6LtiPvPJDuuNiqmYgk72YBmOkSl6OBzjtPAf8AQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7836 Add the compatible string 'fsl,imx95-edma5' to support the i.MX95's eDMA, which features 64-bit physical address support. Signed-off-by: Frank Li Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/dma/fsl,edma.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml index 437db0c62339f..aa51d278cb67b 100644 --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml @@ -25,6 +25,7 @@ properties: - fsl,imx8qm-edma - fsl,imx93-edma3 - fsl,imx93-edma4 + - fsl,imx95-edma5 - items: - const: fsl,ls1028a-edma - const: fsl,vf610-edma @@ -83,6 +84,7 @@ allOf: - fsl,imx8qm-edma - fsl,imx93-edma3 - fsl,imx93-edma4 + - fsl,imx95-edma5 then: properties: "#dma-cells": From patchwork Thu Nov 9 21:20:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13451757 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6828374FD; Thu, 9 Nov 2023 21:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="OFfaF2ay" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2046.outbound.protection.outlook.com [40.107.105.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D604685; Thu, 9 Nov 2023 13:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZdPAE4NWGITKcDrvtk7idmxnGbNnu57SZ0SLZomAcScVmPsaBcBGKozNdjldrMG3DutYQHc3JEVV+OYG7Bc281NtRZG5MyiDy0E+w3tZ+QBuuIStW4ozOyrzLC0Mw4tCTXnwDX7ibjVebehQOxz5sMRQSTRFmAVQ9uTRSmkx3hUvXm/526vvNT7ltlgF7HGXf2avSbFIZqSI1s7pRUcuBuuRDw/bSTsBx2fKgO3n2upnNMM4rS0AaynRP39FvGqVLrZPYG3vmkt6kOM+mTFG2aZBie33uf1dUS5ENkBcUeZgtFnkMJYTsjYZrzNxfLoAQd7VIELVbkKr/WB44N7yYw== 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=tQoHzXE3TwYgEcIHzl8oBzc/noDppXKryI9BbNaAIgY=; b=iqNa9SAN7fUcgMpw24RmhklCfcm0k+lnF+qR4jLOkPVpNwcCN1SP14k7S9jOO85e93pwfB1/MyA+foq0La3+LrRVv+QSXSNHWoaUAT4uqq7gAGt4lIF5wVFSEcJC4tnAA93GBgfIHtcHGY3LjBbUxZuNtZJP/Kj3syeE9aKwXOkRQDNoE1gCrZtjZcZlsiI/lrO+khHxni2iuCrjrWGaJf2301blqS+0v9DTXwRZ8ptupgJL11sfK+QX3SnXy2YXUyIFMq+YWhrWDWweVgSVEUVEJbD2NGMr0paw7yvGrcIuhUmbksbbMWdupO1YWnwm54MCYDZYEiRjRvo3XWBAbw== 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=tQoHzXE3TwYgEcIHzl8oBzc/noDppXKryI9BbNaAIgY=; b=OFfaF2ayNat4ilhwOuUcMwG/537vOV97qmyOQ5IPDTPj62KYRqHN1LdFq+7fIVoVNn1LMfClOpUEIYUXipWU2lpmEs/MQaL7E1kNuBwcsMagmleV9ogRfK7366TsNfGsz4KQtpFmj5P+IMvWsDRyvG+XgqaInlHy7K7BXrGIn9Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBBPR04MB7836.eurprd04.prod.outlook.com (2603:10a6:10:1f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.7; Thu, 9 Nov 2023 21:21:44 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::55e7:3fd0:68f4:8885%4]) with mapi id 15.20.6977.018; Thu, 9 Nov 2023 21:21:44 +0000 From: Frank Li To: frank.li@nxp.com Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com, vkoul@kernel.org Subject: [PATCH 4/4] dmaengine: fsl-edma: integrate TCD64 support for i.MX95 Date: Thu, 9 Nov 2023 16:20:59 -0500 Message-Id: <20231109212059.1894646-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109212059.1894646-1-Frank.Li@nxp.com> References: <20231109212059.1894646-1-Frank.Li@nxp.com> X-ClientProxiedBy: PH7PR17CA0013.namprd17.prod.outlook.com (2603:10b6:510:324::6) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB7836:EE_ X-MS-Office365-Filtering-Correlation-Id: 2206fc91-5f89-482c-2d8b-08dbe169dfb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n/JjNewS9qlcbOkmUvW+hSEwZeHAE3en2DU+LztWMKOohb+MFUaVzWqYF6NgeFWIOJLfoY5Ep4CNIJRgzmGLbU6eQJlZcmuBwaO8iPHg1Cb+aoy0RP3ALd+NxNHOQ400ZftoEoqan6qz+KAK4+E25LjfoF+dMVtrVHH0BPzREvgNk44dhhrceIRmmobCS7gku6D7YrTny0ZGA/okS79Kk1ze9NEyDEMUhKnnPDAFel2ououGk6X10ZcurL4wmHno0muu5TOW6CwuFKmuMn07UfmYukNhlk5bpVxufxmbp3VZldkpgt/gE93rQB3LKc4ngQ1pMky34xRahi2bIrThhdQVv8RlnAzAuYBsqQAF7lTRQfrZdL8FfJkMDZkZreWNrw/HqIKpQQGo4JSifa+iuIX45u1gi6ZX+lPHsqc/awSmiT6gsCZJOT+6AIPD4brus2bjew2N5EdDoydhp54VbRpkufR7v05CviPvEMxXVFpIA+G4FiVWj3rtSsOmooeDKiTS+LRaAvXKC8jKDOsvtJBs6kqrVYeRrku8sHrpIpw+uiF3TGw5AuNcD/zve0AEcU3bFFQdi/2rZImouUKmkWD5hTlRWA6vqa2JvmqWAghRqENXNxGtx3fgcwIQIXu/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66556008)(66476007)(316002)(37006003)(1076003)(6512007)(6486002)(52116002)(26005)(66946007)(6666004)(8676002)(83380400001)(8936002)(6506007)(4326008)(34206002)(2616005)(478600001)(5660300002)(30864003)(86362001)(38100700002)(41300700001)(2906002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xf3/a0og4/FKGMc52Fp1AE6OsVdk+hwtjfFRpioq7ZB2BOB+cLxyuKXgMNQYEygRIfcjbYU8mBCtj6ikzgrvvlRT00xe8fkHIv7gW3hfZ1wv2OgCwRhBzSXQEcTK+Zx6Wwjho16FLrizTizwffzZEKJuKeHNM4MUIggrgoRuFRkt6w700NlmA74CD1SI5bed/HS7S6rGVtCf/KZLTCXozC95SctHnXy7tlSjdd1f8OnoXzX0bjxsSCxBVdCAcTiHATWKSWzH4GMOlb6A+AbuyaXb4q283pB74QdjTmeg6LYBrUWa9yfHXRV/CRL5avwaia0R8+CdvvMBdgrzudh1Zzg0OFePlQOf/Glv/rA589Pw6yRidsoDRrto2oDkvdnVy2QIflP/KFVnKv5HHpKPwO/HNT0ODxxFFkdT47bJVzwulBXsc9lNzkgQQ6u3Rhp/5+teeZU2L673dQmXJC/Eflc63MFYmJ/9j8aZTz65JWFOSGBuBwKGpMRISep4srvQO3MIQFAbgJbWuQSnv4mvdPyKqFLyNVu1Xk47sR6YicIsh5FiArZsfbtQ+SMq2G2VGDUgrjvXHC3561Olq2MXC6Wh1YPlCw5KIopS7WT1x62iAmKGHrLofdYbLerVC5KGlu8OVZuPujXi3fmN88sQY3hP1swIZVq87RIPLJ+xtfGMiZfN1p8wD7C5P1dypEW/94pUhyZqNewvPT8s293ZX+jMPinDA6M4aL5xSuOJtSgqBzb3FiGgBMFPRsFDYcxffSNS5GknVxJC0xPJqr0HvSh3wPamOcAG0P+ZnrlllEczgIQsyEbbuJ1cwIa38vRpupXMEvnkAkjfysItsmL8jbuPs+ETRD+pFLTGrvFghysodTbINY5prWGofH5ihTyw+qIBHcxwZMNiA567tuSm4gxFfdtYnChHHTkTz+ETaXO9QQl/zrnddtbjFOWb7rhAKHf7/iJBP6ranFcum8MOD5CClvobGP+UWvrDVC8GZlt3Z7SJQxdSbMqvYmVLuP1Hs0vJjml9B3dhfcUwdv200j4WONZaaAFOumJhYIyBcXQNXLFd07BNSY91LB41+hR5Hzl9KFn/33YuGHn/Elq1JaAsv9SmbqgRAf4R75oK6eetuMy8aB7dgFry5KYd31A38/RzO/Mxfe+iS9uOPdD97HygaKvb+1IETDs3oaisVXz86yzwyWYf4MacFrVFWtNNQiSJEidKJVGm/v2iTifMrUiHoiezPIXjjVl22QUXrsKuhclDA5/zIwEeMaBeU4AIHpk11ECQAGx0yBOhyFNp9uMwKgiU7sv7/dTKVA8AIkvoW3gMqxH4SCSgYrchYC6rC7OdyqBtj8ACtbEvQRIMxVUYGBlbsiVUH7UgjH+fJ+7wWSAsJx3NYuCN14dLfbttHMnSwm0OCylNHJUTsVYqgfBw+9WD0DfUo6l3uH7v1ndFyuwBzsug7KLVbEcQwlDILrHCcZNupWSCNirLrvvCMdpN6cl/r+Oh7i8HkrKN8jn3CGoROpXZWkmIIj94HHigMShn9ml59Ml1DLpeuV/vMRH4BZMtlO6b1BcB18D2Beo4kovkW4AWbyjy3SdIaM94 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2206fc91-5f89-482c-2d8b-08dbe169dfb5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 21:21:44.6980 (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: mdJR3aUcMzlaHYKr2LRYHZ9Rbcm2XW3yGygChToHc11Qz2aiAr5BjyWJSWzqTf8hQYjuZadFhyKYnojJSgpa/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7836 In i.MX95's edma version 5, the TCD structure is extended to support 64-bit addresses for fields like saddr and daddr. To prevent code duplication, employ help macros to handle the fields, as the field names remain the same between TCD and TCD64. Change local variables related to TCD addresses from 'u32' to 'dma_addr_t' to accept 64-bit DMA addresses. Change 'vtcd' type to 'void *' to avoid direct use. Use helper macros to access the TCD fields correctly. Call 'dma_set_mask_and_coherent(64)' when TCD64 is supported. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 18 +++--- drivers/dma/fsl-edma-common.h | 109 +++++++++++++++++++++++++++++----- drivers/dma/fsl-edma-main.c | 14 +++++ 3 files changed, 119 insertions(+), 22 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index d29824ed7c80f..47ab4db3d98ec 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -426,8 +426,7 @@ enum dma_status fsl_edma_tx_status(struct dma_chan *chan, return fsl_chan->status; } -static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, - struct fsl_edma_hw_tcd *tcd) +static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, void *tcd) { u16 csr = 0; @@ -478,9 +477,9 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, static inline void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan, - struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, - u16 attr, u16 soff, u32 nbytes, u32 slast, u16 citer, - u16 biter, u16 doff, u32 dlast_sga, bool major_int, + struct fsl_edma_hw_tcd *tcd, dma_addr_t src, dma_addr_t dst, + u16 attr, u16 soff, u32 nbytes, dma_addr_t slast, u16 citer, + u16 biter, u16 doff, dma_addr_t dlast_sga, bool major_int, bool disable_req, bool enable_sg) { struct dma_slave_config *cfg = &fsl_chan->cfg; @@ -581,8 +580,9 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( dma_addr_t dma_buf_next; bool major_int = true; int sg_len, i; - u32 src_addr, dst_addr, last_sg, nbytes; + dma_addr_t src_addr, dst_addr, last_sg; u16 soff, doff, iter; + u32 nbytes; if (!is_slave_direction(direction)) return NULL; @@ -654,8 +654,9 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); struct fsl_edma_desc *fsl_desc; struct scatterlist *sg; - u32 src_addr, dst_addr, last_sg, nbytes; + dma_addr_t src_addr, dst_addr, last_sg; u16 soff, doff, iter; + u32 nbytes; int i; if (!is_slave_direction(direction)) @@ -804,7 +805,8 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev, - sizeof(struct fsl_edma_hw_tcd), + fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ? + sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd), 32, 0); return 0; } diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 6c738c5cad118..5357dccdc1a40 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -87,6 +87,20 @@ struct fsl_edma_hw_tcd { __le16 biter; }; +struct fsl_edma_hw_tcd64 { + __le64 saddr; + __le16 soff; + __le16 attr; + __le32 nbytes; + __le64 slast; + __le64 daddr; + __le64 dlast_sga; + __le16 doff; + __le16 citer; + __le16 csr; + __le16 biter; +} __packed; + struct fsl_edma3_ch_reg { __le32 ch_csr; __le32 ch_es; @@ -96,7 +110,10 @@ struct fsl_edma3_ch_reg { __le32 ch_mux; __le32 ch_mattr; /* edma4, reserved for edma3 */ __le32 ch_reserved; - struct fsl_edma_hw_tcd tcd; + union { + struct fsl_edma_hw_tcd tcd; + struct fsl_edma_hw_tcd tcd64; + }; } __packed; /* @@ -125,7 +142,7 @@ struct edma_regs { struct fsl_edma_sw_tcd { dma_addr_t ptcd; - struct fsl_edma_hw_tcd *vtcd; + void *vtcd; }; struct fsl_edma_chan { @@ -144,7 +161,7 @@ struct fsl_edma_chan { u32 dma_dev_size; enum dma_data_direction dma_dir; char chan_name[32]; - struct fsl_edma_hw_tcd __iomem *tcd; + void __iomem *tcd; void __iomem *mux_addr; u32 real_count; struct work_struct issue_worker; @@ -188,6 +205,7 @@ struct fsl_edma_desc { #define FSL_EDMA_DRV_CLEAR_DONE_E_SG BIT(13) /* Need clean CHn_CSR DONE before enable TCD's MAJORELINK */ #define FSL_EDMA_DRV_CLEAR_DONE_E_LINK BIT(14) +#define FSL_EDMA_DRV_TCD64 BIT(15) #define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \ FSL_EDMA_DRV_BUS_8BYTE | \ @@ -231,15 +249,44 @@ struct fsl_edma_engine { struct fsl_edma_chan chans[] __counted_by(n_chans); }; +#define edma_read_tcdreg_c(chan, _tcd, __name) \ +(sizeof(_tcd->__name) == sizeof(u64) ? \ + edma_readq(chan->edma, &_tcd->__name) : \ + ((sizeof(_tcd->__name) == sizeof(u32)) ? \ + edma_readl(chan->edma, &_tcd->__name) : \ + edma_readw(chan->edma, &_tcd->__name) \ + )) + #define edma_read_tcdreg(chan, __name) \ -(sizeof(chan->tcd->__name) == sizeof(u32) ? \ - edma_readl(chan->edma, &chan->tcd->__name) : \ - edma_readw(chan->edma, &chan->tcd->__name)) +((fsl_edma_drvflags(chan) & FSL_EDMA_DRV_TCD64) ? \ + edma_read_tcdreg_c(chan, ((struct fsl_edma_hw_tcd64 *)chan->tcd), __name) : \ + edma_read_tcdreg_c(chan, ((struct fsl_edma_hw_tcd *)chan->tcd), __name) \ +) -#define edma_write_tcdreg(chan, val, __name) \ -(sizeof(chan->tcd->__name) == sizeof(u32) ? \ - edma_writel(chan->edma, (u32 __force)val, &chan->tcd->__name) : \ - edma_writew(chan->edma, (u16 __force)val, &chan->tcd->__name)) +#define edma_write_tcdreg_c(chan, _tcd, _val, __name) \ +do { \ + switch (sizeof(_tcd->__name)) { \ + case sizeof(u64): \ + edma_writeq(chan->edma, (u64 __force)_val, &_tcd->__name); \ + break; \ + case sizeof(u32): \ + edma_writel(chan->edma, (u32 __force)_val, &_tcd->__name); \ + break; \ + case sizeof(u16): \ + edma_writew(chan->edma, (u16 __force)_val, &_tcd->__name); \ + break; \ + case sizeof(u8): \ + edma_writeb(chan->edma, _val, &_tcd->__name); \ + break; \ + } \ +} while (0) + +#define edma_write_tcdreg(chan, val, __name) \ +do { if (fsl_edma_drvflags(chan) & FSL_EDMA_DRV_TCD64) \ + edma_write_tcdreg_c(chan, ((struct fsl_edma_hw_tcd64 *)chan->tcd), val, __name);\ + else \ + edma_write_tcdreg_c(chan, ((struct fsl_edma_hw_tcd *)chan->tcd), val, __name); \ +} while (0) #define edma_readl_chreg(chan, __name) \ edma_readl(chan->edma, \ @@ -249,17 +296,24 @@ struct fsl_edma_engine { edma_writel(chan->edma, val, \ (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name)) -#define fsl_edma_get_tcd(_chan, _tcd, _field) ((_tcd)->_field) +#define fsl_edma_get_tcd(_chan, _tcd, _field) \ +(fsl_edma_drvflags(_chan) & FSL_EDMA_DRV_TCD64 ? (((struct fsl_edma_hw_tcd64 *)_tcd)->_field) : \ + (((struct fsl_edma_hw_tcd *)_tcd)->_field)) #define fsl_edma_le_to_cpu(x) \ -(sizeof(x) == sizeof(u32) ? le32_to_cpu(x) : le16_to_cpu(x)) +(sizeof(x) == sizeof(u64) ? le64_to_cpu(x) : \ + (sizeof(x) == sizeof(u32) ? le32_to_cpu(x) : le16_to_cpu(x))) + #define fsl_edma_get_tcd_to_cpu(_chan, _tcd, _field) \ fsl_edma_le_to_cpu(fsl_edma_get_tcd(_chan, _tcd, _field)) -#define fsl_edma_set_tcd_to_le(_fsl_chan, _tcd, _val, _field) \ +#define fsl_edma_set_tcd_to_le_c(_tcd, _val, _field) \ do { \ - switch (sizeof((_tcd)->_field)) { \ + switch (sizeof((_tcd)->_field)) { \ + case sizeof(u64): \ + (_tcd)->_field = cpu_to_le64(_val); \ + break; \ case sizeof(u32): \ (_tcd)->_field = cpu_to_le32(_val); \ break; \ @@ -269,12 +323,29 @@ do { \ } \ } while (0) +#define fsl_edma_set_tcd_to_le(_chan, _tcd, _val, _field) \ +do { \ + if (fsl_edma_drvflags(_chan) & FSL_EDMA_DRV_TCD64) \ + fsl_edma_set_tcd_to_le_c((struct fsl_edma_hw_tcd64 *)_tcd, _val, _field); \ + else \ + fsl_edma_set_tcd_to_le_c((struct fsl_edma_hw_tcd *)_tcd, _val, _field); \ +} while (0) + /* * R/W functions for big- or little-endian registers: * The eDMA controller's endian is independent of the CPU core's endian. * For the big-endian IP module, the offset for 8-bit or 16-bit registers * should also be swapped opposite to that in little-endian IP. */ +static inline u64 edma_readq(struct fsl_edma_engine *edma, void __iomem *addr) +{ + /* ioread64 and ioread64be was not defined at some platform */ + if (edma->big_endian) + return swab64(readq(addr)); + else + return readq(addr); +} + static inline u32 edma_readl(struct fsl_edma_engine *edma, void __iomem *addr) { if (edma->big_endian) @@ -320,6 +391,16 @@ static inline void edma_writel(struct fsl_edma_engine *edma, iowrite32(val, addr); } +static inline void edma_writeq(struct fsl_edma_engine *edma, + u64 val, void __iomem *addr) +{ + /* iowrite64 and iowrite64be was not defined at some platform */ + if (edma->big_endian) + writeq(swab64(val), addr); + else + writeq(val, addr); +} + static inline struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan) { return container_of(chan, struct fsl_edma_chan, vchan.chan); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 8e5ddeb5e887f..84a5e0666d4f2 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -361,6 +361,16 @@ static struct fsl_edma_drvdata imx93_data4 = { .setup_irq = fsl_edma3_irq_init, }; +static struct fsl_edma_drvdata imx95_data5 = { + .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA4 | + FSL_EDMA_DRV_TCD64, + .chreg_space_sz = 0x8000, + .chreg_off = 0x10000, + .mux_off = 0x200, + .mux_skip = sizeof(u32), + .setup_irq = fsl_edma3_irq_init, +}; + static const struct of_device_id fsl_edma_dt_ids[] = { { .compatible = "fsl,vf610-edma", .data = &vf610_data}, { .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data}, @@ -369,6 +379,7 @@ static const struct of_device_id fsl_edma_dt_ids[] = { { .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data}, { .compatible = "fsl,imx93-edma3", .data = &imx93_data3}, { .compatible = "fsl,imx93-edma4", .data = &imx93_data4}, + { .compatible = "fsl,imx95-edma5", .data = &imx95_data5}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids); @@ -510,6 +521,9 @@ static int fsl_edma_probe(struct platform_device *pdev) return ret; } + if (drvdata->flags & FSL_EDMA_DRV_TCD64) + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + INIT_LIST_HEAD(&fsl_edma->dma_dev.channels); for (i = 0; i < fsl_edma->n_chans; i++) { struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i];