Skip to content

Commit

Permalink
Merge tag 'dmaengine-fix-4.16-rc5' of git://git.infradead.org/users/v…
Browse files Browse the repository at this point in the history
…koul/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
  • Loading branch information
torvalds committed Mar 11, 2018
2 parents d43be80 + 3cd2c31 commit abeb752
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/dma/mv-xor-v2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ Required properties:
interrupts.

Optional properties:
- clocks: Optional reference to the clock used by the XOR engine.
- clocks: Optional reference to the clocks used by the XOR engine.
- clock-names: mandatory if there is a second clock, in this case the
name must be "core" for the first clock and "reg" for the second
one


Example:

Expand Down
25 changes: 20 additions & 5 deletions drivers/dma/mv_xor_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ struct mv_xor_v2_device {
void __iomem *dma_base;
void __iomem *glob_base;
struct clk *clk;
struct clk *reg_clk;
struct tasklet_struct irq_tasklet;
struct list_head free_sw_desc;
struct dma_device dmadev;
Expand Down Expand Up @@ -749,13 +750,26 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
if (ret)
return ret;

xor_dev->reg_clk = devm_clk_get(&pdev->dev, "reg");
if (PTR_ERR(xor_dev->reg_clk) != -ENOENT) {
if (!IS_ERR(xor_dev->reg_clk)) {
ret = clk_prepare_enable(xor_dev->reg_clk);
if (ret)
return ret;
} else {
return PTR_ERR(xor_dev->reg_clk);
}
}

xor_dev->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (IS_ERR(xor_dev->clk) && PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) {
ret = EPROBE_DEFER;
goto disable_reg_clk;
}
if (!IS_ERR(xor_dev->clk)) {
ret = clk_prepare_enable(xor_dev->clk);
if (ret)
return ret;
goto disable_reg_clk;
}

ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1,
Expand Down Expand Up @@ -866,8 +880,9 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
free_msi_irqs:
platform_msi_domain_free_irqs(&pdev->dev);
disable_clk:
if (!IS_ERR(xor_dev->clk))
clk_disable_unprepare(xor_dev->clk);
clk_disable_unprepare(xor_dev->clk);
disable_reg_clk:
clk_disable_unprepare(xor_dev->reg_clk);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/sh/rcar-dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ rcar_dmac_chan_prep_sg(struct rcar_dmac_chan *chan, struct scatterlist *sgl,

rcar_dmac_chan_configure_desc(chan, desc);

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

/*
* Allocate and fill the transfer chunk descriptors. We own the only
Expand Down

0 comments on commit abeb752

Please sign in to comment.