All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] ARM: OMAP2+: remove DMA interrupt if DT provided
@ 2014-06-12 11:45 ` Sricharan R
  0 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: tony, santosh.shilimkar, nm, rnayak, linux, r.sricharan

This series removes the DMA interrupt registration if DT provides interrupts,
so we have no need for hwmod provided interrupt number.

This is a pre-req for crossbar migration as DMA is the last driver to use
interrupt definition from hwmod.

[V2] Rebased on 3.15 mainline

Nishanth Menon (2):
  ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
  ARM: DRA7: hwmod: remove interrupts for DMA

 arch/arm/mach-omap2/dma.c                 |    3 +++
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c |    9 ---------
 arch/arm/plat-omap/dma.c                  |    5 +++--
 include/linux/omap-dma.h                  |    1 +
 4 files changed, 7 insertions(+), 11 deletions(-)

-- 
1.7.9.5


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

* [PATCH V2 0/2] ARM: OMAP2+: remove DMA interrupt if DT provided
@ 2014-06-12 11:45 ` Sricharan R
  0 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

This series removes the DMA interrupt registration if DT provides interrupts,
so we have no need for hwmod provided interrupt number.

This is a pre-req for crossbar migration as DMA is the last driver to use
interrupt definition from hwmod.

[V2] Rebased on 3.15 mainline

Nishanth Menon (2):
  ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
  ARM: DRA7: hwmod: remove interrupts for DMA

 arch/arm/mach-omap2/dma.c                 |    3 +++
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c |    9 ---------
 arch/arm/plat-omap/dma.c                  |    5 +++--
 include/linux/omap-dma.h                  |    1 +
 4 files changed, 7 insertions(+), 11 deletions(-)

-- 
1.7.9.5

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

* [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
  2014-06-12 11:45 ` Sricharan R
@ 2014-06-12 11:45   ` Sricharan R
  -1 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: tony, santosh.shilimkar, nm, rnayak, linux, r.sricharan

From: Nishanth Menon <nm@ti.com>

we have currently 2 DMA drivers that try to co-exist.
drivers/dma/omap-dma.c which registers it's own IRQ and is device tree
aware and uses arch/arm/plat-omap/dma.c instance created by
arch/arm/mach-omap2/dma.c to maintain channel usage (omap_request_dma).

Currently both try to register interrupts and mach-omap2/plat-omap dma.c
attempts to use the IRQ number registered by hwmod to register it's own
interrupt handler.

Now, there is no reasonable way of static allocating DMA irq in GIC
SPI when we use crossbar. However, since the dma_chan structure is
freed as a result of IRQ not being present due to devm allocation,
maintaining information of channel by platform code fails at a later
point in time when that region of memory is reused.

So, if hwmod does not indicate an IRQ number, then, assume that
dma-engine will take care of the interrupt handling.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/dma.c |    3 +++
 arch/arm/plat-omap/dma.c  |    5 +++--
 include/linux/omap-dma.h  |    1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index a6d2cf1..e1a56d8 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -259,6 +259,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
 		d->dev_caps |= HS_CHANNELS_RESERVED;
 
+	if (platform_get_irq_byname(pdev, "0") < 0)
+		d->dev_caps |= DMA_ENGINE_HANDLE_IRQ;
+
 	/* Check the capabilities register for descriptor loading feature */
 	if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
 		dma_common_ch_end = CCDN;
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index b5608b1..7aae0e5 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -2100,7 +2100,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
 		omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE,
 				DMA_DEFAULT_FIFO_DEPTH, 0);
 
-	if (dma_omap2plus()) {
+	if (dma_omap2plus() && !(d->dev_caps & DMA_ENGINE_HANDLE_IRQ)) {
 		strcpy(irq_name, "0");
 		dma_irq = platform_get_irq_byname(pdev, irq_name);
 		if (dma_irq < 0) {
@@ -2145,7 +2145,8 @@ static int omap_system_dma_remove(struct platform_device *pdev)
 		char irq_name[4];
 		strcpy(irq_name, "0");
 		dma_irq = platform_get_irq_byname(pdev, irq_name);
-		remove_irq(dma_irq, &omap24xx_dma_irq);
+		if (dma_irq >= 0)
+			remove_irq(dma_irq, &omap24xx_dma_irq);
 	} else {
 		int irq_rel = 0;
 		for ( ; irq_rel < dma_chan_count; irq_rel++) {
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4..6f06f8b 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
 #define IS_WORD_16			BIT(0xd)
 #define ENABLE_16XX_MODE		BIT(0xe)
 #define HS_CHANNELS_RESERVED		BIT(0xf)
+#define DMA_ENGINE_HANDLE_IRQ		BIT(0x10)
 
 /* Defines for DMA Capabilities */
 #define DMA_HAS_TRANSPARENT_CAPS	(0x1 << 18)
-- 
1.7.9.5


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

* [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
@ 2014-06-12 11:45   ` Sricharan R
  0 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

we have currently 2 DMA drivers that try to co-exist.
drivers/dma/omap-dma.c which registers it's own IRQ and is device tree
aware and uses arch/arm/plat-omap/dma.c instance created by
arch/arm/mach-omap2/dma.c to maintain channel usage (omap_request_dma).

Currently both try to register interrupts and mach-omap2/plat-omap dma.c
attempts to use the IRQ number registered by hwmod to register it's own
interrupt handler.

Now, there is no reasonable way of static allocating DMA irq in GIC
SPI when we use crossbar. However, since the dma_chan structure is
freed as a result of IRQ not being present due to devm allocation,
maintaining information of channel by platform code fails at a later
point in time when that region of memory is reused.

So, if hwmod does not indicate an IRQ number, then, assume that
dma-engine will take care of the interrupt handling.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/dma.c |    3 +++
 arch/arm/plat-omap/dma.c  |    5 +++--
 include/linux/omap-dma.h  |    1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index a6d2cf1..e1a56d8 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -259,6 +259,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
 		d->dev_caps |= HS_CHANNELS_RESERVED;
 
+	if (platform_get_irq_byname(pdev, "0") < 0)
+		d->dev_caps |= DMA_ENGINE_HANDLE_IRQ;
+
 	/* Check the capabilities register for descriptor loading feature */
 	if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
 		dma_common_ch_end = CCDN;
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index b5608b1..7aae0e5 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -2100,7 +2100,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
 		omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE,
 				DMA_DEFAULT_FIFO_DEPTH, 0);
 
-	if (dma_omap2plus()) {
+	if (dma_omap2plus() && !(d->dev_caps & DMA_ENGINE_HANDLE_IRQ)) {
 		strcpy(irq_name, "0");
 		dma_irq = platform_get_irq_byname(pdev, irq_name);
 		if (dma_irq < 0) {
@@ -2145,7 +2145,8 @@ static int omap_system_dma_remove(struct platform_device *pdev)
 		char irq_name[4];
 		strcpy(irq_name, "0");
 		dma_irq = platform_get_irq_byname(pdev, irq_name);
-		remove_irq(dma_irq, &omap24xx_dma_irq);
+		if (dma_irq >= 0)
+			remove_irq(dma_irq, &omap24xx_dma_irq);
 	} else {
 		int irq_rel = 0;
 		for ( ; irq_rel < dma_chan_count; irq_rel++) {
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4..6f06f8b 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
 #define IS_WORD_16			BIT(0xd)
 #define ENABLE_16XX_MODE		BIT(0xe)
 #define HS_CHANNELS_RESERVED		BIT(0xf)
+#define DMA_ENGINE_HANDLE_IRQ		BIT(0x10)
 
 /* Defines for DMA Capabilities */
 #define DMA_HAS_TRANSPARENT_CAPS	(0x1 << 18)
-- 
1.7.9.5

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

* [PATCH V2 2/2] ARM: DRA7: hwmod: remove interrupts for DMA
  2014-06-12 11:45 ` Sricharan R
@ 2014-06-12 11:45   ` Sricharan R
  -1 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: tony, santosh.shilimkar, nm, rnayak, linux, r.sricharan

From: Nishanth Menon <nm@ti.com>

DMA interrupts are now available in of, and the definitions are
duplicates in hwmod. This prevents us from dynamically allocating
interrupt resources for dma from devicetree.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c |    9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 20b4398..31fd260 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -343,19 +343,10 @@ static struct omap_dma_dev_attr dma_dev_attr = {
 };
 
 /* dma_system */
-static struct omap_hwmod_irq_info dra7xx_dma_system_irqs[] = {
-	{ .name = "0", .irq = 12 + DRA7XX_IRQ_GIC_START },
-	{ .name = "1", .irq = 13 + DRA7XX_IRQ_GIC_START },
-	{ .name = "2", .irq = 14 + DRA7XX_IRQ_GIC_START },
-	{ .name = "3", .irq = 15 + DRA7XX_IRQ_GIC_START },
-	{ .irq = -1 }
-};
-
 static struct omap_hwmod dra7xx_dma_system_hwmod = {
 	.name		= "dma_system",
 	.class		= &dra7xx_dma_hwmod_class,
 	.clkdm_name	= "dma_clkdm",
-	.mpu_irqs	= dra7xx_dma_system_irqs,
 	.main_clk	= "l3_iclk_div",
 	.prcm = {
 		.omap4 = {
-- 
1.7.9.5


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

* [PATCH V2 2/2] ARM: DRA7: hwmod: remove interrupts for DMA
@ 2014-06-12 11:45   ` Sricharan R
  0 siblings, 0 replies; 8+ messages in thread
From: Sricharan R @ 2014-06-12 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

DMA interrupts are now available in of, and the definitions are
duplicates in hwmod. This prevents us from dynamically allocating
interrupt resources for dma from devicetree.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c |    9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 20b4398..31fd260 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -343,19 +343,10 @@ static struct omap_dma_dev_attr dma_dev_attr = {
 };
 
 /* dma_system */
-static struct omap_hwmod_irq_info dra7xx_dma_system_irqs[] = {
-	{ .name = "0", .irq = 12 + DRA7XX_IRQ_GIC_START },
-	{ .name = "1", .irq = 13 + DRA7XX_IRQ_GIC_START },
-	{ .name = "2", .irq = 14 + DRA7XX_IRQ_GIC_START },
-	{ .name = "3", .irq = 15 + DRA7XX_IRQ_GIC_START },
-	{ .irq = -1 }
-};
-
 static struct omap_hwmod dra7xx_dma_system_hwmod = {
 	.name		= "dma_system",
 	.class		= &dra7xx_dma_hwmod_class,
 	.clkdm_name	= "dma_clkdm",
-	.mpu_irqs	= dra7xx_dma_system_irqs,
 	.main_clk	= "l3_iclk_div",
 	.prcm = {
 		.omap4 = {
-- 
1.7.9.5

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

* Re: [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
  2014-06-12 11:45   ` Sricharan R
@ 2014-07-22  6:37     ` Tony Lindgren
  -1 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2014-07-22  6:37 UTC (permalink / raw)
  To: Sricharan R
  Cc: linux-omap, linux-arm-kernel, santosh.shilimkar, nm, rnayak, linux

* Sricharan R <r.sricharan@ti.com> [140612 04:48]:
> From: Nishanth Menon <nm@ti.com>
> 
> we have currently 2 DMA drivers that try to co-exist.
> drivers/dma/omap-dma.c which registers it's own IRQ and is device tree
> aware and uses arch/arm/plat-omap/dma.c instance created by
> arch/arm/mach-omap2/dma.c to maintain channel usage (omap_request_dma).
> 
> Currently both try to register interrupts and mach-omap2/plat-omap dma.c
> attempts to use the IRQ number registered by hwmod to register it's own
> interrupt handler.
> 
> Now, there is no reasonable way of static allocating DMA irq in GIC
> SPI when we use crossbar. However, since the dma_chan structure is
> freed as a result of IRQ not being present due to devm allocation,
> maintaining information of channel by platform code fails at a later
> point in time when that region of memory is reused.
> 
> So, if hwmod does not indicate an IRQ number, then, assume that
> dma-engine will take care of the interrupt handling.

Looks OK to me, applying both into omap-for-v3.17/soc thanks.

Regards,

Tony

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

* [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver
@ 2014-07-22  6:37     ` Tony Lindgren
  0 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2014-07-22  6:37 UTC (permalink / raw)
  To: linux-arm-kernel

* Sricharan R <r.sricharan@ti.com> [140612 04:48]:
> From: Nishanth Menon <nm@ti.com>
> 
> we have currently 2 DMA drivers that try to co-exist.
> drivers/dma/omap-dma.c which registers it's own IRQ and is device tree
> aware and uses arch/arm/plat-omap/dma.c instance created by
> arch/arm/mach-omap2/dma.c to maintain channel usage (omap_request_dma).
> 
> Currently both try to register interrupts and mach-omap2/plat-omap dma.c
> attempts to use the IRQ number registered by hwmod to register it's own
> interrupt handler.
> 
> Now, there is no reasonable way of static allocating DMA irq in GIC
> SPI when we use crossbar. However, since the dma_chan structure is
> freed as a result of IRQ not being present due to devm allocation,
> maintaining information of channel by platform code fails at a later
> point in time when that region of memory is reused.
> 
> So, if hwmod does not indicate an IRQ number, then, assume that
> dma-engine will take care of the interrupt handling.

Looks OK to me, applying both into omap-for-v3.17/soc thanks.

Regards,

Tony

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

end of thread, other threads:[~2014-07-22  6:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 11:45 [PATCH V2 0/2] ARM: OMAP2+: remove DMA interrupt if DT provided Sricharan R
2014-06-12 11:45 ` Sricharan R
2014-06-12 11:45 ` [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver Sricharan R
2014-06-12 11:45   ` Sricharan R
2014-07-22  6:37   ` Tony Lindgren
2014-07-22  6:37     ` Tony Lindgren
2014-06-12 11:45 ` [PATCH V2 2/2] ARM: DRA7: hwmod: remove interrupts for DMA Sricharan R
2014-06-12 11:45   ` Sricharan R

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.