Skip to content

Commit abeb752

Browse files
committed
Merge tag 'dmaengine-fix-4.16-rc5' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine fixes from Vinod Koul: "Two small fixes are for this cycle: - fix max_chunk_size for rcar-dmac for R-Car Gen3 - fix clock resource of mv_xor_v2" * tag 'dmaengine-fix-4.16-rc5' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: mv_xor_v2: Fix clock resource by adding a register clock dmaengine: rcar-dmac: fix max_chunk_size for R-Car Gen3
2 parents d43be80 + 3cd2c31 commit abeb752

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

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

drivers/dma/sh/rcar-dmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ rcar_dmac_chan_prep_sg(struct rcar_dmac_chan *chan, struct scatterlist *sgl,
917917

918918
rcar_dmac_chan_configure_desc(chan, desc);
919919

920-
max_chunk_size = (RCAR_DMATCR_MASK + 1) << desc->xfer_shift;
920+
max_chunk_size = RCAR_DMATCR_MASK << desc->xfer_shift;
921921

922922
/*
923923
* Allocate and fill the transfer chunk descriptors. We own the only

0 commit comments

Comments
 (0)