All of lore.kernel.org
 help / color / mirror / Atom feed
* i.MX: switch to sparse irqs
@ 2011-05-20  7:59 Sascha Hauer
  2011-05-20  7:59 ` [PATCH 1/9] ARM i.MX tzic: do not depend on MXC_INTERNAL_IRQS Sascha Hauer
                   ` (9 more replies)
  0 siblings, 10 replies; 39+ messages in thread
From: Sascha Hauer @ 2011-05-20  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

The following series switches the i.MX architecture to sparse
irqs. It allows us to remove some ugly dependencies on irq
number defines in both the boards and the architecture.

Sascha Hauer (9):
      ARM i.MX tzic: do not depend on MXC_INTERNAL_IRQS
      ARM i.MX avic: do not depend on MXC_INTERNAL_IRQS
      ARM i.MX: get rid of wrong MXC_INTERNAL_IRQ usage
      mfd wm8350: allocate irq descs dynamically
      ARM i.MX mx31ads: allocate irqs for expio dynamically
      ARM i.MX 3ds debugboard: allocate irqs dynamically
      ARM i.MX: use sparse irqs
      dma IPU: rework irq handling
      ARM i.MX3: remove now useless ipu platform data from boards

 arch/arm/Kconfig                               |    1 +
 arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c |    6 +-
 arch/arm/mach-imx/mach-armadillo5x0.c          |    6 +-
 arch/arm/mach-imx/mach-mx27_3ds.c              |    2 +-
 arch/arm/mach-imx/mach-mx31_3ds.c              |    6 +-
 arch/arm/mach-imx/mach-mx31ads.c               |   45 ++--
 arch/arm/mach-imx/mach-mx31moboard.c           |    6 +-
 arch/arm/mach-imx/mach-mx35_3ds.c              |    2 +-
 arch/arm/mach-imx/mach-pcm037.c                |    6 +-
 arch/arm/mach-imx/mach-pcm043.c                |    6 +-
 arch/arm/mach-imx/mach-vpr200.c                |    6 +-
 arch/arm/mach-imx/mm-imx31.c                   |    2 +-
 arch/arm/mach-imx/mm-imx35.c                   |    1 +
 arch/arm/mach-imx/mx31lilly-db.c               |    6 +-
 arch/arm/mach-mx5/board-cpuimx51.c             |   12 +-
 arch/arm/mach-mx5/board-mx51_3ds.c             |    2 +-
 arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c   |    3 +-
 arch/arm/plat-mxc/3ds_debugboard.c             |   53 +++--
 arch/arm/plat-mxc/avic.c                       |   18 +-
 arch/arm/plat-mxc/gpio.c                       |    6 +-
 arch/arm/plat-mxc/include/mach/iomux-v1.h      |    3 -
 arch/arm/plat-mxc/include/mach/ipu.h           |    1 -
 arch/arm/plat-mxc/include/mach/irqs.h          |   53 +----
 arch/arm/plat-mxc/tzic.c                       |    4 +-
 drivers/dma/Kconfig                            |   10 -
 drivers/dma/ipu/ipu_idmac.c                    |   41 +---
 drivers/dma/ipu/ipu_intern.h                   |   14 +-
 drivers/dma/ipu/ipu_irq.c                      |  300 +++---------------------
 drivers/mfd/wm8350-irq.c                       |   16 +-
 29 files changed, 166 insertions(+), 471 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread
* [PATCH] mfd wm8350: allocate irq descs dynamically
@ 2011-06-02 11:45 Sascha Hauer
  2011-06-02 11:53 ` Mark Brown
  0 siblings, 1 reply; 39+ messages in thread
From: Sascha Hauer @ 2011-06-02 11:45 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Mark Brown, linux-kernel


This allows boards to leave the irq_base field unitialized and
prevents them having to reserve irqs in the platform.
pdata can be optional for irq support now. Without pdata the
driver allocates some free irq range. With pdata and irq_base > 0
the driver allocates exactly the specified irq.
Without pdata the irq defaults to IRQF_TRIGGER_LOW.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mfd/wm8350-irq.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c
index ed4b22a..8a1fafd 100644
--- a/drivers/mfd/wm8350-irq.c
+++ b/drivers/mfd/wm8350-irq.c
@@ -473,17 +473,13 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
 {
 	int ret, cur_irq, i;
 	int flags = IRQF_ONESHOT;
+	int irq_base = -1;
 
 	if (!irq) {
 		dev_warn(wm8350->dev, "No interrupt support, no core IRQ\n");
 		return 0;
 	}
 
-	if (!pdata || !pdata->irq_base) {
-		dev_warn(wm8350->dev, "No interrupt support, no IRQ base\n");
-		return 0;
-	}
-
 	/* Mask top level interrupts */
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF);
 
@@ -502,7 +498,17 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
 	wm8350->chip_irq = irq;
 	wm8350->irq_base = pdata->irq_base;
 
-	if (pdata->irq_high) {
+	if (pdata && pdata->irq_base > 0)
+		irq_base = pdata->irq_base;
+
+	wm8350->irq_base = irq_alloc_descs(irq_base, 0, ARRAY_SIZE(wm8350_irqs), 0);
+	if (wm8350->irq_base < 0) {
+		dev_warn(wm8350->dev, "Allocating irqs failed with %d\n",
+			wm8350->irq_base);
+		return 0;
+	}
+
+	if (pdata && pdata->irq_high) {
 		flags |= IRQF_TRIGGER_HIGH;
 
 		wm8350_set_bits(wm8350, WM8350_SYSTEM_CONTROL_1,
-- 
1.7.5.3

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH] mfd wm8350: allocate irq descs dynamically
@ 2011-05-19 18:56 Sascha Hauer
  2011-05-19 21:04 ` Mark Brown
  2011-05-19 22:04 ` Mark Brown
  0 siblings, 2 replies; 39+ messages in thread
From: Sascha Hauer @ 2011-05-19 18:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner, Samuel Ortiz, Mark Brown


This allows boards to leave the irq_base field unitialized and
prevents them having to reserve irqs in the platform.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mfd/wm8350-irq.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

As this seems to be the first user of irq_alloc_descs outside the core I
added Thomas to cc to check if this is the correct usage of this
function.
Unfortunately I have no hardware to test this. I created this patch
since one of the wm8350 users is the mx31ads board which prevents me
from getting rid of the irq ifdeffery in i.MX land, so it would be nice
if someone could give it a test run.

diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c
index ed4b22a..04408a5 100644
--- a/drivers/mfd/wm8350-irq.c
+++ b/drivers/mfd/wm8350-irq.c
@@ -479,8 +479,8 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
 		return 0;
 	}
 
-	if (!pdata || !pdata->irq_base) {
-		dev_warn(wm8350->dev, "No interrupt support, no IRQ base\n");
+	if (!pdata) {
+		dev_warn(wm8350->dev, "No interrupt support, no platform data\n");
 		return 0;
 	}
 
@@ -500,7 +500,17 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
 
 	mutex_init(&wm8350->irq_lock);
 	wm8350->chip_irq = irq;
-	wm8350->irq_base = pdata->irq_base;
+
+	if (!pdata->irq_base) {
+		wm8350->irq_base = irq_alloc_descs(-1, 0, ARRAY_SIZE(wm8350_irqs), 0);
+		if (wm8350->irq_base < 0) {
+			dev_warn(wm8350->dev, "Allocating irqs failed with %d\n",
+				wm8350->irq_base);
+			return 0;
+		}
+	} else {
+		wm8350->irq_base = pdata->irq_base;
+	}
 
 	if (pdata->irq_high) {
 		flags |= IRQF_TRIGGER_HIGH;
-- 
1.7.4.1

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

end of thread, other threads:[~2011-06-02 15:47 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20  7:59 i.MX: switch to sparse irqs Sascha Hauer
2011-05-20  7:59 ` [PATCH 1/9] ARM i.MX tzic: do not depend on MXC_INTERNAL_IRQS Sascha Hauer
2011-05-20  7:59 ` [PATCH] mfd wm8350: allocate irq descs dynamically Sascha Hauer
2011-05-20 12:52   ` Thomas Gleixner
2011-05-20 13:07     ` Sascha Hauer
2011-05-20 13:19       ` Thomas Gleixner
2011-05-21 11:29         ` Mark Brown
2011-05-23  6:25           ` Sascha Hauer
2011-05-23 10:44             ` Mark Brown
2011-05-23 14:41               ` Sascha Hauer
2011-05-23 15:22                 ` Mark Brown
2011-05-23 16:46                   ` Sascha Hauer
2011-05-23 22:41                     ` Mark Brown
2011-05-24  7:28                       ` Sascha Hauer
2011-05-24  9:46                         ` Mark Brown
2011-05-24 11:52                           ` Sascha Hauer
2011-05-24 15:35                             ` Mark Brown
2011-05-25  8:13                               ` Sascha Hauer
2011-05-25  9:23                                 ` Mark Brown
2011-05-25 19:10                                   ` Sascha Hauer
2011-05-20  7:59 ` [PATCH 2/9] ARM i.MX avic: do not depend on MXC_INTERNAL_IRQS Sascha Hauer
2011-05-20  7:59 ` [PATCH 3/9] ARM i.MX: get rid of wrong MXC_INTERNAL_IRQ usage Sascha Hauer
2011-05-20  7:59 ` [PATCH 4/9] mfd wm8350: allocate irq descs dynamically Sascha Hauer
2011-05-20  7:59 ` [PATCH 5/9] ARM i.MX mx31ads: allocate irqs for expio dynamically Sascha Hauer
2011-05-20  7:59 ` [PATCH 6/9] ARM i.MX 3ds debugboard: allocate irqs dynamically Sascha Hauer
2011-05-20  7:59 ` [PATCH 7/9] ARM i.MX: use sparse irqs Sascha Hauer
2011-05-20  7:59 ` [PATCH 8/9] dma IPU: rework irq handling Sascha Hauer
2011-05-20 13:16   ` Thomas Gleixner
2011-05-20 13:30     ` Sascha Hauer
2011-05-20 16:46       ` Thomas Gleixner
2011-05-20 22:11         ` Benjamin Herrenschmidt
2011-05-20  7:59 ` [PATCH 9/9] ARM i.MX3: remove now useless ipu platform data from boards Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2011-06-02 11:45 [PATCH] mfd wm8350: allocate irq descs dynamically Sascha Hauer
2011-06-02 11:53 ` Mark Brown
2011-06-02 13:37   ` Mark Brown
2011-06-02 15:47     ` Mark Brown
2011-05-19 18:56 Sascha Hauer
2011-05-19 21:04 ` Mark Brown
2011-05-19 22:04 ` Mark Brown

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.