提交 a7e34065 编写于 作者: B Barry Song 提交者: Vinod Koul

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: NBarry Song <Baohua.Song@csr.com>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 123b69ab
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk.h>
#include <linux/sirfsoc_dma.h> #include <linux/sirfsoc_dma.h>
#include "dmaengine.h" #include "dmaengine.h"
...@@ -78,6 +79,7 @@ struct sirfsoc_dma { ...@@ -78,6 +79,7 @@ struct sirfsoc_dma {
struct sirfsoc_dma_chan channels[SIRFSOC_DMA_CHANNELS]; struct sirfsoc_dma_chan channels[SIRFSOC_DMA_CHANNELS];
void __iomem *base; void __iomem *base;
int irq; int irq;
struct clk *clk;
bool is_marco; bool is_marco;
}; };
...@@ -639,6 +641,12 @@ static int sirfsoc_dma_probe(struct platform_device *op) ...@@ -639,6 +641,12 @@ static int sirfsoc_dma_probe(struct platform_device *op)
return -EINVAL; return -EINVAL;
} }
sdma->clk = devm_clk_get(dev, NULL);
if (IS_ERR(sdma->clk)) {
dev_err(dev, "failed to get a clock.\n");
return PTR_ERR(sdma->clk);
}
ret = of_address_to_resource(dn, 0, &res); ret = of_address_to_resource(dn, 0, &res);
if (ret) { if (ret) {
dev_err(dev, "Error parsing memory region!\n"); dev_err(dev, "Error parsing memory region!\n");
...@@ -698,6 +706,8 @@ static int sirfsoc_dma_probe(struct platform_device *op) ...@@ -698,6 +706,8 @@ static int sirfsoc_dma_probe(struct platform_device *op)
tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma); tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma);
clk_prepare_enable(sdma->clk);
/* Register DMA engine */ /* Register DMA engine */
dev_set_drvdata(dev, sdma); dev_set_drvdata(dev, sdma);
ret = dma_async_device_register(dma); ret = dma_async_device_register(dma);
...@@ -720,6 +730,7 @@ static int sirfsoc_dma_remove(struct platform_device *op) ...@@ -720,6 +730,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)
struct device *dev = &op->dev; struct device *dev = &op->dev;
struct sirfsoc_dma *sdma = dev_get_drvdata(dev); struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
clk_disable_unprepare(sdma->clk);
dma_async_device_unregister(&sdma->dma); dma_async_device_unregister(&sdma->dma);
free_irq(sdma->irq, sdma); free_irq(sdma->irq, sdma);
irq_dispose_mapping(sdma->irq); irq_dispose_mapping(sdma->irq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册