From b377e670bac558a570f83a63c9ffb7cc79887d9b Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Tue, 25 Aug 2020 18:19:45 +0300 Subject: [PATCH] dmaengine: axi-dmac: move version read in probe The 'version' of the IP core will be needed to adapt the driver to a new feature (i.e. reading some DMA parameters from registers). To do that, the version will be checked, so this is being moved out of the axi_dmac_detect_caps() function. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20200825151950.57605-2-alexandru.ardelean@analog.com Signed-off-by: Vinod Koul --- drivers/dma/dma-axi-dmac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index f1d149e..088c791 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -774,12 +774,9 @@ static int axi_dmac_parse_chan_dt(struct device_node *of_chan, return 0; } -static int axi_dmac_detect_caps(struct axi_dmac *dmac) +static int axi_dmac_detect_caps(struct axi_dmac *dmac, unsigned int version) { struct axi_dmac_chan *chan = &dmac->chan; - unsigned int version; - - version = axi_dmac_read(dmac, ADI_AXI_REG_VERSION); axi_dmac_write(dmac, AXI_DMAC_REG_FLAGS, AXI_DMAC_FLAG_CYCLIC); if (axi_dmac_read(dmac, AXI_DMAC_REG_FLAGS) == AXI_DMAC_FLAG_CYCLIC) @@ -831,6 +828,7 @@ static int axi_dmac_probe(struct platform_device *pdev) struct axi_dmac *dmac; struct resource *res; struct regmap *regmap; + unsigned int version; int ret; dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); @@ -898,7 +896,9 @@ static int axi_dmac_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = axi_dmac_detect_caps(dmac); + version = axi_dmac_read(dmac, ADI_AXI_REG_VERSION); + + ret = axi_dmac_detect_caps(dmac, version); if (ret) goto err_clk_disable; -- 2.7.4