diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2020-08-25 18:19:47 +0300 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-08-25 21:07:10 +0530 |
commit | 08b36dba23e5b26a3f5dbeb5b0d8d7462ab38c12 (patch) | |
tree | 32d058cf00a72c203ee97c26554bdfb5dbddf5d8 /drivers/dma | |
parent | a88fdece44d40cd577454f0610ca7d2e37ca74df (diff) |
dmaengine: axi-dmac: move clock enable earlier
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 <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200825151950.57605-4-alexandru.ardelean@analog.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dma-axi-dmac.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index 90a99bdffa2b..f4b17b5e3914 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -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); @@ -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); |