Skip to content

Commit 2299285

Browse files
gclementgregkh
authored andcommitted
dmaengine: mv_xor_v2: Fix clock resource by adding a register clock
[ Upstream commit 3cd2c31 ] On the CP110 components which are present on the Armada 7K/8K SoC we need to explicitly enable the clock for the registers. However it is not needed for the AP8xx component, that's why this clock is optional. With this patch both clock have now a name, but in order to be backward compatible, the name of the first clock is not used. It allows to still use this clock with a device tree using the old binding. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e2d9442 commit 2299285

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎Documentation/devicetree/bindings/dma/mv-xor-v2.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Required properties:
1111
interrupts.
1212

1313
Optional 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+
1519

1620
Example:
1721

‎drivers/dma/mv_xor_v2.c‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct mv_xor_v2_device {
163163
void __iomem *dma_base;
164164
void __iomem *glob_base;
165165
struct clk *clk;
166+
struct clk *reg_clk;
166167
struct tasklet_struct irq_tasklet;
167168
struct list_head free_sw_desc;
168169
struct dma_device dmadev;
@@ -749,13 +750,26 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
749750
if (ret)
750751
return ret;
751752

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+
752764
xor_dev->clk = devm_clk_get(&pdev->dev, NULL);
753-
if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER)
754-
return -EPROBE_DEFER;
765+
if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) {
766+
ret = EPROBE_DEFER;
767+
goto disable_reg_clk;
768+
}
755769
if (!IS_ERR(xor_dev->clk)) {
756770
ret = clk_prepare_enable(xor_dev->clk);
757771
if (ret)
758-
return ret;
772+
goto disable_reg_clk;
759773
}
760774

761775
ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1,
@@ -866,8 +880,9 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
866880
free_msi_irqs:
867881
platform_msi_domain_free_irqs(&pdev->dev);
868882
disable_clk:
869-
if (!IS_ERR(xor_dev->clk))
870-
clk_disable_unprepare(xor_dev->clk);
883+
clk_disable_unprepare(xor_dev->clk);
884+
disable_reg_clk:
885+
clk_disable_unprepare(xor_dev->reg_clk);
871886
return ret;
872887
}
873888

0 commit comments

Comments
 (0)