From: Jaehoon Chung Date: Tue, 23 Jan 2024 04:22:34 +0000 (+0900) Subject: dmaengine: dw-axi-dmac: Check the HAS_APB_REGS flag X-Git-Tag: accepted/tizen/unified/toolchain/20240311.065846~35 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fkernel%2Flinux-starfive.git;a=commitdiff_plain;h=021f4d4acc673c6f619caf15ab5b47bd330546dd dmaengine: dw-axi-dmac: Check the HAS_APB_REGS flag Check the AXI_DMA_FLAGS_HAS_APB_REGS flags before checking chip->apb_regs. Even though its flags doesn't set, the below message is displaying like error. [ 24.879187] dw_axi_dmac_platform 16050000.dma-controller: apb_regs not initialized [ 26.928088] dw_axi_dmac_platform 16050000.dma-controller: apb_regs not initialized Change-Id: Ia2751ee2308d0b65dc2ec6b69c50be6af578546e Signed-off-by: Jaehoon Chung --- diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index dd02f84..8a03ab7 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -354,6 +354,9 @@ static void dw_axi_dma_set_byte_halfword(struct axi_dma_chan *chan, bool set) u32 offset = DMAC_APB_BYTE_WR_CH_EN; u32 reg_width, val; + if (!(chan->chip->flags & AXI_DMA_FLAG_HAS_APB_REGS)) + return; + if (!chan->chip->apb_regs) { dev_dbg(chan->chip->dev, "apb_regs not initialized\n"); return; @@ -521,6 +524,9 @@ static void dw_axi_dma_set_hw_channel(struct axi_dma_chan *chan, bool set) struct axi_dma_chip *chip = chan->chip; unsigned long reg_value, val; + if (!(chip->flags & AXI_DMA_FLAG_HAS_APB_REGS)) + return; + if (!chip->apb_regs) { dev_err(chip->dev, "apb_regs not initialized\n"); return; @@ -1377,7 +1383,6 @@ static int dw_probe(struct platform_device *pdev) struct dw_axi_dma *dw; struct dw_axi_dma_hcfg *hdata; struct reset_control *resets; - unsigned int flags; u32 i; int ret; @@ -1405,14 +1410,14 @@ static int dw_probe(struct platform_device *pdev) if (IS_ERR(chip->regs)) return PTR_ERR(chip->regs); - flags = (uintptr_t)of_device_get_match_data(&pdev->dev); - if (flags & AXI_DMA_FLAG_HAS_APB_REGS) { + chip->flags = (uintptr_t)of_device_get_match_data(&pdev->dev); + if (chip->flags & AXI_DMA_FLAG_HAS_APB_REGS) { chip->apb_regs = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(chip->apb_regs)) return PTR_ERR(chip->apb_regs); } - if (flags & AXI_DMA_FLAG_HAS_RESETS) { + if (chip->flags & AXI_DMA_FLAG_HAS_RESETS) { resets = devm_reset_control_array_get_exclusive(&pdev->dev); if (IS_ERR(resets)) return PTR_ERR(resets); @@ -1422,7 +1427,7 @@ static int dw_probe(struct platform_device *pdev) return ret; } - chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2); + chip->dw->hdata->use_cfg2 = !!(chip->flags & AXI_DMA_FLAG_USE_CFG2); chip->core_clk = devm_clk_get(chip->dev, "core-clk"); if (IS_ERR(chip->core_clk)) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h index eb267cb..3c7f089 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h @@ -71,6 +71,7 @@ struct axi_dma_chip { struct clk *core_clk; struct clk *cfgr_clk; struct dw_axi_dma *dw; + unsigned int flags; }; /* LLI == Linked List Item */