aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/dma/mv-xor-v2.txt6
-rw-r--r--drivers/dma/mv_xor_v2.c25
2 files changed, 25 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/dma/mv-xor-v2.txt b/Documentation/devicetree/bindings/dma/mv-xor-v2.txt
index 217a90eaabe7..9c38bbe7e6d7 100644
--- a/Documentation/devicetree/bindings/dma/mv-xor-v2.txt
+++ b/Documentation/devicetree/bindings/dma/mv-xor-v2.txt
@@ -11,7 +11,11 @@ Required properties:
11 interrupts. 11 interrupts.
12 12
13Optional properties: 13Optional properties:
14- clocks: Optional reference to the clock used by the XOR engine. 14- clocks: Optional reference to the clocks used by the XOR engine.
15- clock-names: mandatory if there is a second clock, in this case the
16 name must be "core" for the first clock and "reg" for the second
17 one
18
15 19
16Example: 20Example:
17 21
diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index f652a0e0f5a2..3548caa9e933 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -163,6 +163,7 @@ struct mv_xor_v2_device {
163 void __iomem *dma_base; 163 void __iomem *dma_base;
164 void __iomem *glob_base; 164 void __iomem *glob_base;
165 struct clk *clk; 165 struct clk *clk;
166 struct clk *reg_clk;
166 struct tasklet_struct irq_tasklet; 167 struct tasklet_struct irq_tasklet;
167 struct list_head free_sw_desc; 168 struct list_head free_sw_desc;
168 struct dma_device dmadev; 169 struct dma_device dmadev;
@@ -749,13 +750,26 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
749 if (ret) 750 if (ret)
750 return ret; 751 return ret;
751 752
753 xor_dev->reg_clk = devm_clk_get(&pdev->dev, "reg");
754 if (PTR_ERR(xor_dev->reg_clk) != -ENOENT) {
755 if (!IS_ERR(xor_dev->reg_clk)) {
756 ret = clk_prepare_enable(xor_dev->reg_clk);
757 if (ret)
758 return ret;
759 } else {
760 return PTR_ERR(xor_dev->reg_clk);
761 }
762 }
763
752 xor_dev->clk = devm_clk_get(&pdev->dev, NULL); 764 xor_dev->clk = devm_clk_get(&pdev->dev, NULL);
753 if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) 765 if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) {
754 return -EPROBE_DEFER; 766 ret = EPROBE_DEFER;
767 goto disable_reg_clk;
768 }
755 if (!IS_ERR(xor_dev->clk)) { 769 if (!IS_ERR(xor_dev->clk)) {
756 ret = clk_prepare_enable(xor_dev->clk); 770 ret = clk_prepare_enable(xor_dev->clk);
757 if (ret) 771 if (ret)
758 return ret; 772 goto disable_reg_clk;
759 } 773 }
760 774
761 ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1, 775 ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1,
@@ -866,8 +880,9 @@ free_hw_desq:
866free_msi_irqs: 880free_msi_irqs:
867 platform_msi_domain_free_irqs(&pdev->dev); 881 platform_msi_domain_free_irqs(&pdev->dev);
868disable_clk: 882disable_clk:
869 if (!IS_ERR(xor_dev->clk)) 883 clk_disable_unprepare(xor_dev->clk);
870 clk_disable_unprepare(xor_dev->clk); 884disable_reg_clk:
885 clk_disable_unprepare(xor_dev->reg_clk);
871 return ret; 886 return ret;
872} 887}
873 888