Skip to content

Commit a7e3406

Browse files
21cnbaoVinod Koul
authored andcommitted
dmaengine:sirf:take clock and enable it while probing
there is hardcode which enabled the clock of dmaengine before, this patch takes the clock by standard clock API and enable it in probe. Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 123b69a commit a7e3406

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎drivers/dma/sirf-dma.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/of_address.h>
1717
#include <linux/of_device.h>
1818
#include <linux/of_platform.h>
19+
#include <linux/clk.h>
1920
#include <linux/sirfsoc_dma.h>
2021

2122
#include "dmaengine.h"
@@ -78,6 +79,7 @@ struct sirfsoc_dma {
7879
struct sirfsoc_dma_chan channels[SIRFSOC_DMA_CHANNELS];
7980
void __iomem *base;
8081
int irq;
82+
struct clk *clk;
8183
bool is_marco;
8284
};
8385

@@ -639,6 +641,12 @@ static int sirfsoc_dma_probe(struct platform_device *op)
639641
return -EINVAL;
640642
}
641643

644+
sdma->clk = devm_clk_get(dev, NULL);
645+
if (IS_ERR(sdma->clk)) {
646+
dev_err(dev, "failed to get a clock.\n");
647+
return PTR_ERR(sdma->clk);
648+
}
649+
642650
ret = of_address_to_resource(dn, 0, &res);
643651
if (ret) {
644652
dev_err(dev, "Error parsing memory region!\n");
@@ -698,6 +706,8 @@ static int sirfsoc_dma_probe(struct platform_device *op)
698706

699707
tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma);
700708

709+
clk_prepare_enable(sdma->clk);
710+
701711
/* Register DMA engine */
702712
dev_set_drvdata(dev, sdma);
703713
ret = dma_async_device_register(dma);
@@ -720,6 +730,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)
720730
struct device *dev = &op->dev;
721731
struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
722732

733+
clk_disable_unprepare(sdma->clk);
723734
dma_async_device_unregister(&sdma->dma);
724735
free_irq(sdma->irq, sdma);
725736
irq_dispose_mapping(sdma->irq);

0 commit comments

Comments
 (0)