Re: [PATCH v2 2/8] dmaengine: dw: register IRQ and DMA pool with instance ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 02, 2017 at 12:00:43PM +0200, Andy Shevchenko wrote:
> 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.
> 
> Simultaneously enhance all current users of this IP.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/ata/sata_dwc_460ex.c          | 1 +
>  drivers/dma/dw/core.c                 | 7 +++++--
>  drivers/dma/dw/pci.c                  | 1 +
>  drivers/dma/dw/platform.c             | 1 +
>  drivers/dma/dw/regs.h                 | 1 +
>  drivers/tty/serial/8250/8250_lpss.c   | 1 +
>  include/linux/dma/dw.h                | 2 ++
>  sound/soc/intel/common/sst-firmware.c | 9 +++++----

the non DMA parts should be different patches for obvious reasons and they
should be CCed to respective mailing lists. I wont merge those without the
ACKs..

>  8 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
> index e0939bd5ea73..6e9b23c933ff 100644
> --- a/drivers/ata/sata_dwc_460ex.c
> +++ b/drivers/ata/sata_dwc_460ex.c
> @@ -248,6 +248,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
>  		return -ENOMEM;
>  
>  	hsdev->dma->dev = &pdev->dev;
> +	hsdev->dma->id = pdev->id;
>  
>  	/* Get SATA DMA interrupt number */
>  	hsdev->dma->irq = irq_of_parse_and_map(np, 1);
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index 45bb608a1b7c..482ca979e573 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -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;
>  
> diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
> index 0ae6c3b1d34e..456b6e6c9cca 100644
> --- a/drivers/dma/dw/pci.c
> +++ b/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;
>  
>  	chip->dev = &pdev->dev;
> +	chip->id = pdev->devfn;
>  	chip->regs = pcim_iomap_table(pdev)[0];
>  	chip->irq = pdev->irq;
>  	chip->pdata = pdata;
> diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
> index b1655e40cfa2..c639c60b825a 100644
> --- a/drivers/dma/dw/platform.c
> +++ b/drivers/dma/dw/platform.c
> @@ -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");
> diff --git a/drivers/dma/dw/regs.h b/drivers/dma/dw/regs.h
> index 4e0128c62704..6087eba2c275 100644
> --- a/drivers/dma/dw/regs.h
> +++ b/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 dma_device	dma;
> +	char			name[20];
>  	void __iomem		*regs;
>  	struct dma_pool		*desc_pool;
>  	struct tasklet_struct	tasklet;
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index 58cbb30a9401..bc527171380c 100644
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
> @@ -174,6 +174,7 @@ static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port)
>  	int ret;
>  
>  	chip->dev = &pdev->dev;
> +	chip->id = pdev->devfn;
>  	chip->irq = pci_irq_vector(pdev, 0);
>  	chip->regs = pci_ioremap_bar(pdev, 1);
>  	chip->pdata = &qrk_serial_dma_pdata;
> diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
> index ccfd0c3777df..b63b25814d77 100644
> --- a/include/linux/dma/dw.h
> +++ b/include/linux/dma/dw.h
> @@ -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;
> diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
> index a086c35f91bb..1e11d84405f3 100644
> --- a/sound/soc/intel/common/sst-firmware.c
> +++ b/sound/soc/intel/common/sst-firmware.c
> @@ -182,8 +182,8 @@ static int block_list_prepare(struct sst_dsp *dsp,
>  	return ret;
>  }
>  
> -static struct dw_dma_chip *dw_probe(struct device *dev, struct resource *mem,
> -	int irq)
> +static struct dw_dma_chip *dw_probe(struct device *dev, int id,
> +	struct resource *mem, int irq)
>  {
>  	struct dw_dma_chip *chip;
>  	int err;
> @@ -192,7 +192,6 @@ static struct dw_dma_chip *dw_probe(struct device *dev, struct resource *mem,
>  	if (!chip)
>  		return ERR_PTR(-ENOMEM);
>  
> -	chip->irq = irq;
>  	chip->regs = devm_ioremap_resource(dev, mem);
>  	if (IS_ERR(chip->regs))
>  		return ERR_CAST(chip->regs);
> @@ -202,6 +201,8 @@ static struct dw_dma_chip *dw_probe(struct device *dev, struct resource *mem,
>  		return ERR_PTR(err);
>  
>  	chip->dev = dev;
> +	chip->id = id;
> +	chip->irq = irq;
>  
>  	err = dw_dma_probe(chip);
>  	if (err)
> @@ -306,7 +307,7 @@ int sst_dma_new(struct sst_dsp *sst)
>  	mem.flags = IORESOURCE_MEM;
>  
>  	/* now register DMA engine device */
> -	dma->chip = dw_probe(sst->dma_dev, &mem, sst_pdata->irq);
> +	dma->chip = dw_probe(sst->dma_dev, (int)sst->id, &mem, sst_pdata->irq);
>  	if (IS_ERR(dma->chip)) {
>  		dev_err(sst->dev, "error: DMA device register failed\n");
>  		ret = PTR_ERR(dma->chip);
> -- 
> 2.11.0
> 

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux