aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorBarry Song <Baohua.Song@csr.com>2013-03-18 04:33:43 -0400
committerVinod Koul <vinod.koul@intel.com>2013-04-15 00:21:18 -0400
commita7e340657a04777077a86e235f7074e8e261ac2e (patch)
tree5aab7a09e6fd9b96d010caacf600d8208773de72 /drivers/dma
parent123b69ab8020bc035b6d940417fbcc7aa27fd2b1 (diff)
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>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sirf-dma.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
index 1d627e2391f4..c4395294dc51 100644
--- a/drivers/dma/sirf-dma.c
+++ b/drivers/dma/sirf-dma.c
@@ -16,6 +16,7 @@
16#include <linux/of_address.h> 16#include <linux/of_address.h>
17#include <linux/of_device.h> 17#include <linux/of_device.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/clk.h>
19#include <linux/sirfsoc_dma.h> 20#include <linux/sirfsoc_dma.h>
20 21
21#include "dmaengine.h" 22#include "dmaengine.h"
@@ -78,6 +79,7 @@ struct sirfsoc_dma {
78 struct sirfsoc_dma_chan channels[SIRFSOC_DMA_CHANNELS]; 79 struct sirfsoc_dma_chan channels[SIRFSOC_DMA_CHANNELS];
79 void __iomem *base; 80 void __iomem *base;
80 int irq; 81 int irq;
82 struct clk *clk;
81 bool is_marco; 83 bool is_marco;
82}; 84};
83 85
@@ -639,6 +641,12 @@ static int sirfsoc_dma_probe(struct platform_device *op)
639 return -EINVAL; 641 return -EINVAL;
640 } 642 }
641 643
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
642 ret = of_address_to_resource(dn, 0, &res); 650 ret = of_address_to_resource(dn, 0, &res);
643 if (ret) { 651 if (ret) {
644 dev_err(dev, "Error parsing memory region!\n"); 652 dev_err(dev, "Error parsing memory region!\n");
@@ -698,6 +706,8 @@ static int sirfsoc_dma_probe(struct platform_device *op)
698 706
699 tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma); 707 tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma);
700 708
709 clk_prepare_enable(sdma->clk);
710
701 /* Register DMA engine */ 711 /* Register DMA engine */
702 dev_set_drvdata(dev, sdma); 712 dev_set_drvdata(dev, sdma);
703 ret = dma_async_device_register(dma); 713 ret = dma_async_device_register(dma);
@@ -720,6 +730,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)
720 struct device *dev = &op->dev; 730 struct device *dev = &op->dev;
721 struct sirfsoc_dma *sdma = dev_get_drvdata(dev); 731 struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
722 732
733 clk_disable_unprepare(sdma->clk);
723 dma_async_device_unregister(&sdma->dma); 734 dma_async_device_unregister(&sdma->dma);
724 free_irq(sdma->irq, sdma); 735 free_irq(sdma->irq, sdma);
725 irq_dispose_mapping(sdma->irq); 736 irq_dispose_mapping(sdma->irq);