dmaengine: dw: register IRQ and DMA pool with instance ID
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 17 Jan 2017 11:57:26 +0000 (13:57 +0200)
committerVinod Koul <vinod.koul@intel.com>
Wed, 25 Jan 2017 06:21:39 +0000 (11:51 +0530)
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>
drivers/dma/dw/core.c
drivers/dma/dw/pci.c
drivers/dma/dw/platform.c
drivers/dma/dw/regs.h
include/linux/dma/dw.h

index 45bb608a1b7ce3bed49f49c743cc92ade06076c7..87516246c445172497e1c337dc34b665bdafe97d 100644 (file)
@@ -1502,8 +1502,11 @@ int dw_dma_probe(struct dw_dma_chip *chip)
        /* Force dma off, just in case */
        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 */
-       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);
        if (!dw->desc_pool) {
                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);
 
        err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
-                         "dw_dmac", dw);
+                         dw->name, dw);
        if (err)
                goto err_pdata;
 
index 7558a9c38fdaa855cb087051f979c09ee4d92d99..47194372f738d128bb4e09e2b58bdd0783718ce3 100644 (file)
@@ -47,6 +47,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
                return -ENOMEM;
 
        chip->dev = &pdev->dev;
+       chip->id = pdev->devfn;
        chip->regs = pcim_iomap_table(pdev)[0];
        chip->irq = pdev->irq;
        chip->pdata = pdata;
index b1655e40cfa24f7313e11c49c7394951cda68451..c639c60b825abfcc5c1743096f855ccc413fe834 100644 (file)
@@ -202,6 +202,7 @@ static int dw_probe(struct platform_device *pdev)
                pdata = dw_dma_parse_dt(pdev);
 
        chip->dev = dev;
+       chip->id = pdev->id;
        chip->pdata = pdata;
 
        chip->clk = devm_clk_get(chip->dev, "hclk");
index 4e0128c627047741487123e8d51e38c010b6f914..6087eba2c27537e378f9d42a95ce0d85fcaa6cdd 100644 (file)
@@ -270,6 +270,7 @@ static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
 
 struct dw_dma {
        struct dma_device       dma;
+       char                    name[20];
        void __iomem            *regs;
        struct dma_pool         *desc_pool;
        struct tasklet_struct   tasklet;
index ccfd0c3777df20d2bd9c6cd1518673643369c1ad..b63b25814d77df827131c608574fa86821040b8a 100644 (file)
@@ -23,6 +23,7 @@ struct dw_dma;
 /**
  * struct dw_dma_chip - representation of DesignWare DMA controller hardware
  * @dev:               struct device of the DMA controller
+ * @id:                        instance ID
  * @irq:               irq line
  * @regs:              memory mapped I/O space
  * @clk:               hclk clock
@@ -31,6 +32,7 @@ struct dw_dma;
  */
 struct dw_dma_chip {
        struct device   *dev;
+       int             id;
        int             irq;
        void __iomem    *regs;
        struct clk      *clk;