Skip to content

Commit 08d62f5

Browse files
andy-shevVinod Koul
authored andcommitted
dmaengine: dw: register IRQ and DMA pool with instance ID
It is really useful not only for debugging to have an IRQ line and DMA pool labeled with driver and its instance ID. Do this for DesignWare DMA driver. All current users of this IP would be enhanced later on. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent a46a763 commit 08d62f5

5 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎drivers/dma/dw/core.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,8 +1502,11 @@ int dw_dma_probe(struct dw_dma_chip *chip)
15021502
/* Force dma off, just in case */
15031503
dw_dma_off(dw);
15041504

1505+
/* Device and instance ID for IRQ and DMA pool */
1506+
snprintf(dw->name, sizeof(dw->name), "dw:dmac%d", chip->id);
1507+
15051508
/* Create a pool of consistent memory blocks for hardware descriptors */
1506-
dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev,
1509+
dw->desc_pool = dmam_pool_create(dw->name, chip->dev,
15071510
sizeof(struct dw_desc), 4, 0);
15081511
if (!dw->desc_pool) {
15091512
dev_err(chip->dev, "No memory for descriptors dma pool\n");
@@ -1514,7 +1517,7 @@ int dw_dma_probe(struct dw_dma_chip *chip)
15141517
tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
15151518

15161519
err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
1517-
"dw_dmac", dw);
1520+
dw->name, dw);
15181521
if (err)
15191522
goto err_pdata;
15201523

‎drivers/dma/dw/pci.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
4747
return -ENOMEM;
4848

4949
chip->dev = &pdev->dev;
50+
chip->id = pdev->devfn;
5051
chip->regs = pcim_iomap_table(pdev)[0];
5152
chip->irq = pdev->irq;
5253
chip->pdata = pdata;

‎drivers/dma/dw/platform.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static int dw_probe(struct platform_device *pdev)
202202
pdata = dw_dma_parse_dt(pdev);
203203

204204
chip->dev = dev;
205+
chip->id = pdev->id;
205206
chip->pdata = pdata;
206207

207208
chip->clk = devm_clk_get(chip->dev, "hclk");

‎drivers/dma/dw/regs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
270270

271271
struct dw_dma {
272272
struct dma_device dma;
273+
char name[20];
273274
void __iomem *regs;
274275
struct dma_pool *desc_pool;
275276
struct tasklet_struct tasklet;

‎include/linux/dma/dw.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct dw_dma;
2323
/**
2424
* struct dw_dma_chip - representation of DesignWare DMA controller hardware
2525
* @dev: struct device of the DMA controller
26+
* @id: instance ID
2627
* @irq: irq line
2728
* @regs: memory mapped I/O space
2829
* @clk: hclk clock
@@ -31,6 +32,7 @@ struct dw_dma;
3132
*/
3233
struct dw_dma_chip {
3334
struct device *dev;
35+
int id;
3436
int irq;
3537
void __iomem *regs;
3638
struct clk *clk;

0 commit comments

Comments
 (0)