Skip to content

Commit

Permalink
dmaengine: axi-dmac: move version read in probe
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
commodo committed Aug 19, 2020
1 parent d424174 commit 10204f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/dma/dma-axi-dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,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)
Expand Down Expand Up @@ -894,6 +891,7 @@ static int axi_dmac_probe(struct platform_device *pdev)
struct dma_device *dma_dev;
struct axi_dmac *dmac;
struct resource *res;
unsigned int version;
int ret;

dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
Expand Down Expand Up @@ -962,7 +960,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;

Expand Down

0 comments on commit 10204f1

Please sign in to comment.