Re: [PATCHv3 5/7] dmaengine: dw_dmac: add PCI part of the driver

From: Felipe Balbi
Date: Thu Sep 27 2012 - 03:54:40 EST


On Thu, Sep 27, 2012 at 10:31:59AM +0300, Andy Shevchenko wrote:
> From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
>
> This is the PCI part of the DesignWare DMAC driver. The controller is usually
> used in the Intel hardware such as Medfield.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> drivers/dma/Kconfig | 9 ++++
> drivers/dma/Makefile | 1 +
> drivers/dma/dw_dmac_pci.c | 126 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 136 insertions(+)
> create mode 100644 drivers/dma/dw_dmac_pci.c
>
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index df32537..a5c7f64 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -89,6 +89,15 @@ config DW_DMAC
> Support the Synopsys DesignWare AHB DMA controller. This
> can be integrated in chips such as the Atmel AT32ap7000.
>
> +config DW_DMAC_PCI
> + tristate "Synopsys DesignWare AHB DMA support (PCI bus)"
> + depends on PCI
> + select DW_DMAC
> + help
> + Support the Synopsys DesignWare AHB DMA controller on the platfroms
> + that provide it as a PCI device. For example, Intel Medfield has
> + integrated this GPDMA controller.
> +
> config AT_HDMAC
> tristate "Atmel AHB DMA support"
> depends on ARCH_AT91
> diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
> index 7428fea..15eef5f 100644
> --- a/drivers/dma/Makefile
> +++ b/drivers/dma/Makefile
> @@ -12,6 +12,7 @@ obj-$(CONFIG_FSL_DMA) += fsldma.o
> obj-$(CONFIG_MPC512X_DMA) += mpc512x_dma.o
> obj-$(CONFIG_MV_XOR) += mv_xor.o
> obj-$(CONFIG_DW_DMAC) += dw_dmac.o
> +obj-$(CONFIG_DW_DMAC_PCI) += dw_dmac_pci.o
> obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
> obj-$(CONFIG_MX3_IPU) += ipu/
> obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
> diff --git a/drivers/dma/dw_dmac_pci.c b/drivers/dma/dw_dmac_pci.c
> new file mode 100644
> index 0000000..b7ad37f
> --- /dev/null
> +++ b/drivers/dma/dw_dmac_pci.c
> @@ -0,0 +1,126 @@
> +/*
> + * PCI driver for the Synopsys DesignWare DMA Controller
> + *
> + * Copyright (C) 2012 Intel Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/platform_device.h>
> +#include <linux/dw_dmac.h>
> +
> +static struct dw_dma_platform_data pdata = {

"pdata" looks like it wants a prefix.

> + .is_private = 1,
> + .chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
> + .chan_priority = CHAN_PRIORITY_ASCENDING,
> +};

This is the same for all of the PCI IDs listed below, looks like it's
best to just add it as platform_data of the dwc_dmac device directly,
rather than passing a pointer to this via driver->data.

> +
> +static int __devinit dw_pci_probe(struct pci_dev *pdev,
> + const struct pci_device_id *id)
> +{
> + struct platform_device *pd;
> + struct resource r[2];
> + struct dw_dma_platform_data *driver = (void *)id->driver_data;

missing space after the cast... but it looks unnecessary

> + static int instance;

this could be a IDA instead.

--
balbi

Attachment: signature.asc
Description: Digital signature