[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1590659832-31476-5-git-send-email-EastL.Lee@mediatek.com>
Date: Thu, 28 May 2020 17:57:12 +0800
From: EastL <EastL.Lee@...iatek.com>
To: Sean Wang <sean.wang@...iatek.com>
CC: <vkoul@...nel.org>, <robh+dt@...nel.org>, <mark.rutland@....com>,
<matthias.bgg@...il.com>, <dmaengine@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<wsd_upstream@...iatek.com>, EastL <EastL.Lee@...iatek.com>
Subject: [PATCH v4 4/4] dmaengine: mediatek-cqdma: add dma mask for capability
This patch add dma mask for capability.
Change-Id: I31f4622f9541d769702029532e5f5f185815dda2
Signed-off-by: EastL <EastL.Lee@...iatek.com>
---
drivers/dma/mediatek/mtk-cqdma.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
index bca7118..1805a76 100644
--- a/drivers/dma/mediatek/mtk-cqdma.c
+++ b/drivers/dma/mediatek/mtk-cqdma.c
@@ -117,6 +117,7 @@ struct mtk_cqdma_vchan {
* @clk: The clock that device internal is using
* @dma_requests: The number of VCs the device supports to
* @dma_channels: The number of PCs the device supports to
+ * @dma_mask: A mask for DMA capability
* @vc: The pointer to all available VCs
* @pc: The pointer to all the underlying PCs
*/
@@ -126,6 +127,7 @@ struct mtk_cqdma_device {
u32 dma_requests;
u32 dma_channels;
+ u32 dma_mask;
struct mtk_cqdma_vchan *vc;
struct mtk_cqdma_pchan **pc;
};
@@ -549,6 +551,7 @@ static void mtk_cqdma_hw_deinit(struct mtk_cqdma_device *cqdma)
};
MODULE_DEVICE_TABLE(of, mtk_cqdma_match);
+static u64 cqdma_dmamask;
static int mtk_cqdma_probe(struct platform_device *pdev)
{
struct mtk_cqdma_device *cqdma;
@@ -607,6 +610,16 @@ static int mtk_cqdma_probe(struct platform_device *pdev)
cqdma->dma_channels = MTK_CQDMA_NR_PCHANS;
}
+ if (pdev->dev.of_node && of_property_read_u32(pdev->dev.of_node,
+ "dma-channel-mask",
+ &cqdma->dma_mask)) {
+ dev_info(&pdev->dev,
+ "Using 0 as missing dma-channel-mask property\n");
+ } else {
+ cqdma_dmamask = DMA_BIT_MASK(cqdma->dma_mask);
+ pdev->dev.dma_mask = &cqdma_dmamask;
+ }
+
cqdma->pc = devm_kcalloc(&pdev->dev, cqdma->dma_channels,
sizeof(*cqdma->pc), GFP_KERNEL);
if (!cqdma->pc)
--
1.9.1
Powered by blists - more mailing lists