浏览代码

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>
Andy Shevchenko 8 年之前
父节点
当前提交
08d62f58aa
共有 5 个文件被更改,包括 10 次插入2 次删除
  1. 5 2
      drivers/dma/dw/core.c
  2. 1 0
      drivers/dma/dw/pci.c
  3. 1 0
      drivers/dma/dw/platform.c
  4. 1 0
      drivers/dma/dw/regs.h
  5. 2 0
      include/linux/dma/dw.h

+ 5 - 2
drivers/dma/dw/core.c

@@ -1502,8 +1502,11 @@ int dw_dma_probe(struct dw_dma_chip *chip)
 	/* Force dma off, just in case */
 	/* Force dma off, just in case */
 	dw_dma_off(dw);
 	dw_dma_off(dw);
 
 
+	/* Device and instance ID for IRQ and DMA pool */
+	snprintf(dw->name, sizeof(dw->name), "dw:dmac%d", chip->id);
+
 	/* Create a pool of consistent memory blocks for hardware descriptors */
 	/* Create a pool of consistent memory blocks for hardware descriptors */
-	dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev,
+	dw->desc_pool = dmam_pool_create(dw->name, chip->dev,
 					 sizeof(struct dw_desc), 4, 0);
 					 sizeof(struct dw_desc), 4, 0);
 	if (!dw->desc_pool) {
 	if (!dw->desc_pool) {
 		dev_err(chip->dev, "No memory for descriptors dma pool\n");
 		dev_err(chip->dev, "No memory for descriptors dma pool\n");
@@ -1514,7 +1517,7 @@ int dw_dma_probe(struct dw_dma_chip *chip)
 	tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
 	tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
 
 
 	err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
 	err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
-			  "dw_dmac", dw);
+			  dw->name, dw);
 	if (err)
 	if (err)
 		goto err_pdata;
 		goto err_pdata;
 
 

+ 1 - 0
drivers/dma/dw/pci.c

@@ -47,6 +47,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
 	chip->dev = &pdev->dev;
 	chip->dev = &pdev->dev;
+	chip->id = pdev->devfn;
 	chip->regs = pcim_iomap_table(pdev)[0];
 	chip->regs = pcim_iomap_table(pdev)[0];
 	chip->irq = pdev->irq;
 	chip->irq = pdev->irq;
 	chip->pdata = pdata;
 	chip->pdata = pdata;

+ 1 - 0
drivers/dma/dw/platform.c

@@ -202,6 +202,7 @@ static int dw_probe(struct platform_device *pdev)
 		pdata = dw_dma_parse_dt(pdev);
 		pdata = dw_dma_parse_dt(pdev);
 
 
 	chip->dev = dev;
 	chip->dev = dev;
+	chip->id = pdev->id;
 	chip->pdata = pdata;
 	chip->pdata = pdata;
 
 
 	chip->clk = devm_clk_get(chip->dev, "hclk");
 	chip->clk = devm_clk_get(chip->dev, "hclk");

+ 1 - 0
drivers/dma/dw/regs.h

@@ -270,6 +270,7 @@ static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
 
 
 struct dw_dma {
 struct dw_dma {
 	struct dma_device	dma;
 	struct dma_device	dma;
+	char			name[20];
 	void __iomem		*regs;
 	void __iomem		*regs;
 	struct dma_pool		*desc_pool;
 	struct dma_pool		*desc_pool;
 	struct tasklet_struct	tasklet;
 	struct tasklet_struct	tasklet;

+ 2 - 0
include/linux/dma/dw.h

@@ -23,6 +23,7 @@ struct dw_dma;
 /**
 /**
  * struct dw_dma_chip - representation of DesignWare DMA controller hardware
  * struct dw_dma_chip - representation of DesignWare DMA controller hardware
  * @dev:		struct device of the DMA controller
  * @dev:		struct device of the DMA controller
+ * @id:			instance ID
  * @irq:		irq line
  * @irq:		irq line
  * @regs:		memory mapped I/O space
  * @regs:		memory mapped I/O space
  * @clk:		hclk clock
  * @clk:		hclk clock
@@ -31,6 +32,7 @@ struct dw_dma;
  */
  */
 struct dw_dma_chip {
 struct dw_dma_chip {
 	struct device	*dev;
 	struct device	*dev;
+	int		id;
 	int		irq;
 	int		irq;
 	void __iomem	*regs;
 	void __iomem	*regs;
 	struct clk	*clk;
 	struct clk	*clk;