Skip to content

Commit e73a9a1

Browse files
docularxuvinodkoul
authored andcommitted
dmaengine: mmp_pdma: Add clock support
Add support for retrieving and enabling an optional clock during mmp_pdma_probe(). It is optional because in Marvell devices such as "marvell,pdma-1.0" the clocks property is not a required property. But in SpacemiT K1 PDMA, "spacemit,k1-pdma" as the dt binding schema file stated, clocks is required. Signed-off-by: Guodong Xu <guodong@riscstar.com> Link: https://lore.kernel.org/r/20250822-working_dma_0701_v2-v5-2-f5c0eda734cc@riscstar.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 39ce725 commit e73a9a1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/dma/mmp_pdma.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/device.h>
1616
#include <linux/platform_data/mmp_dma.h>
1717
#include <linux/dmapool.h>
18+
#include <linux/clk.h>
1819
#include <linux/of_dma.h>
1920
#include <linux/of.h>
2021

@@ -1019,6 +1020,7 @@ static int mmp_pdma_probe(struct platform_device *op)
10191020
{
10201021
struct mmp_pdma_device *pdev;
10211022
struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev);
1023+
struct clk *clk;
10221024
int i, ret, irq = 0;
10231025
int dma_channels = 0, irq_num = 0;
10241026
const enum dma_slave_buswidth widths =
@@ -1037,6 +1039,10 @@ static int mmp_pdma_probe(struct platform_device *op)
10371039
if (IS_ERR(pdev->base))
10381040
return PTR_ERR(pdev->base);
10391041

1042+
clk = devm_clk_get_optional_enabled(pdev->dev, NULL);
1043+
if (IS_ERR(clk))
1044+
return PTR_ERR(clk);
1045+
10401046
if (pdev->dev->of_node) {
10411047
/* Parse new and deprecated dma-channels properties */
10421048
if (of_property_read_u32(pdev->dev->of_node, "dma-channels",

0 commit comments

Comments
 (0)