All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-12 16:57 ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss
  Cc: linux-kernel, grant.likely

This series add the device tree support to Atmel DMA controller driver:
at_hdmac.
The removal of platform data ease the conversion to device tree. It also have
the additional benefit of being simpler and cleaner.

Nicolas Ferre (4):
      dmaengine: at_hdmac: platform data move to use .id_table
      dmaengine: at_hdmac: add device tree support
      ARM: at91/dma: remove platform data from DMA controller
      ARM: at91/dma: DMA controller registering with DT support

 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
 arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
 arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
 arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
 drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
 drivers/dma/at_hdmac_regs.h                        |    8 ++
 6 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-12 16:57 ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robherring2-Re5JQEeQqe8AvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA

This series add the device tree support to Atmel DMA controller driver:
at_hdmac.
The removal of platform data ease the conversion to device tree. It also have
the additional benefit of being simpler and cleaner.

Nicolas Ferre (4):
      dmaengine: at_hdmac: platform data move to use .id_table
      dmaengine: at_hdmac: add device tree support
      ARM: at91/dma: remove platform data from DMA controller
      ARM: at91/dma: DMA controller registering with DT support

 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
 arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
 arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
 arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
 drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
 drivers/dma/at_hdmac_regs.h                        |    8 ++
 6 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-12 16:57 ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

This series add the device tree support to Atmel DMA controller driver:
at_hdmac.
The removal of platform data ease the conversion to device tree. It also have
the additional benefit of being simpler and cleaner.

Nicolas Ferre (4):
      dmaengine: at_hdmac: platform data move to use .id_table
      dmaengine: at_hdmac: add device tree support
      ARM: at91/dma: remove platform data from DMA controller
      ARM: at91/dma: DMA controller registering with DT support

 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
 arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
 arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
 arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
 drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
 drivers/dma/at_hdmac_regs.h                        |    8 ++
 6 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-12 16:57   ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss
  Cc: linux-kernel, grant.likely, Nicolas Ferre

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-12 16:57   ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robherring2-Re5JQEeQqe8AvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-12 16:57   ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
  2011-10-12 16:57 ` Nicolas Ferre
@ 2011-10-12 16:57     ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss
  Cc: linux-kernel, grant.likely, Nicolas Ferre

Add device tree probe support for atmel at_hdmac DMA driver.
Bindings are added to specify DMA controller configuration.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
 drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
 2 files changed, 43 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
new file mode 100644
index 0000000..3c046ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -0,0 +1,14 @@
+* Atmel Direct Memory Access Controller (DMA)
+
+Required properties:
+- compatible: Should be "atmel,<chip>-dma"
+- reg: Should contain DMA registers location and length
+- interrupts: Should contain DMA interrupt
+
+Examples:
+
+dma@ffffec00 {
+	compatible = "atmel,at91sam9g45-dma";
+	reg = <0xffffec00 0x200>;
+	interrupts = <21>;
+};
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c5..42bd64c 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "at_hdmac_regs.h"
 
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_dma_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9rl-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9RL
+	}, {
+		.compatible = "atmel,at91sam9g45-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9G45
+	}, { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
+#endif
+
 static struct platform_device_id atdma_devtypes[] = {
 	{
 		.name = "at91sam9rl_dma",
@@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
 	}
 };
 
+static inline enum atdma_devtype __init at_dma_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
+		return (enum atdma_devtype)match->data;
+	}
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1218,7 +1245,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, cap_mask);
 
 	/* get DMA parameters from controller type */
-	atdmatype = platform_get_device_id(pdev)->driver_data;
+	atdmatype = at_dma_get_driver_data(pdev);
 
 	switch (atdmatype) {
 	case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1553,7 @@ static struct platform_driver at_dma_driver = {
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
+		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
 	},
 };
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
@ 2011-10-12 16:57     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree probe support for atmel at_hdmac DMA driver.
Bindings are added to specify DMA controller configuration.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
 drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
 2 files changed, 43 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
new file mode 100644
index 0000000..3c046ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -0,0 +1,14 @@
+* Atmel Direct Memory Access Controller (DMA)
+
+Required properties:
+- compatible: Should be "atmel,<chip>-dma"
+- reg: Should contain DMA registers location and length
+- interrupts: Should contain DMA interrupt
+
+Examples:
+
+dma at ffffec00 {
+	compatible = "atmel,at91sam9g45-dma";
+	reg = <0xffffec00 0x200>;
+	interrupts = <21>;
+};
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c5..42bd64c 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "at_hdmac_regs.h"
 
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_dma_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9rl-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9RL
+	}, {
+		.compatible = "atmel,at91sam9g45-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9G45
+	}, { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
+#endif
+
 static struct platform_device_id atdma_devtypes[] = {
 	{
 		.name = "at91sam9rl_dma",
@@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
 	}
 };
 
+static inline enum atdma_devtype __init at_dma_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
+		return (enum atdma_devtype)match->data;
+	}
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1218,7 +1245,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, cap_mask);
 
 	/* get DMA parameters from controller type */
-	atdmatype = platform_get_device_id(pdev)->driver_data;
+	atdmatype = at_dma_get_driver_data(pdev);
 
 	switch (atdmatype) {
 	case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1553,7 @@ static struct platform_driver at_dma_driver = {
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
+		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
 	},
 };
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-12 16:57     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss
  Cc: linux-kernel, grant.likely, Nicolas Ferre

DMA controller can deduce its configuration data from
the platform. Remove the platform data and match device
types with the compatible ones.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
 arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
 arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
 3 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 600bffb..c9b897f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -38,10 +38,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 8,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9g45_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
-	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index aacb19d..81954f7 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -33,10 +33,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 2,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9rl_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index 187cb58..652c1a1 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -14,16 +14,6 @@
 #include <linux/dmaengine.h>
 
 /**
- * struct at_dma_platform_data - Controller configuration parameters
- * @nr_channels: Number of channels supported by hardware (max 8)
- * @cap_mask: dma_capability flags supported by the platform
- */
-struct at_dma_platform_data {
-	unsigned int	nr_channels;
-	dma_cap_mask_t  cap_mask;
-};
-
-/**
  * enum at_dma_slave_width - DMA slave register access width.
  * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
  * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-12 16:57     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robherring2-Re5JQEeQqe8AvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA

DMA controller can deduce its configuration data from
the platform. Remove the platform data and match device
types with the compatible ones.

Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
 arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
 arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
 3 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 600bffb..c9b897f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -38,10 +38,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 8,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9g45_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
-	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index aacb19d..81954f7 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -33,10 +33,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 2,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9rl_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index 187cb58..652c1a1 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -14,16 +14,6 @@
 #include <linux/dmaengine.h>
 
 /**
- * struct at_dma_platform_data - Controller configuration parameters
- * @nr_channels: Number of channels supported by hardware (max 8)
- * @cap_mask: dma_capability flags supported by the platform
- */
-struct at_dma_platform_data {
-	unsigned int	nr_channels;
-	dma_cap_mask_t  cap_mask;
-};
-
-/**
  * enum at_dma_slave_width - DMA slave register access width.
  * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
  * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-12 16:57     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

DMA controller can deduce its configuration data from
the platform. Remove the platform data and match device
types with the compatible ones.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
 arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
 arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
 3 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 600bffb..c9b897f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -38,10 +38,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 8,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9g45_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
-	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index aacb19d..81954f7 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -33,10 +33,6 @@
 #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
 static u64 hdmac_dmamask = DMA_BIT_MASK(32);
 
-static struct at_dma_platform_data atdma_pdata = {
-	.nr_channels	= 2,
-};
-
 static struct resource hdmac_resources[] = {
 	[0] = {
 		.start	= AT91_BASE_SYS + AT91_DMA,
@@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
 };
 
 static struct platform_device at_hdmac_device = {
-	.name		= "at_hdmac",
+	.name		= "at91sam9rl_dma",
 	.id		= -1,
 	.dev		= {
 				.dma_mask		= &hdmac_dmamask,
 				.coherent_dma_mask	= DMA_BIT_MASK(32),
-				.platform_data		= &atdma_pdata,
 	},
 	.resource	= hdmac_resources,
 	.num_resources	= ARRAY_SIZE(hdmac_resources),
@@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index 187cb58..652c1a1 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -14,16 +14,6 @@
 #include <linux/dmaengine.h>
 
 /**
- * struct at_dma_platform_data - Controller configuration parameters
- * @nr_channels: Number of channels supported by hardware (max 8)
- * @cap_mask: dma_capability flags supported by the platform
- */
-struct at_dma_platform_data {
-	unsigned int	nr_channels;
-	dma_cap_mask_t  cap_mask;
-};
-
-/**
  * enum at_dma_slave_width - DMA slave register access width.
  * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
  * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support
  2011-10-12 16:57 ` Nicolas Ferre
@ 2011-10-12 16:57     ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss
  Cc: linux-kernel, grant.likely, Nicolas Ferre

Device tree support on at91sam9g45 family SoC. Only call
platform_device_register() if no dma-controller node is
found in device tree.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index c9b897f..b9888c5 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -64,7 +64,13 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	platform_device_register(&at_hdmac_device);
+	struct device_node *of_node =
+		of_find_node_by_name(NULL, "dma-controller");
+
+	if (of_node)
+		of_node_put(of_node);
+	else
+		platform_device_register(&at_hdmac_device);
 }
 #else
 void __init at91_add_device_hdmac(void) {}
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support
@ 2011-10-12 16:57     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-12 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

Device tree support on at91sam9g45 family SoC. Only call
platform_device_register() if no dma-controller node is
found in device tree.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index c9b897f..b9888c5 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -64,7 +64,13 @@ static struct platform_device at_hdmac_device = {
 
 void __init at91_add_device_hdmac(void)
 {
-	platform_device_register(&at_hdmac_device);
+	struct device_node *of_node =
+		of_find_node_by_name(NULL, "dma-controller");
+
+	if (of_node)
+		of_node_put(of_node);
+	else
+		platform_device_register(&at_hdmac_device);
 }
 #else
 void __init at91_add_device_hdmac(void) {}
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table
  2011-10-12 16:57   ` Nicolas Ferre
@ 2011-10-13  0:32     ` Grant Likely
  -1 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:32 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss,
	linux-kernel

On Wed, Oct 12, 2011 at 06:57:11PM +0200, Nicolas Ferre wrote:
> We remove the use of platform data from DMA controller driver.
> We now use of .id_table to distinguish between compatible
> types. The two implementations allow to determine the
> number of channels and the capabilities of the controller.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>  2 files changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index fcfa0a8..d1869c5 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +static struct platform_device_id atdma_devtypes[] = {
> +	{
> +		.name = "at91sam9rl_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
> +	}, {
> +		.name = "at91sam9g45_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>  
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
> -	struct at_dma_platform_data *pdata;
>  	struct resource		*io;
>  	struct at_dma		*atdma;
>  	size_t			size;
>  	int			irq;
>  	int			err;
>  	int			i;
> +	u32                     nr_channels;
> +	dma_cap_mask_t          cap_mask = {};
> +	enum atdma_devtype	atdmatype;
> +
> +	dma_cap_set(DMA_MEMCPY, cap_mask);
> +
> +	/* get DMA parameters from controller type */
> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>  
> -	/* get DMA Controller parameters from platform */
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
> +	switch (atdmatype) {
> +	case ATDMA_DEVTYPE_SAM9RL:
> +		nr_channels = 2;
> +		break;
> +	case ATDMA_DEVTYPE_SAM9G45:
> +		nr_channels = 8;
> +		dma_cap_set(DMA_SLAVE, cap_mask);
> +		break;
> +	default:
>  		return -EINVAL;
> +	}
>  
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!io)
> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	size = sizeof(struct at_dma);
> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
> +	size += nr_channels * sizeof(struct at_dma_chan);
>  	atdma = kzalloc(size, GFP_KERNEL);
>  	if (!atdma)
>  		return -ENOMEM;
>  
> -	/* discover transaction capabilites from the platform data */
> -	atdma->dma_common.cap_mask = pdata->cap_mask;
> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
> +	/* discover transaction capabilities */
> +	atdma->dma_common.cap_mask = cap_mask;
> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
> +	atdma->devtype = atdmatype;
>  
>  	size = resource_size(io);
>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  
>  	/* initialize channels related values */
>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
> -	for (i = 0; i < pdata->nr_channels; i++) {
> +	for (i = 0; i < nr_channels; i++) {
>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>  
>  		atchan->chan_common.device = &atdma->dma_common;
> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
> -	  pdata->nr_channels);
> +	  nr_channels);
>  
>  	dma_async_device_register(&atdma->dma_common);
>  
> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>  static struct platform_driver at_dma_driver = {
>  	.remove		= __exit_p(at_dma_remove),
>  	.shutdown	= at_dma_shutdown,
> +	.id_table	= atdma_devtypes,
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index aa4c9ae..d7d6737 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>  
>  /*--  Controller  ------------------------------------------------------*/
>  
> +enum atdma_devtype {
> +	ATDMA_DEVTYPE_UNDEFINED = 0,
> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
> +};
> +
>  /**
>   * struct at_dma - internal representation of an Atmel HDMA Controller
>   * @chan_common: common dmaengine dma_device object members
> + * @atdma_devtype: identifier of DMA controller compatibility
>   * @ch_regs: memory mapped register base
>   * @clk: dma controller clock
>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>   */
>  struct at_dma {
>  	struct dma_device	dma_common;
> +	enum atdma_devtype	devtype;
>  	void __iomem		*regs;
>  	struct clk		*clk;
>  	u32			save_imr;
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-13  0:32     ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 12, 2011 at 06:57:11PM +0200, Nicolas Ferre wrote:
> We remove the use of platform data from DMA controller driver.
> We now use of .id_table to distinguish between compatible
> types. The two implementations allow to determine the
> number of channels and the capabilities of the controller.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>  2 files changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index fcfa0a8..d1869c5 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +static struct platform_device_id atdma_devtypes[] = {
> +	{
> +		.name = "at91sam9rl_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
> +	}, {
> +		.name = "at91sam9g45_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>  
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
> -	struct at_dma_platform_data *pdata;
>  	struct resource		*io;
>  	struct at_dma		*atdma;
>  	size_t			size;
>  	int			irq;
>  	int			err;
>  	int			i;
> +	u32                     nr_channels;
> +	dma_cap_mask_t          cap_mask = {};
> +	enum atdma_devtype	atdmatype;
> +
> +	dma_cap_set(DMA_MEMCPY, cap_mask);
> +
> +	/* get DMA parameters from controller type */
> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>  
> -	/* get DMA Controller parameters from platform */
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
> +	switch (atdmatype) {
> +	case ATDMA_DEVTYPE_SAM9RL:
> +		nr_channels = 2;
> +		break;
> +	case ATDMA_DEVTYPE_SAM9G45:
> +		nr_channels = 8;
> +		dma_cap_set(DMA_SLAVE, cap_mask);
> +		break;
> +	default:
>  		return -EINVAL;
> +	}
>  
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!io)
> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	size = sizeof(struct at_dma);
> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
> +	size += nr_channels * sizeof(struct at_dma_chan);
>  	atdma = kzalloc(size, GFP_KERNEL);
>  	if (!atdma)
>  		return -ENOMEM;
>  
> -	/* discover transaction capabilites from the platform data */
> -	atdma->dma_common.cap_mask = pdata->cap_mask;
> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
> +	/* discover transaction capabilities */
> +	atdma->dma_common.cap_mask = cap_mask;
> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
> +	atdma->devtype = atdmatype;
>  
>  	size = resource_size(io);
>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  
>  	/* initialize channels related values */
>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
> -	for (i = 0; i < pdata->nr_channels; i++) {
> +	for (i = 0; i < nr_channels; i++) {
>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>  
>  		atchan->chan_common.device = &atdma->dma_common;
> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
> -	  pdata->nr_channels);
> +	  nr_channels);
>  
>  	dma_async_device_register(&atdma->dma_common);
>  
> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>  static struct platform_driver at_dma_driver = {
>  	.remove		= __exit_p(at_dma_remove),
>  	.shutdown	= at_dma_shutdown,
> +	.id_table	= atdma_devtypes,
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index aa4c9ae..d7d6737 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>  
>  /*--  Controller  ------------------------------------------------------*/
>  
> +enum atdma_devtype {
> +	ATDMA_DEVTYPE_UNDEFINED = 0,
> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
> +};
> +
>  /**
>   * struct at_dma - internal representation of an Atmel HDMA Controller
>   * @chan_common: common dmaengine dma_device object members
> + * @atdma_devtype: identifier of DMA controller compatibility
>   * @ch_regs: memory mapped register base
>   * @clk: dma controller clock
>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>   */
>  struct at_dma {
>  	struct dma_device	dma_common;
> +	enum atdma_devtype	devtype;
>  	void __iomem		*regs;
>  	struct clk		*clk;
>  	u32			save_imr;
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
  2011-10-12 16:57     ` Nicolas Ferre
@ 2011-10-13  0:34       ` Grant Likely
  -1 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:34 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss,
	linux-kernel

On Wed, Oct 12, 2011 at 06:57:12PM +0200, Nicolas Ferre wrote:
> Add device tree probe support for atmel at_hdmac DMA driver.
> Bindings are added to specify DMA controller configuration.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
>  drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
>  2 files changed, 43 insertions(+), 1 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> new file mode 100644
> index 0000000..3c046ee
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> @@ -0,0 +1,14 @@
> +* Atmel Direct Memory Access Controller (DMA)
> +
> +Required properties:
> +- compatible: Should be "atmel,<chip>-dma"
> +- reg: Should contain DMA registers location and length
> +- interrupts: Should contain DMA interrupt
> +
> +Examples:
> +
> +dma@ffffec00 {
> +	compatible = "atmel,at91sam9g45-dma";
> +	reg = <0xffffec00 0x200>;
> +	interrupts = <21>;
> +};
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index d1869c5..42bd64c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -23,6 +23,8 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include "at_hdmac_regs.h"
>  
> @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +#if defined(CONFIG_OF)
> +static const struct of_device_id atmel_dma_dt_ids[] = {
> +	{
> +		.compatible = "atmel,at91sam9rl-dma",
> +		.data = (void *)ATDMA_DEVTYPE_SAM9RL
> +	}, {
> +		.compatible = "atmel,at91sam9g45-dma",
> +		.data = (void *)ATDMA_DEVTYPE_SAM9G45
> +	}, { /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
> +#endif
> +
>  static struct platform_device_id atdma_devtypes[] = {
>  	{
>  		.name = "at91sam9rl_dma",
> @@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
>  	}
>  };
>  
> +static inline enum atdma_devtype __init at_dma_get_driver_data(
> +					struct platform_device *pdev)
> +{
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);

You'll need to check the return value.  It is possible (though
unlikely) to have a device with an of_node but still happens to get
bound via the platform_driver id_table.  In which case match would be
NULL here.

Otherwise, you can add my a-b after fixing that bug.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

g.


> +		return (enum atdma_devtype)match->data;
> +	}
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1218,7 +1245,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dma_cap_set(DMA_MEMCPY, cap_mask);
>  
>  	/* get DMA parameters from controller type */
> -	atdmatype = platform_get_device_id(pdev)->driver_data;
> +	atdmatype = at_dma_get_driver_data(pdev);
>  
>  	switch (atdmatype) {
>  	case ATDMA_DEVTYPE_SAM9RL:
> @@ -1526,6 +1553,7 @@ static struct platform_driver at_dma_driver = {
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> +		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
>  	},
>  };
>  
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
@ 2011-10-13  0:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 12, 2011 at 06:57:12PM +0200, Nicolas Ferre wrote:
> Add device tree probe support for atmel at_hdmac DMA driver.
> Bindings are added to specify DMA controller configuration.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
>  drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
>  2 files changed, 43 insertions(+), 1 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> new file mode 100644
> index 0000000..3c046ee
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
> @@ -0,0 +1,14 @@
> +* Atmel Direct Memory Access Controller (DMA)
> +
> +Required properties:
> +- compatible: Should be "atmel,<chip>-dma"
> +- reg: Should contain DMA registers location and length
> +- interrupts: Should contain DMA interrupt
> +
> +Examples:
> +
> +dma at ffffec00 {
> +	compatible = "atmel,at91sam9g45-dma";
> +	reg = <0xffffec00 0x200>;
> +	interrupts = <21>;
> +};
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index d1869c5..42bd64c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -23,6 +23,8 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include "at_hdmac_regs.h"
>  
> @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +#if defined(CONFIG_OF)
> +static const struct of_device_id atmel_dma_dt_ids[] = {
> +	{
> +		.compatible = "atmel,at91sam9rl-dma",
> +		.data = (void *)ATDMA_DEVTYPE_SAM9RL
> +	}, {
> +		.compatible = "atmel,at91sam9g45-dma",
> +		.data = (void *)ATDMA_DEVTYPE_SAM9G45
> +	}, { /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
> +#endif
> +
>  static struct platform_device_id atdma_devtypes[] = {
>  	{
>  		.name = "at91sam9rl_dma",
> @@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
>  	}
>  };
>  
> +static inline enum atdma_devtype __init at_dma_get_driver_data(
> +					struct platform_device *pdev)
> +{
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);

You'll need to check the return value.  It is possible (though
unlikely) to have a device with an of_node but still happens to get
bound via the platform_driver id_table.  In which case match would be
NULL here.

Otherwise, you can add my a-b after fixing that bug.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

g.


> +		return (enum atdma_devtype)match->data;
> +	}
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1218,7 +1245,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dma_cap_set(DMA_MEMCPY, cap_mask);
>  
>  	/* get DMA parameters from controller type */
> -	atdmatype = platform_get_device_id(pdev)->driver_data;
> +	atdmatype = at_dma_get_driver_data(pdev);
>  
>  	switch (atdmatype) {
>  	case ATDMA_DEVTYPE_SAM9RL:
> @@ -1526,6 +1553,7 @@ static struct platform_driver at_dma_driver = {
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> +		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
>  	},
>  };
>  
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-13  0:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:34 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss,
	linux-kernel

On Wed, Oct 12, 2011 at 06:57:13PM +0200, Nicolas Ferre wrote:
> DMA controller can deduce its configuration data from
> the platform. Remove the platform data and match device
> types with the compatible ones.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
>  arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
>  arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
>  3 files changed, 2 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 600bffb..c9b897f 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -38,10 +38,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 8,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9g45_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
> -	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index aacb19d..81954f7 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -33,10 +33,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 2,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9rl_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
> index 187cb58..652c1a1 100644
> --- a/arch/arm/mach-at91/include/mach/at_hdmac.h
> +++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
> @@ -14,16 +14,6 @@
>  #include <linux/dmaengine.h>
>  
>  /**
> - * struct at_dma_platform_data - Controller configuration parameters
> - * @nr_channels: Number of channels supported by hardware (max 8)
> - * @cap_mask: dma_capability flags supported by the platform
> - */
> -struct at_dma_platform_data {
> -	unsigned int	nr_channels;
> -	dma_cap_mask_t  cap_mask;
> -};
> -
> -/**
>   * enum at_dma_slave_width - DMA slave register access width.
>   * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
>   * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-13  0:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:34 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Oct 12, 2011 at 06:57:13PM +0200, Nicolas Ferre wrote:
> DMA controller can deduce its configuration data from
> the platform. Remove the platform data and match device
> types with the compatible ones.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
>  arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
>  arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
>  3 files changed, 2 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 600bffb..c9b897f 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -38,10 +38,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 8,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9g45_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
> -	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index aacb19d..81954f7 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -33,10 +33,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 2,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9rl_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
> index 187cb58..652c1a1 100644
> --- a/arch/arm/mach-at91/include/mach/at_hdmac.h
> +++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
> @@ -14,16 +14,6 @@
>  #include <linux/dmaengine.h>
>  
>  /**
> - * struct at_dma_platform_data - Controller configuration parameters
> - * @nr_channels: Number of channels supported by hardware (max 8)
> - * @cap_mask: dma_capability flags supported by the platform
> - */
> -struct at_dma_platform_data {
> -	unsigned int	nr_channels;
> -	dma_cap_mask_t  cap_mask;
> -};
> -
> -/**
>   * enum at_dma_slave_width - DMA slave register access width.
>   * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
>   * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller
@ 2011-10-13  0:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 12, 2011 at 06:57:13PM +0200, Nicolas Ferre wrote:
> DMA controller can deduce its configuration data from
> the platform. Remove the platform data and match device
> types with the compatible ones.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c   |    9 +--------
>  arch/arm/mach-at91/at91sam9rl_devices.c    |    8 +-------
>  arch/arm/mach-at91/include/mach/at_hdmac.h |   10 ----------
>  3 files changed, 2 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 600bffb..c9b897f 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -38,10 +38,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 8,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -56,12 +52,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9g45_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -69,8 +64,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
> -	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index aacb19d..81954f7 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -33,10 +33,6 @@
>  #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
>  static u64 hdmac_dmamask = DMA_BIT_MASK(32);
>  
> -static struct at_dma_platform_data atdma_pdata = {
> -	.nr_channels	= 2,
> -};
> -
>  static struct resource hdmac_resources[] = {
>  	[0] = {
>  		.start	= AT91_BASE_SYS + AT91_DMA,
> @@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = {
>  };
>  
>  static struct platform_device at_hdmac_device = {
> -	.name		= "at_hdmac",
> +	.name		= "at91sam9rl_dma",
>  	.id		= -1,
>  	.dev		= {
>  				.dma_mask		= &hdmac_dmamask,
>  				.coherent_dma_mask	= DMA_BIT_MASK(32),
> -				.platform_data		= &atdma_pdata,
>  	},
>  	.resource	= hdmac_resources,
>  	.num_resources	= ARRAY_SIZE(hdmac_resources),
> @@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
>  	platform_device_register(&at_hdmac_device);
>  }
>  #else
> diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
> index 187cb58..652c1a1 100644
> --- a/arch/arm/mach-at91/include/mach/at_hdmac.h
> +++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
> @@ -14,16 +14,6 @@
>  #include <linux/dmaengine.h>
>  
>  /**
> - * struct at_dma_platform_data - Controller configuration parameters
> - * @nr_channels: Number of channels supported by hardware (max 8)
> - * @cap_mask: dma_capability flags supported by the platform
> - */
> -struct at_dma_platform_data {
> -	unsigned int	nr_channels;
> -	dma_cap_mask_t  cap_mask;
> -};
> -
> -/**
>   * enum at_dma_slave_width - DMA slave register access width.
>   * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
>   * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support
@ 2011-10-13  0:35       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:35 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss,
	linux-kernel

On Wed, Oct 12, 2011 at 06:57:14PM +0200, Nicolas Ferre wrote:
> Device tree support on at91sam9g45 family SoC. Only call
> platform_device_register() if no dma-controller node is
> found in device tree.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index c9b897f..b9888c5 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -64,7 +64,13 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	platform_device_register(&at_hdmac_device);
> +	struct device_node *of_node =
> +		of_find_node_by_name(NULL, "dma-controller");
> +
> +	if (of_node)
> +		of_node_put(of_node);
> +	else
> +		platform_device_register(&at_hdmac_device);
>  }
>  #else
>  void __init at91_add_device_hdmac(void) {}
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support
@ 2011-10-13  0:35       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:35 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Oct 12, 2011 at 06:57:14PM +0200, Nicolas Ferre wrote:
> Device tree support on at91sam9g45 family SoC. Only call
> platform_device_register() if no dma-controller node is
> found in device tree.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index c9b897f..b9888c5 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -64,7 +64,13 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	platform_device_register(&at_hdmac_device);
> +	struct device_node *of_node =
> +		of_find_node_by_name(NULL, "dma-controller");
> +
> +	if (of_node)
> +		of_node_put(of_node);
> +	else
> +		platform_device_register(&at_hdmac_device);
>  }
>  #else
>  void __init at91_add_device_hdmac(void) {}
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support
@ 2011-10-13  0:35       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-13  0:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 12, 2011 at 06:57:14PM +0200, Nicolas Ferre wrote:
> Device tree support on at91sam9g45 family SoC. Only call
> platform_device_register() if no dma-controller node is
> found in device tree.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-at91/at91sam9g45_devices.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index c9b897f..b9888c5 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -64,7 +64,13 @@ static struct platform_device at_hdmac_device = {
>  
>  void __init at91_add_device_hdmac(void)
>  {
> -	platform_device_register(&at_hdmac_device);
> +	struct device_node *of_node =
> +		of_find_node_by_name(NULL, "dma-controller");
> +
> +	if (of_node)
> +		of_node_put(of_node);
> +	else
> +		platform_device_register(&at_hdmac_device);
>  }
>  #else
>  void __init at91_add_device_hdmac(void) {}
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
  2011-10-13  0:34       ` Grant Likely
  (?)
@ 2011-10-13 11:54         ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-13 11:54 UTC (permalink / raw)
  To: Grant Likely
  Cc: vinod.koul, linux-arm-kernel, robherring2, devicetree-discuss,
	linux-kernel

On 10/13/2011 02:34 AM, Grant Likely :
> On Wed, Oct 12, 2011 at 06:57:12PM +0200, Nicolas Ferre wrote:
>> Add device tree probe support for atmel at_hdmac DMA driver.
>> Bindings are added to specify DMA controller configuration.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
>>  drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
>>  2 files changed, 43 insertions(+), 1 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> new file mode 100644
>> index 0000000..3c046ee
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> @@ -0,0 +1,14 @@
>> +* Atmel Direct Memory Access Controller (DMA)
>> +
>> +Required properties:
>> +- compatible: Should be "atmel,<chip>-dma"
>> +- reg: Should contain DMA registers location and length
>> +- interrupts: Should contain DMA interrupt
>> +
>> +Examples:
>> +
>> +dma@ffffec00 {
>> +	compatible = "atmel,at91sam9g45-dma";
>> +	reg = <0xffffec00 0x200>;
>> +	interrupts = <21>;
>> +};
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index d1869c5..42bd64c 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -23,6 +23,8 @@
>>  #include <linux/module.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/slab.h>
>> +#include <linux/of.h>
>> +#include <linux/of_device.h>
>>  
>>  #include "at_hdmac_regs.h"
>>  
>> @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +#if defined(CONFIG_OF)
>> +static const struct of_device_id atmel_dma_dt_ids[] = {
>> +	{
>> +		.compatible = "atmel,at91sam9rl-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9RL
>> +	}, {
>> +		.compatible = "atmel,at91sam9g45-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9G45
>> +	}, { /* sentinel */ }
>> +};
>> +
>> +MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
>> +#endif
>> +
>>  static struct platform_device_id atdma_devtypes[] = {
>>  	{
>>  		.name = "at91sam9rl_dma",
>> @@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
>>  	}
>>  };
>>  
>> +static inline enum atdma_devtype __init at_dma_get_driver_data(
>> +					struct platform_device *pdev)
>> +{
>> +	if (pdev->dev.of_node) {
>> +		const struct of_device_id *match;
>> +		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
> 
> You'll need to check the return value.  It is possible (though
> unlikely) to have a device with an of_node but still happens to get
> bound via the platform_driver id_table.  In which case match would be
> NULL here.

Ok, I add:

                if (match == NULL)
                        return ATDMA_DEVTYPE_UNDEFINED;

Which will take care about this case.


> Otherwise, you can add my a-b after fixing that bug.
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

Thanks a lot for your reviews Grant,

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
@ 2011-10-13 11:54         ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-13 11:54 UTC (permalink / raw)
  To: Grant Likely
  Cc: vinod.koul, devicetree-discuss, linux-kernel, linux-arm-kernel

On 10/13/2011 02:34 AM, Grant Likely :
> On Wed, Oct 12, 2011 at 06:57:12PM +0200, Nicolas Ferre wrote:
>> Add device tree probe support for atmel at_hdmac DMA driver.
>> Bindings are added to specify DMA controller configuration.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
>>  drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
>>  2 files changed, 43 insertions(+), 1 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> new file mode 100644
>> index 0000000..3c046ee
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> @@ -0,0 +1,14 @@
>> +* Atmel Direct Memory Access Controller (DMA)
>> +
>> +Required properties:
>> +- compatible: Should be "atmel,<chip>-dma"
>> +- reg: Should contain DMA registers location and length
>> +- interrupts: Should contain DMA interrupt
>> +
>> +Examples:
>> +
>> +dma@ffffec00 {
>> +	compatible = "atmel,at91sam9g45-dma";
>> +	reg = <0xffffec00 0x200>;
>> +	interrupts = <21>;
>> +};
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index d1869c5..42bd64c 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -23,6 +23,8 @@
>>  #include <linux/module.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/slab.h>
>> +#include <linux/of.h>
>> +#include <linux/of_device.h>
>>  
>>  #include "at_hdmac_regs.h"
>>  
>> @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +#if defined(CONFIG_OF)
>> +static const struct of_device_id atmel_dma_dt_ids[] = {
>> +	{
>> +		.compatible = "atmel,at91sam9rl-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9RL
>> +	}, {
>> +		.compatible = "atmel,at91sam9g45-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9G45
>> +	}, { /* sentinel */ }
>> +};
>> +
>> +MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
>> +#endif
>> +
>>  static struct platform_device_id atdma_devtypes[] = {
>>  	{
>>  		.name = "at91sam9rl_dma",
>> @@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
>>  	}
>>  };
>>  
>> +static inline enum atdma_devtype __init at_dma_get_driver_data(
>> +					struct platform_device *pdev)
>> +{
>> +	if (pdev->dev.of_node) {
>> +		const struct of_device_id *match;
>> +		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
> 
> You'll need to check the return value.  It is possible (though
> unlikely) to have a device with an of_node but still happens to get
> bound via the platform_driver id_table.  In which case match would be
> NULL here.

Ok, I add:

                if (match == NULL)
                        return ATDMA_DEVTYPE_UNDEFINED;

Which will take care about this case.


> Otherwise, you can add my a-b after fixing that bug.
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

Thanks a lot for your reviews Grant,

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support
@ 2011-10-13 11:54         ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-13 11:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/13/2011 02:34 AM, Grant Likely :
> On Wed, Oct 12, 2011 at 06:57:12PM +0200, Nicolas Ferre wrote:
>> Add device tree probe support for atmel at_hdmac DMA driver.
>> Bindings are added to specify DMA controller configuration.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 +++++++++
>>  drivers/dma/at_hdmac.c                             |   30 +++++++++++++++++++-
>>  2 files changed, 43 insertions(+), 1 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> new file mode 100644
>> index 0000000..3c046ee
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
>> @@ -0,0 +1,14 @@
>> +* Atmel Direct Memory Access Controller (DMA)
>> +
>> +Required properties:
>> +- compatible: Should be "atmel,<chip>-dma"
>> +- reg: Should contain DMA registers location and length
>> +- interrupts: Should contain DMA interrupt
>> +
>> +Examples:
>> +
>> +dma at ffffec00 {
>> +	compatible = "atmel,at91sam9g45-dma";
>> +	reg = <0xffffec00 0x200>;
>> +	interrupts = <21>;
>> +};
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index d1869c5..42bd64c 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -23,6 +23,8 @@
>>  #include <linux/module.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/slab.h>
>> +#include <linux/of.h>
>> +#include <linux/of_device.h>
>>  
>>  #include "at_hdmac_regs.h"
>>  
>> @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +#if defined(CONFIG_OF)
>> +static const struct of_device_id atmel_dma_dt_ids[] = {
>> +	{
>> +		.compatible = "atmel,at91sam9rl-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9RL
>> +	}, {
>> +		.compatible = "atmel,at91sam9g45-dma",
>> +		.data = (void *)ATDMA_DEVTYPE_SAM9G45
>> +	}, { /* sentinel */ }
>> +};
>> +
>> +MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
>> +#endif
>> +
>>  static struct platform_device_id atdma_devtypes[] = {
>>  	{
>>  		.name = "at91sam9rl_dma",
>> @@ -1187,6 +1203,17 @@ static struct platform_device_id atdma_devtypes[] = {
>>  	}
>>  };
>>  
>> +static inline enum atdma_devtype __init at_dma_get_driver_data(
>> +					struct platform_device *pdev)
>> +{
>> +	if (pdev->dev.of_node) {
>> +		const struct of_device_id *match;
>> +		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
> 
> You'll need to check the return value.  It is possible (though
> unlikely) to have a device with an of_node but still happens to get
> bound via the platform_driver id_table.  In which case match would be
> NULL here.

Ok, I add:

                if (match == NULL)
                        return ATDMA_DEVTYPE_UNDEFINED;

Which will take care about this case.


> Otherwise, you can add my a-b after fixing that bug.
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

Thanks a lot for your reviews Grant,

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
  2011-10-12 16:57 ` Nicolas Ferre
  (?)
@ 2011-10-17 12:54   ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:54 UTC (permalink / raw)
  To: vinod.koul
  Cc: linux-arm-kernel, robherring2, devicetree-discuss, linux-kernel

On 10/12/2011 06:57 PM, Nicolas Ferre :
> This series add the device tree support to Atmel DMA controller driver:
> at_hdmac.
> The removal of platform data ease the conversion to device tree. It also have
> the additional benefit of being simpler and cleaner.
> 
> Nicolas Ferre (4):
>       dmaengine: at_hdmac: platform data move to use .id_table
>       dmaengine: at_hdmac: add device tree support
>       ARM: at91/dma: remove platform data from DMA controller
>       ARM: at91/dma: DMA controller registering with DT support
> 
>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>  6 files changed, 97 insertions(+), 36 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Vinod,

I have just rebased the dmaengine at_hdmac driver patches on top of your
"next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
right now.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-17 12:54   ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:54 UTC (permalink / raw)
  To: vinod.koul; +Cc: devicetree-discuss, linux-kernel, linux-arm-kernel

On 10/12/2011 06:57 PM, Nicolas Ferre :
> This series add the device tree support to Atmel DMA controller driver:
> at_hdmac.
> The removal of platform data ease the conversion to device tree. It also have
> the additional benefit of being simpler and cleaner.
> 
> Nicolas Ferre (4):
>       dmaengine: at_hdmac: platform data move to use .id_table
>       dmaengine: at_hdmac: add device tree support
>       ARM: at91/dma: remove platform data from DMA controller
>       ARM: at91/dma: DMA controller registering with DT support
> 
>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>  6 files changed, 97 insertions(+), 36 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Vinod,

I have just rebased the dmaengine at_hdmac driver patches on top of your
"next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
right now.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-17 12:54   ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/12/2011 06:57 PM, Nicolas Ferre :
> This series add the device tree support to Atmel DMA controller driver:
> at_hdmac.
> The removal of platform data ease the conversion to device tree. It also have
> the additional benefit of being simpler and cleaner.
> 
> Nicolas Ferre (4):
>       dmaengine: at_hdmac: platform data move to use .id_table
>       dmaengine: at_hdmac: add device tree support
>       ARM: at91/dma: remove platform data from DMA controller
>       ARM: at91/dma: DMA controller registering with DT support
> 
>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>  6 files changed, 97 insertions(+), 36 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

Vinod,

I have just rebased the dmaengine at_hdmac driver patches on top of your
"next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
right now.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
  2011-10-17 12:54   ` Nicolas Ferre
  (?)
@ 2011-10-17 12:56     ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel
  Cc: linux-kernel, robherring2, grant.likely, devicetree-discuss,
	Nicolas Ferre

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-17 12:56     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel
  Cc: grant.likely, Nicolas Ferre, devicetree-discuss, linux-kernel

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-17 12:56     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: linux-arm-kernel

We remove the use of platform data from DMA controller driver.
We now use of .id_table to distinguish between compatible
types. The two implementations allow to determine the
number of channels and the capabilities of the controller.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
 drivers/dma/at_hdmac_regs.h |    8 +++++++
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index fcfa0a8..d1869c5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+static struct platform_device_id atdma_devtypes[] = {
+	{
+		.name = "at91sam9rl_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9RL,
+	}, {
+		.name = "at91sam9g45_dma",
+		.driver_data = ATDMA_DEVTYPE_SAM9G45,
+	}, {
+		/* sentinel */
+	}
+};
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
 
 static int __init at_dma_probe(struct platform_device *pdev)
 {
-	struct at_dma_platform_data *pdata;
 	struct resource		*io;
 	struct at_dma		*atdma;
 	size_t			size;
 	int			irq;
 	int			err;
 	int			i;
+	u32                     nr_channels;
+	dma_cap_mask_t          cap_mask = {};
+	enum atdma_devtype	atdmatype;
+
+	dma_cap_set(DMA_MEMCPY, cap_mask);
+
+	/* get DMA parameters from controller type */
+	atdmatype = platform_get_device_id(pdev)->driver_data;
 
-	/* get DMA Controller parameters from platform */
-	pdata = pdev->dev.platform_data;
-	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
+	switch (atdmatype) {
+	case ATDMA_DEVTYPE_SAM9RL:
+		nr_channels = 2;
+		break;
+	case ATDMA_DEVTYPE_SAM9G45:
+		nr_channels = 8;
+		dma_cap_set(DMA_SLAVE, cap_mask);
+		break;
+	default:
 		return -EINVAL;
+	}
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!io)
@@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		return irq;
 
 	size = sizeof(struct at_dma);
-	size += pdata->nr_channels * sizeof(struct at_dma_chan);
+	size += nr_channels * sizeof(struct at_dma_chan);
 	atdma = kzalloc(size, GFP_KERNEL);
 	if (!atdma)
 		return -ENOMEM;
 
-	/* discover transaction capabilites from the platform data */
-	atdma->dma_common.cap_mask = pdata->cap_mask;
-	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
+	/* discover transaction capabilities */
+	atdma->dma_common.cap_mask = cap_mask;
+	atdma->all_chan_mask = (1 << nr_channels) - 1;
+	atdma->devtype = atdmatype;
 
 	size = resource_size(io);
 	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
@@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	/* initialize channels related values */
 	INIT_LIST_HEAD(&atdma->dma_common.channels);
-	for (i = 0; i < pdata->nr_channels; i++) {
+	for (i = 0; i < nr_channels; i++) {
 		struct at_dma_chan	*atchan = &atdma->chan[i];
 
 		atchan->chan_common.device = &atdma->dma_common;
@@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  pdata->nr_channels);
+	  nr_channels);
 
 	dma_async_device_register(&atdma->dma_common);
 
@@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
 static struct platform_driver at_dma_driver = {
 	.remove		= __exit_p(at_dma_remove),
 	.shutdown	= at_dma_shutdown,
+	.id_table	= atdma_devtypes,
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index aa4c9ae..d7d6737 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
 
 /*--  Controller  ------------------------------------------------------*/
 
+enum atdma_devtype {
+	ATDMA_DEVTYPE_UNDEFINED = 0,
+	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
+	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
+};
+
 /**
  * struct at_dma - internal representation of an Atmel HDMA Controller
  * @chan_common: common dmaengine dma_device object members
+ * @atdma_devtype: identifier of DMA controller compatibility
  * @ch_regs: memory mapped register base
  * @clk: dma controller clock
  * @save_imr: interrupt mask register that is saved on suspend/resume cycle
@@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
  */
 struct at_dma {
 	struct dma_device	dma_common;
+	enum atdma_devtype	devtype;
 	void __iomem		*regs;
 	struct clk		*clk;
 	u32			save_imr;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v4 2/2] dmaengine: at_hdmac: add device tree support
@ 2011-10-17 12:56       ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: vinod.koul, linux-arm-kernel
  Cc: linux-kernel, robherring2, grant.likely, devicetree-discuss,
	Nicolas Ferre

Add device tree probe support for atmel at_hdmac DMA driver.
Bindings are added to specify DMA controller configuration.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++++++
 drivers/dma/at_hdmac.c                             |   32 +++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
new file mode 100644
index 0000000..3c046ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -0,0 +1,14 @@
+* Atmel Direct Memory Access Controller (DMA)
+
+Required properties:
+- compatible: Should be "atmel,<chip>-dma"
+- reg: Should contain DMA registers location and length
+- interrupts: Should contain DMA interrupt
+
+Examples:
+
+dma@ffffec00 {
+	compatible = "atmel,at91sam9g45-dma";
+	reg = <0xffffec00 0x200>;
+	interrupts = <21>;
+};
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c5..f3cb4a0 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "at_hdmac_regs.h"
 
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_dma_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9rl-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9RL
+	}, {
+		.compatible = "atmel,at91sam9g45-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9G45
+	}, { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
+#endif
+
 static struct platform_device_id atdma_devtypes[] = {
 	{
 		.name = "at91sam9rl_dma",
@@ -1187,6 +1203,19 @@ static struct platform_device_id atdma_devtypes[] = {
 	}
 };
 
+static inline enum atdma_devtype __init at_dma_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
+		if (match == NULL)
+			return ATDMA_DEVTYPE_UNDEFINED;
+		return (enum atdma_devtype)match->data;
+	}
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1218,7 +1247,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, cap_mask);
 
 	/* get DMA parameters from controller type */
-	atdmatype = platform_get_device_id(pdev)->driver_data;
+	atdmatype = at_dma_get_driver_data(pdev);
 
 	switch (atdmatype) {
 	case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1555,7 @@ static struct platform_driver at_dma_driver = {
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
+		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
 	},
 };
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v4 2/2] dmaengine: at_hdmac: add device tree support
@ 2011-10-17 12:56       ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Add device tree probe support for atmel at_hdmac DMA driver.
Bindings are added to specify DMA controller configuration.

Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---
 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++++++
 drivers/dma/at_hdmac.c                             |   32 +++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
new file mode 100644
index 0000000..3c046ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -0,0 +1,14 @@
+* Atmel Direct Memory Access Controller (DMA)
+
+Required properties:
+- compatible: Should be "atmel,<chip>-dma"
+- reg: Should contain DMA registers location and length
+- interrupts: Should contain DMA interrupt
+
+Examples:
+
+dma@ffffec00 {
+	compatible = "atmel,at91sam9g45-dma";
+	reg = <0xffffec00 0x200>;
+	interrupts = <21>;
+};
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c5..f3cb4a0 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "at_hdmac_regs.h"
 
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_dma_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9rl-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9RL
+	}, {
+		.compatible = "atmel,at91sam9g45-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9G45
+	}, { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
+#endif
+
 static struct platform_device_id atdma_devtypes[] = {
 	{
 		.name = "at91sam9rl_dma",
@@ -1187,6 +1203,19 @@ static struct platform_device_id atdma_devtypes[] = {
 	}
 };
 
+static inline enum atdma_devtype __init at_dma_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
+		if (match == NULL)
+			return ATDMA_DEVTYPE_UNDEFINED;
+		return (enum atdma_devtype)match->data;
+	}
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1218,7 +1247,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, cap_mask);
 
 	/* get DMA parameters from controller type */
-	atdmatype = platform_get_device_id(pdev)->driver_data;
+	atdmatype = at_dma_get_driver_data(pdev);
 
 	switch (atdmatype) {
 	case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1555,7 @@ static struct platform_driver at_dma_driver = {
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
+		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
 	},
 };
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v4 2/2] dmaengine: at_hdmac: add device tree support
@ 2011-10-17 12:56       ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-17 12:56 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree probe support for atmel at_hdmac DMA driver.
Bindings are added to specify DMA controller configuration.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++++++
 drivers/dma/at_hdmac.c                             |   32 +++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
new file mode 100644
index 0000000..3c046ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -0,0 +1,14 @@
+* Atmel Direct Memory Access Controller (DMA)
+
+Required properties:
+- compatible: Should be "atmel,<chip>-dma"
+- reg: Should contain DMA registers location and length
+- interrupts: Should contain DMA interrupt
+
+Examples:
+
+dma at ffffec00 {
+	compatible = "atmel,at91sam9g45-dma";
+	reg = <0xffffec00 0x200>;
+	interrupts = <21>;
+};
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c5..f3cb4a0 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "at_hdmac_regs.h"
 
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 
 /*--  Module Management  -----------------------------------------------*/
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_dma_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9rl-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9RL
+	}, {
+		.compatible = "atmel,at91sam9g45-dma",
+		.data = (void *)ATDMA_DEVTYPE_SAM9G45
+	}, { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
+#endif
+
 static struct platform_device_id atdma_devtypes[] = {
 	{
 		.name = "at91sam9rl_dma",
@@ -1187,6 +1203,19 @@ static struct platform_device_id atdma_devtypes[] = {
 	}
 };
 
+static inline enum atdma_devtype __init at_dma_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
+		if (match == NULL)
+			return ATDMA_DEVTYPE_UNDEFINED;
+		return (enum atdma_devtype)match->data;
+	}
+	return platform_get_device_id(pdev)->driver_data;
+}
+
 /**
  * at_dma_off - disable DMA controller
  * @atdma: the Atmel HDAMC device
@@ -1218,7 +1247,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, cap_mask);
 
 	/* get DMA parameters from controller type */
-	atdmatype = platform_get_device_id(pdev)->driver_data;
+	atdmatype = at_dma_get_driver_data(pdev);
 
 	switch (atdmatype) {
 	case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1555,7 @@ static struct platform_driver at_dma_driver = {
 	.driver = {
 		.name	= "at_hdmac",
 		.pm	= &at_dma_dev_pm_ops,
+		.of_match_table	= of_match_ptr(atmel_dma_dt_ids),
 	},
 };
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
  2011-10-17 12:54   ` Nicolas Ferre
  (?)
@ 2011-10-23 14:30     ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-23 14:30 UTC (permalink / raw)
  To: vinod.koul
  Cc: linux-arm-kernel, robherring2, devicetree-discuss, linux-kernel

On 10/17/2011 02:54 PM, Nicolas Ferre :
> On 10/12/2011 06:57 PM, Nicolas Ferre :
>> This series add the device tree support to Atmel DMA controller driver:
>> at_hdmac.
>> The removal of platform data ease the conversion to device tree. It also have
>> the additional benefit of being simpler and cleaner.
>>
>> Nicolas Ferre (4):
>>       dmaengine: at_hdmac: platform data move to use .id_table
>>       dmaengine: at_hdmac: add device tree support
>>       ARM: at91/dma: remove platform data from DMA controller
>>       ARM: at91/dma: DMA controller registering with DT support
>>
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.

Vinod,

Ping?

Do you want me to provide you a git tree for those two patches?
Do you think it can make it for 3.2 merge window?

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-23 14:30     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-23 14:30 UTC (permalink / raw)
  To: vinod.koul; +Cc: devicetree-discuss, linux-kernel, linux-arm-kernel

On 10/17/2011 02:54 PM, Nicolas Ferre :
> On 10/12/2011 06:57 PM, Nicolas Ferre :
>> This series add the device tree support to Atmel DMA controller driver:
>> at_hdmac.
>> The removal of platform data ease the conversion to device tree. It also have
>> the additional benefit of being simpler and cleaner.
>>
>> Nicolas Ferre (4):
>>       dmaengine: at_hdmac: platform data move to use .id_table
>>       dmaengine: at_hdmac: add device tree support
>>       ARM: at91/dma: remove platform data from DMA controller
>>       ARM: at91/dma: DMA controller registering with DT support
>>
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.

Vinod,

Ping?

Do you want me to provide you a git tree for those two patches?
Do you think it can make it for 3.2 merge window?

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-23 14:30     ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-23 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/17/2011 02:54 PM, Nicolas Ferre :
> On 10/12/2011 06:57 PM, Nicolas Ferre :
>> This series add the device tree support to Atmel DMA controller driver:
>> at_hdmac.
>> The removal of platform data ease the conversion to device tree. It also have
>> the additional benefit of being simpler and cleaner.
>>
>> Nicolas Ferre (4):
>>       dmaengine: at_hdmac: platform data move to use .id_table
>>       dmaengine: at_hdmac: add device tree support
>>       ARM: at91/dma: remove platform data from DMA controller
>>       ARM: at91/dma: DMA controller registering with DT support
>>
>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.

Vinod,

Ping?

Do you want me to provide you a git tree for those two patches?
Do you think it can make it for 3.2 merge window?

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
  2011-10-23 14:30     ` Nicolas Ferre
@ 2011-10-24  3:04       ` Vinod Koul
  -1 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-10-24  3:04 UTC (permalink / raw)
  To: Nicolas Ferre; +Cc: devicetree-discuss, linux-kernel, linux-arm-kernel

On Sun, 2011-10-23 at 16:30 +0200, Nicolas Ferre wrote:
> On 10/17/2011 02:54 PM, Nicolas Ferre :
> > On 10/12/2011 06:57 PM, Nicolas Ferre :
> >> This series add the device tree support to Atmel DMA controller driver:
> >> at_hdmac.
> >> The removal of platform data ease the conversion to device tree. It also have
> >> the additional benefit of being simpler and cleaner.
> >>
> >> Nicolas Ferre (4):
> >>       dmaengine: at_hdmac: platform data move to use .id_table
> >>       dmaengine: at_hdmac: add device tree support
> >>       ARM: at91/dma: remove platform data from DMA controller
> >>       ARM: at91/dma: DMA controller registering with DT support
> >>
> >>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >>  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >>  6 files changed, 97 insertions(+), 36 deletions(-)
> >>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> > 
> > Vinod,
> > 
> > I have just rebased the dmaengine at_hdmac driver patches on top of your
> > "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> > right now.
> 
> Vinod,
> 
> Ping?
> 
> Do you want me to provide you a git tree for those two patches?
> Do you think it can make it for 3.2 merge window?
> 
Sorry lokks like this indeed got missed :(

I will review this right away and if good will apply :)

-- 
~Vinod


^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-24  3:04       ` Vinod Koul
  0 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-10-24  3:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 2011-10-23 at 16:30 +0200, Nicolas Ferre wrote:
> On 10/17/2011 02:54 PM, Nicolas Ferre :
> > On 10/12/2011 06:57 PM, Nicolas Ferre :
> >> This series add the device tree support to Atmel DMA controller driver:
> >> at_hdmac.
> >> The removal of platform data ease the conversion to device tree. It also have
> >> the additional benefit of being simpler and cleaner.
> >>
> >> Nicolas Ferre (4):
> >>       dmaengine: at_hdmac: platform data move to use .id_table
> >>       dmaengine: at_hdmac: add device tree support
> >>       ARM: at91/dma: remove platform data from DMA controller
> >>       ARM: at91/dma: DMA controller registering with DT support
> >>
> >>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >>  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >>  6 files changed, 97 insertions(+), 36 deletions(-)
> >>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> > 
> > Vinod,
> > 
> > I have just rebased the dmaengine at_hdmac driver patches on top of your
> > "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> > right now.
> 
> Vinod,
> 
> Ping?
> 
> Do you want me to provide you a git tree for those two patches?
> Do you think it can make it for 3.2 merge window?
> 
Sorry lokks like this indeed got missed :(

I will review this right away and if good will apply :)

-- 
~Vinod

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
  2011-10-17 12:54   ` Nicolas Ferre
@ 2011-10-24  3:28     ` Vinod Koul
  -1 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-10-24  3:28 UTC (permalink / raw)
  To: Nicolas Ferre, robherring2
  Cc: linux-arm-kernel, devicetree-discuss, linux-kernel

On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
> On 10/12/2011 06:57 PM, Nicolas Ferre :
> > This series add the device tree support to Atmel DMA controller driver:
> > at_hdmac.
> > The removal of platform data ease the conversion to device tree. It also have
> > the additional benefit of being simpler and cleaner.
> > 
> > Nicolas Ferre (4):
> >       dmaengine: at_hdmac: platform data move to use .id_table
> >       dmaengine: at_hdmac: add device tree support
> >       ARM: at91/dma: remove platform data from DMA controller
> >       ARM: at91/dma: DMA controller registering with DT support
> > 
> >  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >  6 files changed, 97 insertions(+), 36 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.
I manged to fail the compliation with this patch
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1211: error: implicit declaration of function 'of_match_node'
drivers/dma/at_hdmac.c:1211: error: 'atmel_dma_dt_ids' undeclared (first use in this function)
drivers/dma/at_hdmac.c:1211: error: (Each undeclared identifier is reported only once
drivers/dma/at_hdmac.c:1211: error: for each function it appears in.)
drivers/dma/at_hdmac.c:1211: warning: assignment makes pointer from integer without a cast
drivers/dma/at_hdmac.c: At top level:
drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
drivers/dma/at_hdmac.c:1558: error: 'atmel_dma_dt_ids' undeclared here (not in a function)
drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
make[1]: *** [drivers/dma/at_hdmac.o] Error 1

Which, IMO are triggered as one of my configs for at_hdmac did not have
CONFIG_OF enabled. I think at_hdmac should select or depend on this. I
did latter and still I get compilation error :(

drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
make[1]: *** [drivers/dma/at_hdmac.o] Error 1



-- 
~Vinod


^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-24  3:28     ` Vinod Koul
  0 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-10-24  3:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
> On 10/12/2011 06:57 PM, Nicolas Ferre :
> > This series add the device tree support to Atmel DMA controller driver:
> > at_hdmac.
> > The removal of platform data ease the conversion to device tree. It also have
> > the additional benefit of being simpler and cleaner.
> > 
> > Nicolas Ferre (4):
> >       dmaengine: at_hdmac: platform data move to use .id_table
> >       dmaengine: at_hdmac: add device tree support
> >       ARM: at91/dma: remove platform data from DMA controller
> >       ARM: at91/dma: DMA controller registering with DT support
> > 
> >  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >  6 files changed, 97 insertions(+), 36 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.
I manged to fail the compliation with this patch
drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
drivers/dma/at_hdmac.c:1211: error: implicit declaration of function 'of_match_node'
drivers/dma/at_hdmac.c:1211: error: 'atmel_dma_dt_ids' undeclared (first use in this function)
drivers/dma/at_hdmac.c:1211: error: (Each undeclared identifier is reported only once
drivers/dma/at_hdmac.c:1211: error: for each function it appears in.)
drivers/dma/at_hdmac.c:1211: warning: assignment makes pointer from integer without a cast
drivers/dma/at_hdmac.c: At top level:
drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
drivers/dma/at_hdmac.c:1558: error: 'atmel_dma_dt_ids' undeclared here (not in a function)
drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
make[1]: *** [drivers/dma/at_hdmac.o] Error 1

Which, IMO are triggered as one of my configs for at_hdmac did not have
CONFIG_OF enabled. I think at_hdmac should select or depend on this. I
did latter and still I get compilation error :(

drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
make[1]: *** [drivers/dma/at_hdmac.o] Error 1



-- 
~Vinod

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
  2011-10-24  3:28     ` Vinod Koul
  (?)
@ 2011-10-24  9:05       ` Nicolas Ferre
  -1 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-24  9:05 UTC (permalink / raw)
  To: Vinod Koul
  Cc: robherring2, linux-arm-kernel, devicetree-discuss, linux-kernel,
	Grant Likely

On 10/24/2011 05:28 AM, Vinod Koul :
> On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
>> On 10/12/2011 06:57 PM, Nicolas Ferre :
>>> This series add the device tree support to Atmel DMA controller driver:
>>> at_hdmac.
>>> The removal of platform data ease the conversion to device tree. It also have
>>> the additional benefit of being simpler and cleaner.
>>>
>>> Nicolas Ferre (4):
>>>       dmaengine: at_hdmac: platform data move to use .id_table
>>>       dmaengine: at_hdmac: add device tree support
>>>       ARM: at91/dma: remove platform data from DMA controller
>>>       ARM: at91/dma: DMA controller registering with DT support
>>>
>>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> Vinod,
>>
>> I have just rebased the dmaengine at_hdmac driver patches on top of your
>> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
>> right now.
> I manged to fail the compliation with this patch
> drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
> drivers/dma/at_hdmac.c:1211: error: implicit declaration of function 'of_match_node'
> drivers/dma/at_hdmac.c:1211: error: 'atmel_dma_dt_ids' undeclared (first use in this function)
> drivers/dma/at_hdmac.c:1211: error: (Each undeclared identifier is reported only once
> drivers/dma/at_hdmac.c:1211: error: for each function it appears in.)
> drivers/dma/at_hdmac.c:1211: warning: assignment makes pointer from integer without a cast
> drivers/dma/at_hdmac.c: At top level:
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: 'atmel_dma_dt_ids' undeclared here (not in a function)
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1
> 
> Which, IMO are triggered as one of my configs for at_hdmac did not have
> CONFIG_OF enabled. 

Yes, you are right for of_match_node(), I should protect it from non
CONFIG_OF configuration.
Maybe we should provide an empty of_match_node() function in of.h...

> I think at_hdmac should select or depend on this. I
> did latter and still I get compilation error :(
> 
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1

Well, of_match_ptr() macro is included in devicetree/next git tree and
will go to mainline during next merge window. It is the desired way to
specify a match table pointer for device tree enabled drivers...

Here is the commit ID in linux-next:
3a1e362e3f3cd571b3974b8d44b8e358ec7a098c

I have a serial driver conversion to device tree sitting in Greg's tty
tree with same functions used. It is also scheduled for inclusion in
next merge 3.2 merge window.

So, I will submit a new v5 revision with of_match_node() only called
when device tree is actually selected. But I will keep the
of_match_ptr() macro. Does it sound ok to you? Or maybe just a little
patch that you can fold into the current one is the best?

Thanks, best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-24  9:05       ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-24  9:05 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Grant Likely, devicetree-discuss, linux-kernel, linux-arm-kernel

On 10/24/2011 05:28 AM, Vinod Koul :
> On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
>> On 10/12/2011 06:57 PM, Nicolas Ferre :
>>> This series add the device tree support to Atmel DMA controller driver:
>>> at_hdmac.
>>> The removal of platform data ease the conversion to device tree. It also have
>>> the additional benefit of being simpler and cleaner.
>>>
>>> Nicolas Ferre (4):
>>>       dmaengine: at_hdmac: platform data move to use .id_table
>>>       dmaengine: at_hdmac: add device tree support
>>>       ARM: at91/dma: remove platform data from DMA controller
>>>       ARM: at91/dma: DMA controller registering with DT support
>>>
>>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> Vinod,
>>
>> I have just rebased the dmaengine at_hdmac driver patches on top of your
>> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
>> right now.
> I manged to fail the compliation with this patch
> drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
> drivers/dma/at_hdmac.c:1211: error: implicit declaration of function 'of_match_node'
> drivers/dma/at_hdmac.c:1211: error: 'atmel_dma_dt_ids' undeclared (first use in this function)
> drivers/dma/at_hdmac.c:1211: error: (Each undeclared identifier is reported only once
> drivers/dma/at_hdmac.c:1211: error: for each function it appears in.)
> drivers/dma/at_hdmac.c:1211: warning: assignment makes pointer from integer without a cast
> drivers/dma/at_hdmac.c: At top level:
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: 'atmel_dma_dt_ids' undeclared here (not in a function)
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1
> 
> Which, IMO are triggered as one of my configs for at_hdmac did not have
> CONFIG_OF enabled. 

Yes, you are right for of_match_node(), I should protect it from non
CONFIG_OF configuration.
Maybe we should provide an empty of_match_node() function in of.h...

> I think at_hdmac should select or depend on this. I
> did latter and still I get compilation error :(
> 
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1

Well, of_match_ptr() macro is included in devicetree/next git tree and
will go to mainline during next merge window. It is the desired way to
specify a match table pointer for device tree enabled drivers...

Here is the commit ID in linux-next:
3a1e362e3f3cd571b3974b8d44b8e358ec7a098c

I have a serial driver conversion to device tree sitting in Greg's tty
tree with same functions used. It is also scheduled for inclusion in
next merge 3.2 merge window.

So, I will submit a new v5 revision with of_match_node() only called
when device tree is actually selected. But I will keep the
of_match_ptr() macro. Does it sound ok to you? Or maybe just a little
patch that you can fold into the current one is the best?

Thanks, best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-10-24  9:05       ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-10-24  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/24/2011 05:28 AM, Vinod Koul :
> On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
>> On 10/12/2011 06:57 PM, Nicolas Ferre :
>>> This series add the device tree support to Atmel DMA controller driver:
>>> at_hdmac.
>>> The removal of platform data ease the conversion to device tree. It also have
>>> the additional benefit of being simpler and cleaner.
>>>
>>> Nicolas Ferre (4):
>>>       dmaengine: at_hdmac: platform data move to use .id_table
>>>       dmaengine: at_hdmac: add device tree support
>>>       ARM: at91/dma: remove platform data from DMA controller
>>>       ARM: at91/dma: DMA controller registering with DT support
>>>
>>>  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
>>>  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
>>>  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
>>>  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
>>>  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
>>>  drivers/dma/at_hdmac_regs.h                        |    8 ++
>>>  6 files changed, 97 insertions(+), 36 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
>>
>> Vinod,
>>
>> I have just rebased the dmaengine at_hdmac driver patches on top of your
>> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
>> right now.
> I manged to fail the compliation with this patch
> drivers/dma/at_hdmac.c: In function 'at_dma_get_driver_data':
> drivers/dma/at_hdmac.c:1211: error: implicit declaration of function 'of_match_node'
> drivers/dma/at_hdmac.c:1211: error: 'atmel_dma_dt_ids' undeclared (first use in this function)
> drivers/dma/at_hdmac.c:1211: error: (Each undeclared identifier is reported only once
> drivers/dma/at_hdmac.c:1211: error: for each function it appears in.)
> drivers/dma/at_hdmac.c:1211: warning: assignment makes pointer from integer without a cast
> drivers/dma/at_hdmac.c: At top level:
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: 'atmel_dma_dt_ids' undeclared here (not in a function)
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1
> 
> Which, IMO are triggered as one of my configs for at_hdmac did not have
> CONFIG_OF enabled. 

Yes, you are right for of_match_node(), I should protect it from non
CONFIG_OF configuration.
Maybe we should provide an empty of_match_node() function in of.h...

> I think at_hdmac should select or depend on this. I
> did latter and still I get compilation error :(
> 
> drivers/dma/at_hdmac.c:1558: error: implicit declaration of function 'of_match_ptr'
> drivers/dma/at_hdmac.c:1558: error: initializer element is not constant
> drivers/dma/at_hdmac.c:1558: error: (near initialization for 'at_dma_driver.driver.of_match_table')
> make[1]: *** [drivers/dma/at_hdmac.o] Error 1

Well, of_match_ptr() macro is included in devicetree/next git tree and
will go to mainline during next merge window. It is the desired way to
specify a match table pointer for device tree enabled drivers...

Here is the commit ID in linux-next:
3a1e362e3f3cd571b3974b8d44b8e358ec7a098c

I have a serial driver conversion to device tree sitting in Greg's tty
tree with same functions used. It is also scheduled for inclusion in
next merge 3.2 merge window.

So, I will submit a new v5 revision with of_match_node() only called
when device tree is actually selected. But I will keep the
of_match_ptr() macro. Does it sound ok to you? Or maybe just a little
patch that you can fold into the current one is the best?

Thanks, best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
  2011-10-17 12:56     ` Nicolas Ferre
  (?)
@ 2011-10-24  9:34       ` Grant Likely
  -1 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-24  9:34 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, linux-arm-kernel, linux-kernel, robherring2,
	devicetree-discuss

On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
> We remove the use of platform data from DMA controller driver.
> We now use of .id_table to distinguish between compatible
> types. The two implementations allow to determine the
> number of channels and the capabilities of the controller.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>  2 files changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index fcfa0a8..d1869c5 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +static struct platform_device_id atdma_devtypes[] = {
> +	{
> +		.name = "at91sam9rl_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
> +	}, {
> +		.name = "at91sam9g45_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>  
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
> -	struct at_dma_platform_data *pdata;
>  	struct resource		*io;
>  	struct at_dma		*atdma;
>  	size_t			size;
>  	int			irq;
>  	int			err;
>  	int			i;
> +	u32                     nr_channels;
> +	dma_cap_mask_t          cap_mask = {};
> +	enum atdma_devtype	atdmatype;
> +
> +	dma_cap_set(DMA_MEMCPY, cap_mask);
> +
> +	/* get DMA parameters from controller type */
> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>  
> -	/* get DMA Controller parameters from platform */
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
> +	switch (atdmatype) {
> +	case ATDMA_DEVTYPE_SAM9RL:
> +		nr_channels = 2;
> +		break;
> +	case ATDMA_DEVTYPE_SAM9G45:
> +		nr_channels = 8;
> +		dma_cap_set(DMA_SLAVE, cap_mask);
> +		break;
> +	default:
>  		return -EINVAL;

Instead of this song and dance, why not make a configuration structure
and embed that into the platform_device_id table?  Like this:

struct at_dma_platform_data at91sam9rl_config {
	.nr_channels = 2;
	.cap_mask = 0;
};
struct at_dma_platform_data at91samg45_config {
	.nr_channels = 8;
	.cap_mask = DMA_SLAVE;
};
static struct platform_device_id atdma_devtypes[] = {
	{
		.name = "at91sam9rl_dma",
		.driver_data = (unsigned long) at91sam9rl_config,
		/*
		 * Yes, I know, ugly cast; but one case will be needed
		 * regardless when the of_device_id table is added.
		 * It's due to the platform_device_id not using a
		 * void*
		 */
	}, {
		.name = "at91sam9g45_dma",
		.driver_data = (unsigned long) at91sam9g45_config,
	}, {
		/* sentinel */
	}
};

And then the enum can be eliminated entirely.

> +	}
>  
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!io)
> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	size = sizeof(struct at_dma);
> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
> +	size += nr_channels * sizeof(struct at_dma_chan);
>  	atdma = kzalloc(size, GFP_KERNEL);
>  	if (!atdma)
>  		return -ENOMEM;
>  
> -	/* discover transaction capabilites from the platform data */
> -	atdma->dma_common.cap_mask = pdata->cap_mask;
> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
> +	/* discover transaction capabilities */
> +	atdma->dma_common.cap_mask = cap_mask;
> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
> +	atdma->devtype = atdmatype;
>  
>  	size = resource_size(io);
>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  
>  	/* initialize channels related values */
>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
> -	for (i = 0; i < pdata->nr_channels; i++) {
> +	for (i = 0; i < nr_channels; i++) {
>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>  
>  		atchan->chan_common.device = &atdma->dma_common;
> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
> -	  pdata->nr_channels);
> +	  nr_channels);
>  
>  	dma_async_device_register(&atdma->dma_common);
>  
> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>  static struct platform_driver at_dma_driver = {
>  	.remove		= __exit_p(at_dma_remove),
>  	.shutdown	= at_dma_shutdown,
> +	.id_table	= atdma_devtypes,
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index aa4c9ae..d7d6737 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>  
>  /*--  Controller  ------------------------------------------------------*/
>  
> +enum atdma_devtype {
> +	ATDMA_DEVTYPE_UNDEFINED = 0,
> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
> +};
> +
>  /**
>   * struct at_dma - internal representation of an Atmel HDMA Controller
>   * @chan_common: common dmaengine dma_device object members
> + * @atdma_devtype: identifier of DMA controller compatibility
>   * @ch_regs: memory mapped register base
>   * @clk: dma controller clock
>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>   */
>  struct at_dma {
>  	struct dma_device	dma_common;
> +	enum atdma_devtype	devtype;
>  	void __iomem		*regs;
>  	struct clk		*clk;
>  	u32			save_imr;
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-24  9:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-24  9:34 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: vinod.koul, devicetree-discuss, linux-kernel, linux-arm-kernel

On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
> We remove the use of platform data from DMA controller driver.
> We now use of .id_table to distinguish between compatible
> types. The two implementations allow to determine the
> number of channels and the capabilities of the controller.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>  2 files changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index fcfa0a8..d1869c5 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +static struct platform_device_id atdma_devtypes[] = {
> +	{
> +		.name = "at91sam9rl_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
> +	}, {
> +		.name = "at91sam9g45_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>  
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
> -	struct at_dma_platform_data *pdata;
>  	struct resource		*io;
>  	struct at_dma		*atdma;
>  	size_t			size;
>  	int			irq;
>  	int			err;
>  	int			i;
> +	u32                     nr_channels;
> +	dma_cap_mask_t          cap_mask = {};
> +	enum atdma_devtype	atdmatype;
> +
> +	dma_cap_set(DMA_MEMCPY, cap_mask);
> +
> +	/* get DMA parameters from controller type */
> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>  
> -	/* get DMA Controller parameters from platform */
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
> +	switch (atdmatype) {
> +	case ATDMA_DEVTYPE_SAM9RL:
> +		nr_channels = 2;
> +		break;
> +	case ATDMA_DEVTYPE_SAM9G45:
> +		nr_channels = 8;
> +		dma_cap_set(DMA_SLAVE, cap_mask);
> +		break;
> +	default:
>  		return -EINVAL;

Instead of this song and dance, why not make a configuration structure
and embed that into the platform_device_id table?  Like this:

struct at_dma_platform_data at91sam9rl_config {
	.nr_channels = 2;
	.cap_mask = 0;
};
struct at_dma_platform_data at91samg45_config {
	.nr_channels = 8;
	.cap_mask = DMA_SLAVE;
};
static struct platform_device_id atdma_devtypes[] = {
	{
		.name = "at91sam9rl_dma",
		.driver_data = (unsigned long) at91sam9rl_config,
		/*
		 * Yes, I know, ugly cast; but one case will be needed
		 * regardless when the of_device_id table is added.
		 * It's due to the platform_device_id not using a
		 * void*
		 */
	}, {
		.name = "at91sam9g45_dma",
		.driver_data = (unsigned long) at91sam9g45_config,
	}, {
		/* sentinel */
	}
};

And then the enum can be eliminated entirely.

> +	}
>  
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!io)
> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	size = sizeof(struct at_dma);
> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
> +	size += nr_channels * sizeof(struct at_dma_chan);
>  	atdma = kzalloc(size, GFP_KERNEL);
>  	if (!atdma)
>  		return -ENOMEM;
>  
> -	/* discover transaction capabilites from the platform data */
> -	atdma->dma_common.cap_mask = pdata->cap_mask;
> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
> +	/* discover transaction capabilities */
> +	atdma->dma_common.cap_mask = cap_mask;
> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
> +	atdma->devtype = atdmatype;
>  
>  	size = resource_size(io);
>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  
>  	/* initialize channels related values */
>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
> -	for (i = 0; i < pdata->nr_channels; i++) {
> +	for (i = 0; i < nr_channels; i++) {
>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>  
>  		atchan->chan_common.device = &atdma->dma_common;
> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
> -	  pdata->nr_channels);
> +	  nr_channels);
>  
>  	dma_async_device_register(&atdma->dma_common);
>  
> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>  static struct platform_driver at_dma_driver = {
>  	.remove		= __exit_p(at_dma_remove),
>  	.shutdown	= at_dma_shutdown,
> +	.id_table	= atdma_devtypes,
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index aa4c9ae..d7d6737 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>  
>  /*--  Controller  ------------------------------------------------------*/
>  
> +enum atdma_devtype {
> +	ATDMA_DEVTYPE_UNDEFINED = 0,
> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
> +};
> +
>  /**
>   * struct at_dma - internal representation of an Atmel HDMA Controller
>   * @chan_common: common dmaengine dma_device object members
> + * @atdma_devtype: identifier of DMA controller compatibility
>   * @ch_regs: memory mapped register base
>   * @clk: dma controller clock
>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>   */
>  struct at_dma {
>  	struct dma_device	dma_common;
> +	enum atdma_devtype	devtype;
>  	void __iomem		*regs;
>  	struct clk		*clk;
>  	u32			save_imr;
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-10-24  9:34       ` Grant Likely
  0 siblings, 0 replies; 54+ messages in thread
From: Grant Likely @ 2011-10-24  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
> We remove the use of platform data from DMA controller driver.
> We now use of .id_table to distinguish between compatible
> types. The two implementations allow to determine the
> number of channels and the capabilities of the controller.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>  2 files changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index fcfa0a8..d1869c5 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>  
>  /*--  Module Management  -----------------------------------------------*/
>  
> +static struct platform_device_id atdma_devtypes[] = {
> +	{
> +		.name = "at91sam9rl_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
> +	}, {
> +		.name = "at91sam9g45_dma",
> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
>  /**
>   * at_dma_off - disable DMA controller
>   * @atdma: the Atmel HDAMC device
> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>  
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
> -	struct at_dma_platform_data *pdata;
>  	struct resource		*io;
>  	struct at_dma		*atdma;
>  	size_t			size;
>  	int			irq;
>  	int			err;
>  	int			i;
> +	u32                     nr_channels;
> +	dma_cap_mask_t          cap_mask = {};
> +	enum atdma_devtype	atdmatype;
> +
> +	dma_cap_set(DMA_MEMCPY, cap_mask);
> +
> +	/* get DMA parameters from controller type */
> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>  
> -	/* get DMA Controller parameters from platform */
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
> +	switch (atdmatype) {
> +	case ATDMA_DEVTYPE_SAM9RL:
> +		nr_channels = 2;
> +		break;
> +	case ATDMA_DEVTYPE_SAM9G45:
> +		nr_channels = 8;
> +		dma_cap_set(DMA_SLAVE, cap_mask);
> +		break;
> +	default:
>  		return -EINVAL;

Instead of this song and dance, why not make a configuration structure
and embed that into the platform_device_id table?  Like this:

struct at_dma_platform_data at91sam9rl_config {
	.nr_channels = 2;
	.cap_mask = 0;
};
struct at_dma_platform_data at91samg45_config {
	.nr_channels = 8;
	.cap_mask = DMA_SLAVE;
};
static struct platform_device_id atdma_devtypes[] = {
	{
		.name = "at91sam9rl_dma",
		.driver_data = (unsigned long) at91sam9rl_config,
		/*
		 * Yes, I know, ugly cast; but one case will be needed
		 * regardless when the of_device_id table is added.
		 * It's due to the platform_device_id not using a
		 * void*
		 */
	}, {
		.name = "at91sam9g45_dma",
		.driver_data = (unsigned long) at91sam9g45_config,
	}, {
		/* sentinel */
	}
};

And then the enum can be eliminated entirely.

> +	}
>  
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!io)
> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	size = sizeof(struct at_dma);
> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
> +	size += nr_channels * sizeof(struct at_dma_chan);
>  	atdma = kzalloc(size, GFP_KERNEL);
>  	if (!atdma)
>  		return -ENOMEM;
>  
> -	/* discover transaction capabilites from the platform data */
> -	atdma->dma_common.cap_mask = pdata->cap_mask;
> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
> +	/* discover transaction capabilities */
> +	atdma->dma_common.cap_mask = cap_mask;
> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
> +	atdma->devtype = atdmatype;
>  
>  	size = resource_size(io);
>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  
>  	/* initialize channels related values */
>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
> -	for (i = 0; i < pdata->nr_channels; i++) {
> +	for (i = 0; i < nr_channels; i++) {
>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>  
>  		atchan->chan_common.device = &atdma->dma_common;
> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
> -	  pdata->nr_channels);
> +	  nr_channels);
>  
>  	dma_async_device_register(&atdma->dma_common);
>  
> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>  static struct platform_driver at_dma_driver = {
>  	.remove		= __exit_p(at_dma_remove),
>  	.shutdown	= at_dma_shutdown,
> +	.id_table	= atdma_devtypes,
>  	.driver = {
>  		.name	= "at_hdmac",
>  		.pm	= &at_dma_dev_pm_ops,
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index aa4c9ae..d7d6737 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>  
>  /*--  Controller  ------------------------------------------------------*/
>  
> +enum atdma_devtype {
> +	ATDMA_DEVTYPE_UNDEFINED = 0,
> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
> +};
> +
>  /**
>   * struct at_dma - internal representation of an Atmel HDMA Controller
>   * @chan_common: common dmaengine dma_device object members
> + * @atdma_devtype: identifier of DMA controller compatibility
>   * @ch_regs: memory mapped register base
>   * @clk: dma controller clock
>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>   */
>  struct at_dma {
>  	struct dma_device	dma_common;
> +	enum atdma_devtype	devtype;
>  	void __iomem		*regs;
>  	struct clk		*clk;
>  	u32			save_imr;
> -- 
> 1.7.5.4
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-11-10  9:37     ` Vinod Koul
  0 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-11-10  9:37 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: linux-arm-kernel, robherring2, devicetree-discuss, linux-kernel

On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
> On 10/12/2011 06:57 PM, Nicolas Ferre :
> > This series add the device tree support to Atmel DMA controller driver:
> > at_hdmac.
> > The removal of platform data ease the conversion to device tree. It also have
> > the additional benefit of being simpler and cleaner.
> > 
> > Nicolas Ferre (4):
> >       dmaengine: at_hdmac: platform data move to use .id_table
> >       dmaengine: at_hdmac: add device tree support
> >       ARM: at91/dma: remove platform data from DMA controller
> >       ARM: at91/dma: DMA controller registering with DT support
> > 
> >  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >  6 files changed, 97 insertions(+), 36 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.
Thanks applied now

-- 
~Vinod


^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-11-10  9:37     ` Vinod Koul
  0 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-11-10  9:37 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
> On 10/12/2011 06:57 PM, Nicolas Ferre :
> > This series add the device tree support to Atmel DMA controller driver:
> > at_hdmac.
> > The removal of platform data ease the conversion to device tree. It also have
> > the additional benefit of being simpler and cleaner.
> > 
> > Nicolas Ferre (4):
> >       dmaengine: at_hdmac: platform data move to use .id_table
> >       dmaengine: at_hdmac: add device tree support
> >       ARM: at91/dma: remove platform data from DMA controller
> >       ARM: at91/dma: DMA controller registering with DT support
> > 
> >  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >  6 files changed, 97 insertions(+), 36 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.
Thanks applied now

-- 
~Vinod

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA
@ 2011-11-10  9:37     ` Vinod Koul
  0 siblings, 0 replies; 54+ messages in thread
From: Vinod Koul @ 2011-11-10  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-10-17 at 14:54 +0200, Nicolas Ferre wrote:
> On 10/12/2011 06:57 PM, Nicolas Ferre :
> > This series add the device tree support to Atmel DMA controller driver:
> > at_hdmac.
> > The removal of platform data ease the conversion to device tree. It also have
> > the additional benefit of being simpler and cleaner.
> > 
> > Nicolas Ferre (4):
> >       dmaengine: at_hdmac: platform data move to use .id_table
> >       dmaengine: at_hdmac: add device tree support
> >       ARM: at91/dma: remove platform data from DMA controller
> >       ARM: at91/dma: DMA controller registering with DT support
> > 
> >  .../devicetree/bindings/dma/atmel-dma.txt          |   14 ++++
> >  arch/arm/mach-at91/at91sam9g45_devices.c           |   17 ++---
> >  arch/arm/mach-at91/at91sam9rl_devices.c            |    8 +--
> >  arch/arm/mach-at91/include/mach/at_hdmac.h         |   10 ---
> >  drivers/dma/at_hdmac.c                             |   76 +++++++++++++++++---
> >  drivers/dma/at_hdmac_regs.h                        |    8 ++
> >  6 files changed, 97 insertions(+), 36 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/atmel-dma.txt
> 
> Vinod,
> 
> I have just rebased the dmaengine at_hdmac driver patches on top of your
> "next" branch as a "v4" series. I send it to you with Grant's "Acked-by"
> right now.
Thanks applied now

-- 
~Vinod

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-11-22 10:55         ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-11-22 10:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: vinod.koul, devicetree-discuss, linux-kernel, linux-arm-kernel

On 10/24/2011 11:34 AM, Grant Likely :
> On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
>> We remove the use of platform data from DMA controller driver.
>> We now use of .id_table to distinguish between compatible
>> types. The two implementations allow to determine the
>> number of channels and the capabilities of the controller.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>>  2 files changed, 46 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index fcfa0a8..d1869c5 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +static struct platform_device_id atdma_devtypes[] = {
>> +	{
>> +		.name = "at91sam9rl_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
>> +	}, {
>> +		.name = "at91sam9g45_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
>> +	}, {
>> +		/* sentinel */
>> +	}
>> +};
>> +
>>  /**
>>   * at_dma_off - disable DMA controller
>>   * @atdma: the Atmel HDAMC device
>> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>>  
>>  static int __init at_dma_probe(struct platform_device *pdev)
>>  {
>> -	struct at_dma_platform_data *pdata;
>>  	struct resource		*io;
>>  	struct at_dma		*atdma;
>>  	size_t			size;
>>  	int			irq;
>>  	int			err;
>>  	int			i;
>> +	u32                     nr_channels;
>> +	dma_cap_mask_t          cap_mask = {};
>> +	enum atdma_devtype	atdmatype;
>> +
>> +	dma_cap_set(DMA_MEMCPY, cap_mask);
>> +
>> +	/* get DMA parameters from controller type */
>> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>>  
>> -	/* get DMA Controller parameters from platform */
>> -	pdata = pdev->dev.platform_data;
>> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
>> +	switch (atdmatype) {
>> +	case ATDMA_DEVTYPE_SAM9RL:
>> +		nr_channels = 2;
>> +		break;
>> +	case ATDMA_DEVTYPE_SAM9G45:
>> +		nr_channels = 8;
>> +		dma_cap_set(DMA_SLAVE, cap_mask);
>> +		break;
>> +	default:
>>  		return -EINVAL;
> 
> Instead of this song and dance, why not make a configuration structure
> and embed that into the platform_device_id table?  Like this:
> 
> struct at_dma_platform_data at91sam9rl_config {
> 	.nr_channels = 2;
> 	.cap_mask = 0;
> };
> struct at_dma_platform_data at91samg45_config {
> 	.nr_channels = 8;
> 	.cap_mask = DMA_SLAVE;
> };
> static struct platform_device_id atdma_devtypes[] = {
> 	{
> 		.name = "at91sam9rl_dma",
> 		.driver_data = (unsigned long) at91sam9rl_config,
> 		/*
> 		 * Yes, I know, ugly cast; but one case will be needed
> 		 * regardless when the of_device_id table is added.
> 		 * It's due to the platform_device_id not using a
> 		 * void*
> 		 */
> 	}, {
> 		.name = "at91sam9g45_dma",
> 		.driver_data = (unsigned long) at91sam9g45_config,
> 	}, {
> 		/* sentinel */
> 	}
> };
> 
> And then the enum can be eliminated entirely.

That looks nice!

I send a patch that goes on top of this series to simplify things like
you indicate.

Thanks for your review.

>> +	}
>>  
>>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	if (!io)
>> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  		return irq;
>>  
>>  	size = sizeof(struct at_dma);
>> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
>> +	size += nr_channels * sizeof(struct at_dma_chan);
>>  	atdma = kzalloc(size, GFP_KERNEL);
>>  	if (!atdma)
>>  		return -ENOMEM;
>>  
>> -	/* discover transaction capabilites from the platform data */
>> -	atdma->dma_common.cap_mask = pdata->cap_mask;
>> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
>> +	/* discover transaction capabilities */
>> +	atdma->dma_common.cap_mask = cap_mask;
>> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
>> +	atdma->devtype = atdmatype;
>>  
>>  	size = resource_size(io);
>>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
>> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  
>>  	/* initialize channels related values */
>>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
>> -	for (i = 0; i < pdata->nr_channels; i++) {
>> +	for (i = 0; i < nr_channels; i++) {
>>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>>  
>>  		atchan->chan_common.device = &atdma->dma_common;
>> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
>> -	  pdata->nr_channels);
>> +	  nr_channels);
>>  
>>  	dma_async_device_register(&atdma->dma_common);
>>  
>> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>>  static struct platform_driver at_dma_driver = {
>>  	.remove		= __exit_p(at_dma_remove),
>>  	.shutdown	= at_dma_shutdown,
>> +	.id_table	= atdma_devtypes,
>>  	.driver = {
>>  		.name	= "at_hdmac",
>>  		.pm	= &at_dma_dev_pm_ops,
>> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
>> index aa4c9ae..d7d6737 100644
>> --- a/drivers/dma/at_hdmac_regs.h
>> +++ b/drivers/dma/at_hdmac_regs.h
>> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>  
>>  /*--  Controller  ------------------------------------------------------*/
>>  
>> +enum atdma_devtype {
>> +	ATDMA_DEVTYPE_UNDEFINED = 0,
>> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
>> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
>> +};
>> +
>>  /**
>>   * struct at_dma - internal representation of an Atmel HDMA Controller
>>   * @chan_common: common dmaengine dma_device object members
>> + * @atdma_devtype: identifier of DMA controller compatibility
>>   * @ch_regs: memory mapped register base
>>   * @clk: dma controller clock
>>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
>> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>   */
>>  struct at_dma {
>>  	struct dma_device	dma_common;
>> +	enum atdma_devtype	devtype;
>>  	void __iomem		*regs;
>>  	struct clk		*clk;
>>  	u32			save_imr;
>> -- 
>> 1.7.5.4
>>
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-11-22 10:55         ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-11-22 10:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 10/24/2011 11:34 AM, Grant Likely :
> On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
>> We remove the use of platform data from DMA controller driver.
>> We now use of .id_table to distinguish between compatible
>> types. The two implementations allow to determine the
>> number of channels and the capabilities of the controller.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>> ---
>>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>>  2 files changed, 46 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index fcfa0a8..d1869c5 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +static struct platform_device_id atdma_devtypes[] = {
>> +	{
>> +		.name = "at91sam9rl_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
>> +	}, {
>> +		.name = "at91sam9g45_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
>> +	}, {
>> +		/* sentinel */
>> +	}
>> +};
>> +
>>  /**
>>   * at_dma_off - disable DMA controller
>>   * @atdma: the Atmel HDAMC device
>> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>>  
>>  static int __init at_dma_probe(struct platform_device *pdev)
>>  {
>> -	struct at_dma_platform_data *pdata;
>>  	struct resource		*io;
>>  	struct at_dma		*atdma;
>>  	size_t			size;
>>  	int			irq;
>>  	int			err;
>>  	int			i;
>> +	u32                     nr_channels;
>> +	dma_cap_mask_t          cap_mask = {};
>> +	enum atdma_devtype	atdmatype;
>> +
>> +	dma_cap_set(DMA_MEMCPY, cap_mask);
>> +
>> +	/* get DMA parameters from controller type */
>> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>>  
>> -	/* get DMA Controller parameters from platform */
>> -	pdata = pdev->dev.platform_data;
>> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
>> +	switch (atdmatype) {
>> +	case ATDMA_DEVTYPE_SAM9RL:
>> +		nr_channels = 2;
>> +		break;
>> +	case ATDMA_DEVTYPE_SAM9G45:
>> +		nr_channels = 8;
>> +		dma_cap_set(DMA_SLAVE, cap_mask);
>> +		break;
>> +	default:
>>  		return -EINVAL;
> 
> Instead of this song and dance, why not make a configuration structure
> and embed that into the platform_device_id table?  Like this:
> 
> struct at_dma_platform_data at91sam9rl_config {
> 	.nr_channels = 2;
> 	.cap_mask = 0;
> };
> struct at_dma_platform_data at91samg45_config {
> 	.nr_channels = 8;
> 	.cap_mask = DMA_SLAVE;
> };
> static struct platform_device_id atdma_devtypes[] = {
> 	{
> 		.name = "at91sam9rl_dma",
> 		.driver_data = (unsigned long) at91sam9rl_config,
> 		/*
> 		 * Yes, I know, ugly cast; but one case will be needed
> 		 * regardless when the of_device_id table is added.
> 		 * It's due to the platform_device_id not using a
> 		 * void*
> 		 */
> 	}, {
> 		.name = "at91sam9g45_dma",
> 		.driver_data = (unsigned long) at91sam9g45_config,
> 	}, {
> 		/* sentinel */
> 	}
> };
> 
> And then the enum can be eliminated entirely.

That looks nice!

I send a patch that goes on top of this series to simplify things like
you indicate.

Thanks for your review.

>> +	}
>>  
>>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	if (!io)
>> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  		return irq;
>>  
>>  	size = sizeof(struct at_dma);
>> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
>> +	size += nr_channels * sizeof(struct at_dma_chan);
>>  	atdma = kzalloc(size, GFP_KERNEL);
>>  	if (!atdma)
>>  		return -ENOMEM;
>>  
>> -	/* discover transaction capabilites from the platform data */
>> -	atdma->dma_common.cap_mask = pdata->cap_mask;
>> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
>> +	/* discover transaction capabilities */
>> +	atdma->dma_common.cap_mask = cap_mask;
>> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
>> +	atdma->devtype = atdmatype;
>>  
>>  	size = resource_size(io);
>>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
>> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  
>>  	/* initialize channels related values */
>>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
>> -	for (i = 0; i < pdata->nr_channels; i++) {
>> +	for (i = 0; i < nr_channels; i++) {
>>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>>  
>>  		atchan->chan_common.device = &atdma->dma_common;
>> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
>> -	  pdata->nr_channels);
>> +	  nr_channels);
>>  
>>  	dma_async_device_register(&atdma->dma_common);
>>  
>> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>>  static struct platform_driver at_dma_driver = {
>>  	.remove		= __exit_p(at_dma_remove),
>>  	.shutdown	= at_dma_shutdown,
>> +	.id_table	= atdma_devtypes,
>>  	.driver = {
>>  		.name	= "at_hdmac",
>>  		.pm	= &at_dma_dev_pm_ops,
>> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
>> index aa4c9ae..d7d6737 100644
>> --- a/drivers/dma/at_hdmac_regs.h
>> +++ b/drivers/dma/at_hdmac_regs.h
>> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>  
>>  /*--  Controller  ------------------------------------------------------*/
>>  
>> +enum atdma_devtype {
>> +	ATDMA_DEVTYPE_UNDEFINED = 0,
>> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
>> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
>> +};
>> +
>>  /**
>>   * struct at_dma - internal representation of an Atmel HDMA Controller
>>   * @chan_common: common dmaengine dma_device object members
>> + * @atdma_devtype: identifier of DMA controller compatibility
>>   * @ch_regs: memory mapped register base
>>   * @clk: dma controller clock
>>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
>> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>   */
>>  struct at_dma {
>>  	struct dma_device	dma_common;
>> +	enum atdma_devtype	devtype;
>>  	void __iomem		*regs;
>>  	struct clk		*clk;
>>  	u32			save_imr;
>> -- 
>> 1.7.5.4
>>
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table
@ 2011-11-22 10:55         ` Nicolas Ferre
  0 siblings, 0 replies; 54+ messages in thread
From: Nicolas Ferre @ 2011-11-22 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/24/2011 11:34 AM, Grant Likely :
> On Mon, Oct 17, 2011 at 02:56:40PM +0200, Nicolas Ferre wrote:
>> We remove the use of platform data from DMA controller driver.
>> We now use of .id_table to distinguish between compatible
>> types. The two implementations allow to determine the
>> number of channels and the capabilities of the controller.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>>  drivers/dma/at_hdmac.c      |   48 ++++++++++++++++++++++++++++++++++---------
>>  drivers/dma/at_hdmac_regs.h |    8 +++++++
>>  2 files changed, 46 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index fcfa0a8..d1869c5 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -1175,6 +1175,18 @@ static void atc_free_chan_resources(struct dma_chan *chan)
>>  
>>  /*--  Module Management  -----------------------------------------------*/
>>  
>> +static struct platform_device_id atdma_devtypes[] = {
>> +	{
>> +		.name = "at91sam9rl_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9RL,
>> +	}, {
>> +		.name = "at91sam9g45_dma",
>> +		.driver_data = ATDMA_DEVTYPE_SAM9G45,
>> +	}, {
>> +		/* sentinel */
>> +	}
>> +};
>> +
>>  /**
>>   * at_dma_off - disable DMA controller
>>   * @atdma: the Atmel HDAMC device
>> @@ -1193,18 +1205,32 @@ static void at_dma_off(struct at_dma *atdma)
>>  
>>  static int __init at_dma_probe(struct platform_device *pdev)
>>  {
>> -	struct at_dma_platform_data *pdata;
>>  	struct resource		*io;
>>  	struct at_dma		*atdma;
>>  	size_t			size;
>>  	int			irq;
>>  	int			err;
>>  	int			i;
>> +	u32                     nr_channels;
>> +	dma_cap_mask_t          cap_mask = {};
>> +	enum atdma_devtype	atdmatype;
>> +
>> +	dma_cap_set(DMA_MEMCPY, cap_mask);
>> +
>> +	/* get DMA parameters from controller type */
>> +	atdmatype = platform_get_device_id(pdev)->driver_data;
>>  
>> -	/* get DMA Controller parameters from platform */
>> -	pdata = pdev->dev.platform_data;
>> -	if (!pdata || pdata->nr_channels > AT_DMA_MAX_NR_CHANNELS)
>> +	switch (atdmatype) {
>> +	case ATDMA_DEVTYPE_SAM9RL:
>> +		nr_channels = 2;
>> +		break;
>> +	case ATDMA_DEVTYPE_SAM9G45:
>> +		nr_channels = 8;
>> +		dma_cap_set(DMA_SLAVE, cap_mask);
>> +		break;
>> +	default:
>>  		return -EINVAL;
> 
> Instead of this song and dance, why not make a configuration structure
> and embed that into the platform_device_id table?  Like this:
> 
> struct at_dma_platform_data at91sam9rl_config {
> 	.nr_channels = 2;
> 	.cap_mask = 0;
> };
> struct at_dma_platform_data at91samg45_config {
> 	.nr_channels = 8;
> 	.cap_mask = DMA_SLAVE;
> };
> static struct platform_device_id atdma_devtypes[] = {
> 	{
> 		.name = "at91sam9rl_dma",
> 		.driver_data = (unsigned long) at91sam9rl_config,
> 		/*
> 		 * Yes, I know, ugly cast; but one case will be needed
> 		 * regardless when the of_device_id table is added.
> 		 * It's due to the platform_device_id not using a
> 		 * void*
> 		 */
> 	}, {
> 		.name = "at91sam9g45_dma",
> 		.driver_data = (unsigned long) at91sam9g45_config,
> 	}, {
> 		/* sentinel */
> 	}
> };
> 
> And then the enum can be eliminated entirely.

That looks nice!

I send a patch that goes on top of this series to simplify things like
you indicate.

Thanks for your review.

>> +	}
>>  
>>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	if (!io)
>> @@ -1215,14 +1241,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  		return irq;
>>  
>>  	size = sizeof(struct at_dma);
>> -	size += pdata->nr_channels * sizeof(struct at_dma_chan);
>> +	size += nr_channels * sizeof(struct at_dma_chan);
>>  	atdma = kzalloc(size, GFP_KERNEL);
>>  	if (!atdma)
>>  		return -ENOMEM;
>>  
>> -	/* discover transaction capabilites from the platform data */
>> -	atdma->dma_common.cap_mask = pdata->cap_mask;
>> -	atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
>> +	/* discover transaction capabilities */
>> +	atdma->dma_common.cap_mask = cap_mask;
>> +	atdma->all_chan_mask = (1 << nr_channels) - 1;
>> +	atdma->devtype = atdmatype;
>>  
>>  	size = resource_size(io);
>>  	if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
>> @@ -1268,7 +1295,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  
>>  	/* initialize channels related values */
>>  	INIT_LIST_HEAD(&atdma->dma_common.channels);
>> -	for (i = 0; i < pdata->nr_channels; i++) {
>> +	for (i = 0; i < nr_channels; i++) {
>>  		struct at_dma_chan	*atchan = &atdma->chan[i];
>>  
>>  		atchan->chan_common.device = &atdma->dma_common;
>> @@ -1313,7 +1340,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
>>  	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
>>  	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
>> -	  pdata->nr_channels);
>> +	  nr_channels);
>>  
>>  	dma_async_device_register(&atdma->dma_common);
>>  
>> @@ -1495,6 +1522,7 @@ static const struct dev_pm_ops at_dma_dev_pm_ops = {
>>  static struct platform_driver at_dma_driver = {
>>  	.remove		= __exit_p(at_dma_remove),
>>  	.shutdown	= at_dma_shutdown,
>> +	.id_table	= atdma_devtypes,
>>  	.driver = {
>>  		.name	= "at_hdmac",
>>  		.pm	= &at_dma_dev_pm_ops,
>> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
>> index aa4c9ae..d7d6737 100644
>> --- a/drivers/dma/at_hdmac_regs.h
>> +++ b/drivers/dma/at_hdmac_regs.h
>> @@ -248,9 +248,16 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>  
>>  /*--  Controller  ------------------------------------------------------*/
>>  
>> +enum atdma_devtype {
>> +	ATDMA_DEVTYPE_UNDEFINED = 0,
>> +	ATDMA_DEVTYPE_SAM9RL,	/* compatible with SAM9RL DMA controller */
>> +	ATDMA_DEVTYPE_SAM9G45,	/* compatible with SAM9G45 DMA controller */
>> +};
>> +
>>  /**
>>   * struct at_dma - internal representation of an Atmel HDMA Controller
>>   * @chan_common: common dmaengine dma_device object members
>> + * @atdma_devtype: identifier of DMA controller compatibility
>>   * @ch_regs: memory mapped register base
>>   * @clk: dma controller clock
>>   * @save_imr: interrupt mask register that is saved on suspend/resume cycle
>> @@ -260,6 +267,7 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
>>   */
>>  struct at_dma {
>>  	struct dma_device	dma_common;
>> +	enum atdma_devtype	devtype;
>>  	void __iomem		*regs;
>>  	struct clk		*clk;
>>  	u32			save_imr;
>> -- 
>> 1.7.5.4
>>
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2011-11-22 10:55 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-12 16:57 [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA Nicolas Ferre
2011-10-12 16:57 ` Nicolas Ferre
2011-10-12 16:57 ` Nicolas Ferre
2011-10-12 16:57 ` [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table Nicolas Ferre
2011-10-12 16:57   ` Nicolas Ferre
2011-10-12 16:57   ` Nicolas Ferre
2011-10-12 16:57   ` [PATCH v3 2/4] dmaengine: at_hdmac: add device tree support Nicolas Ferre
2011-10-12 16:57     ` Nicolas Ferre
2011-10-13  0:34     ` Grant Likely
2011-10-13  0:34       ` Grant Likely
2011-10-13 11:54       ` Nicolas Ferre
2011-10-13 11:54         ` Nicolas Ferre
2011-10-13 11:54         ` Nicolas Ferre
2011-10-12 16:57   ` [PATCH v3 3/4] ARM: at91/dma: remove platform data from DMA controller Nicolas Ferre
2011-10-12 16:57     ` Nicolas Ferre
2011-10-12 16:57     ` Nicolas Ferre
2011-10-13  0:34     ` Grant Likely
2011-10-13  0:34       ` Grant Likely
2011-10-13  0:34       ` Grant Likely
2011-10-12 16:57   ` [PATCH v3 4/4] ARM: at91/dma: DMA controller registering with DT support Nicolas Ferre
2011-10-12 16:57     ` Nicolas Ferre
2011-10-13  0:35     ` Grant Likely
2011-10-13  0:35       ` Grant Likely
2011-10-13  0:35       ` Grant Likely
2011-10-13  0:32   ` [PATCH v3 1/4] dmaengine: at_hdmac: platform data move to use .id_table Grant Likely
2011-10-13  0:32     ` Grant Likely
2011-10-17 12:54 ` [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA Nicolas Ferre
2011-10-17 12:54   ` Nicolas Ferre
2011-10-17 12:54   ` Nicolas Ferre
2011-10-17 12:56   ` [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table Nicolas Ferre
2011-10-17 12:56     ` Nicolas Ferre
2011-10-17 12:56     ` Nicolas Ferre
2011-10-17 12:56     ` [PATCH v4 2/2] dmaengine: at_hdmac: add device tree support Nicolas Ferre
2011-10-17 12:56       ` Nicolas Ferre
2011-10-17 12:56       ` Nicolas Ferre
2011-10-24  9:34     ` [PATCH v4 1/2] dmaengine: at_hdmac: platform data move to use .id_table Grant Likely
2011-10-24  9:34       ` Grant Likely
2011-10-24  9:34       ` Grant Likely
2011-11-22 10:55       ` Nicolas Ferre
2011-11-22 10:55         ` Nicolas Ferre
2011-11-22 10:55         ` Nicolas Ferre
2011-10-23 14:30   ` [PATCH v3 0/4] dmaengine: Device Tree support for Atmel DMA Nicolas Ferre
2011-10-23 14:30     ` Nicolas Ferre
2011-10-23 14:30     ` Nicolas Ferre
2011-10-24  3:04     ` Vinod Koul
2011-10-24  3:04       ` Vinod Koul
2011-10-24  3:28   ` Vinod Koul
2011-10-24  3:28     ` Vinod Koul
2011-10-24  9:05     ` Nicolas Ferre
2011-10-24  9:05       ` Nicolas Ferre
2011-10-24  9:05       ` Nicolas Ferre
2011-11-10  9:37   ` Vinod Koul
2011-11-10  9:37     ` Vinod Koul
2011-11-10  9:37     ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.