dmaengine: dw-axi-dmac: optional reset support
Subsystems (2)
PATCH 1/1 dmaengine: dw-axi-dmac: optional reset support
Use optional reset support to avoid having to add a new entry to dw_dma_of_id_table for each target requiring reset support
--- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +8 -12
@@ -48,8 +48,7 @@ DMA_SLAVE_BUSWIDTH_64_BYTES)#define AXI_DMA_FLAG_HAS_APB_REGS BIT(0) -#define AXI_DMA_FLAG_HAS_RESETS BIT(1) -#define AXI_DMA_FLAG_USE_CFG2 BIT(2) +#define AXI_DMA_FLAG_USE_CFG2 BIT(1)static inline void axi_dma_iowrite32 (struct axi_dma_chip *chip,u32 reg,u32 val)
@@ -1498,15 +1497,13 @@ static int dw_probe(struct platform_device *pdev)return PTR_ERR (chip->apb_regs); } -if (flags &AXI_DMA_FLAG_HAS_RESETS ) { - resets =devm_reset_control_array_get_exclusive (&pdev->dev); -if (IS_ERR (resets)) -return PTR_ERR (resets); + resets =devm_reset_control_array_get_optional_exclusive (&pdev->dev); +if (IS_ERR (resets)) +return PTR_ERR (resets); - ret =reset_control_deassert (resets); -if (ret) -return ret; - } + ret =reset_control_deassert (resets); +if (ret) +return ret; chip->dw->hdata->use_cfg2 = !!(flags &AXI_DMA_FLAG_USE_CFG2 );
@@ -1665,10 +1662,9 @@ static const struct of_device_id dw_dma_of_id_table[] = { .data = (void *)AXI_DMA_FLAG_HAS_APB_REGS, }, { .compatible = "starfive,jh7110-axi-dma", - .data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2), + .data = (void *)AXI_DMA_FLAG_USE_CFG2, }, { .compatible = "starfive,jh8100-axi-dma", - .data = (void *)AXI_DMA_FLAG_HAS_RESETS, }, {} };
Signature · 1 line
2.44.1
Classified as: {OPEN}
Hello,
Do you see any interest in this patch?
I believe it makes the driver more generic to match all current and future use cases on SoCs that uses this controller. Also, I think it simplifies the reading of the driver by removing if statement.
What do you think?
Regards,
Philippe
{OPEN}
Quoted 77 lines
-----Original Message-----
From: LECOINTRE Philippe
Sent: Wednesday, February 5, 2025 2:39 PM
To: Eugeniy Paltsev <[email protected]>; [email protected]
Cc: [email protected]; LENAIN Simon <[email protected]>; LEJEUNE Sebastien <[email protected]>; BARBEAU Etienne <[email protected]>; RENAULT Xavier <[email protected]>
Subject: [PATCH] dmaengine: dw-axi-dmac: optional reset supportUse optional reset support to avoid having to add a new entry to
dw_dma_of_id_tablefor each target requiring reset supportSigned-off-by Philippe Lecointre <[email protected]>Acked-by Simon Lenain <[email protected]>--- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +1
-2@@ -48,8 +48,7 @@ DMA_SLAVE_BUSWIDTH_64_BYTES)#define AXI_DMA_FLAG_HAS_APB_REGS BIT(0) -#define AXI_DMA_FLAG_HAS_RESETS BIT(1) -#define AXI_DMA_FLAG_USE_CFG2 BIT(2) +#define AXI_DMA_FLAG_USE_CFG2 BIT(1)static inline void axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val) @@ -1498,15 +1497,13 @@ static int
dw_probe(struct platform_device *pdev)drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +0
-2return PTR_ERR (chip->apb_regs); } -if (flags &AXI_DMA_FLAG_HAS_RESETS ) { - resets = devm_reset_control_array_get_exclusive(&pdev-Quoted 1 line
dev);
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +1
-2-if (IS_ERR (resets)) -return PTR_ERR (resets); + resets = devm_reset_control_array_get_optional_exclusive(&pdev-Quoted 1 line
dev);
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +5
-4+if (IS_ERR (resets)) +return PTR_ERR (resets); - ret =reset_control_deassert (resets); -if (ret) -return ret; - } + ret =reset_control_deassert (resets); +if (ret) +return ret; chip->dw->hdata->use_cfg2 = !!(flags &
AXI_DMA_FLAG_USE_CFG2);drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +1
-2@@ -1665,10 +1662,9 @@ static const struct of_device_id dw_dma_of_id_table[] = { .data = (void *)AXI_DMA_FLAG_HAS_APB_REGS , }, { .compatible = "starfive,jh7110-axi-dma", - .data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2), + .data = (void *)AXI_DMA_FLAG_USE_CFG2, }, { .compatible = "starfive,jh8100-axi-dma", - .data = (void *)AXI_DMA_FLAG_HAS_RESETS, },{}
};
--
2.44.1