Skip to content

Commit

Permalink
dmaengine: axi-dmac: move clock enable earlier
Browse files Browse the repository at this point in the history
The clock may also be required to read registers from the IP core (if it is
provided and the driver needs to control it).
So, move it earlier in the probe.

Signed-off-by: Alexandru Ardelean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
commodo authored and vinodkoul committed Aug 25, 2020
1 parent a88fdec commit 08b36db
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions drivers/dma/dma-axi-dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,16 +850,23 @@ static int axi_dmac_probe(struct platform_device *pdev)
if (IS_ERR(dmac->clk))
return PTR_ERR(dmac->clk);

ret = clk_prepare_enable(dmac->clk);
if (ret < 0)
return ret;

of_channels = of_get_child_by_name(pdev->dev.of_node, "adi,channels");
if (of_channels == NULL)
return -ENODEV;
if (of_channels == NULL) {
ret = -ENODEV;
goto err_clk_disable;
}

for_each_child_of_node(of_channels, of_chan) {
ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
if (ret) {
of_node_put(of_chan);
of_node_put(of_channels);
return -EINVAL;
ret = -EINVAL;
goto err_clk_disable;
}
}
of_node_put(of_channels);
Expand Down Expand Up @@ -892,10 +899,6 @@ static int axi_dmac_probe(struct platform_device *pdev)
dmac->chan.vchan.desc_free = axi_dmac_desc_free;
vchan_init(&dmac->chan.vchan, dma_dev);

ret = clk_prepare_enable(dmac->clk);
if (ret < 0)
return ret;

version = axi_dmac_read(dmac, ADI_AXI_REG_VERSION);

ret = axi_dmac_detect_caps(dmac, version);
Expand Down

0 comments on commit 08b36db

Please sign in to comment.