public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] RETU meets Sparse IRQ
@ 2011-06-29 11:46 Felipe Balbi
  2011-06-29 11:46 ` [PATCH 1/2] cbus: retu: use sparse IRQ numbering Felipe Balbi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Felipe Balbi @ 2011-06-29 11:46 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

now with Sparse IRQ numbering, we don't need
to add a bunch of defines in <plat/irqs.h>

Compile tested with omap2plus_defconfig (+cbus)
and omap1_defconfig (+cbus).

Felipe Balbi (2):
  cbus: retu: use sparse IRQ numbering
  cbus: retu: stop polluting <plat/irqs.h>

 arch/arm/mach-omap1/board-nokia770.c   |    2 --
 arch/arm/mach-omap2/board-n8x0.c       |    2 --
 arch/arm/plat-omap/include/plat/irqs.h |   10 +---------
 drivers/cbus/retu.c                    |   25 ++++++++++++++++---------
 include/linux/platform_data/cbus.h     |    2 --
 5 files changed, 17 insertions(+), 24 deletions(-)

-- 
1.7.6


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

* [PATCH 1/2] cbus: retu: use sparse IRQ numbering
  2011-06-29 11:46 [PATCH 0/2] RETU meets Sparse IRQ Felipe Balbi
@ 2011-06-29 11:46 ` Felipe Balbi
  2011-06-29 11:46 ` [PATCH 2/2] cbus: retu: stop polluting <plat/irqs.h> Felipe Balbi
  2011-06-29 21:18 ` [PATCH 0/2] RETU meets Sparse IRQ Leigh Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2011-06-29 11:46 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

there's no need to pass a bunch of IRQ
bases down to drivers, we can use
irq_alloc_descs() for that and put the
sparse IRQ numbering scheme to work for
us.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/cbus/retu.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 708b811..b58c6e5 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -441,9 +441,15 @@ static int __init retu_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, retu);
 
+	ret = irq_alloc_descs(-1, 0, MAX_RETU_IRQ_HANDLERS, 0);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to allocate IRQ descs\n");
+		goto err1;
+	}
+
 	retu->irq	= platform_get_irq(pdev, 0);
-	retu->irq_base	= pdata->irq_base;
-	retu->irq_end	= pdata->irq_end;
+	retu->irq_base	= ret;
+	retu->irq_end	= ret + MAX_RETU_IRQ_HANDLERS;
 	retu->devid	= pdata->devid;
 	retu->dev	= &pdev->dev;
 	the_retu	= retu;
@@ -467,7 +473,7 @@ static int __init retu_probe(struct platform_device *pdev)
 			  "retu", retu);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Unable to register IRQ handler\n");
-		goto err1;
+		goto err2;
 	}
 
 	irq_set_irq_wake(retu->irq, 1);
@@ -478,16 +484,19 @@ static int __init retu_probe(struct platform_device *pdev)
 	ret = retu_allocate_children(&pdev->dev, retu->irq_base);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Unable to allocate Retu children\n");
-		goto err2;
+		goto err3;
 	}
 
 	return 0;
 
-err2:
+err3:
 	pm_power_off = NULL;
-	__retu_write_reg(retu, RETU_REG_IMR, 0xffff);
 	free_irq(retu->irq, retu);
 
+err2:
+	retu_irq_exit(retu);
+	irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS);
+
 err1:
 	kfree(retu);
 	the_retu = NULL;
@@ -503,11 +512,9 @@ static int __exit retu_remove(struct platform_device *pdev)
 	pm_power_off = NULL;
 	the_retu = NULL;
 
-	/* Mask all RETU interrupts */
-	__retu_write_reg(retu, RETU_REG_IMR, 0xffff);
-
 	free_irq(retu->irq, retu);
 	retu_irq_exit(retu);
+	irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS);
 	kfree(retu);
 
 	return 0;
-- 
1.7.6


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

* [PATCH 2/2] cbus: retu: stop polluting <plat/irqs.h>
  2011-06-29 11:46 [PATCH 0/2] RETU meets Sparse IRQ Felipe Balbi
  2011-06-29 11:46 ` [PATCH 1/2] cbus: retu: use sparse IRQ numbering Felipe Balbi
@ 2011-06-29 11:46 ` Felipe Balbi
  2011-06-29 21:18 ` [PATCH 0/2] RETU meets Sparse IRQ Leigh Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2011-06-29 11:46 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

now that we're using sparse IRQs, we don't
need to polute <plat/irqs.h> anymore with
the dumb IRQ_BASE/IRQ_END definitions.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap1/board-nokia770.c   |    2 --
 arch/arm/mach-omap2/board-n8x0.c       |    2 --
 arch/arm/plat-omap/include/plat/irqs.h |   10 +---------
 include/linux/platform_data/cbus.h     |    2 --
 4 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 7990c48..5eb1a7f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -124,8 +124,6 @@ static struct resource retu_resource[] = {
 };
 
 static struct cbus_retu_platform_data nokia770_retu_data = {
-	.irq_base	= CBUS_RETU_IRQ_BASE,
-	.irq_end	= CBUS_RETU_IRQ_END,
 	.devid		= CBUS_RETU_DEVICE_ID,
 };
 
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index b3e80c9..f7548e4 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -220,8 +220,6 @@ static struct resource retu_resource[] = {
 };
 
 static struct cbus_retu_platform_data n8x0_retu_data = {
-	.irq_base	= CBUS_RETU_IRQ_BASE,
-	.irq_end	= CBUS_RETU_IRQ_END,
 	.devid		= CBUS_RETU_DEVICE_ID,
 };
 
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 8c8f517..24eeccd 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -419,15 +419,7 @@
 #define OMAP_GPMC_NR_IRQS	8
 #define OMAP_GPMC_IRQ_END	(OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS)
 
-#define CBUS_RETU_IRQ_BASE	OMAP_GPMC_IRQ_END
-#ifdef CONFIG_CBUS_RETU
-#define CBUS_RETU_NR_IRQS	16
-#else
-#define CBUS_RETU_NR_IRQS	0
-#endif
-#define CBUS_RETU_IRQ_END	(CBUS_RETU_IRQ_BASE + CBUS_RETU_NR_IRQS)
-
-#define NR_IRQS			CBUS_RETU_IRQ_END
+#define NR_IRQS			OMAP_GPMC_IRQ_END
 
 #define OMAP_IRQ_BIT(irq)	(1 << ((irq) % 32))
 
diff --git a/include/linux/platform_data/cbus.h b/include/linux/platform_data/cbus.h
index a1c5a26..09809c7 100644
--- a/include/linux/platform_data/cbus.h
+++ b/include/linux/platform_data/cbus.h
@@ -32,8 +32,6 @@ struct cbus_host_platform_data {
 };
 
 struct cbus_retu_platform_data {
-	int	irq_base;
-	int	irq_end;
 	int	devid;
 };
 
-- 
1.7.6


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

* Re: [PATCH 0/2] RETU meets Sparse IRQ
  2011-06-29 11:46 [PATCH 0/2] RETU meets Sparse IRQ Felipe Balbi
  2011-06-29 11:46 ` [PATCH 1/2] cbus: retu: use sparse IRQ numbering Felipe Balbi
  2011-06-29 11:46 ` [PATCH 2/2] cbus: retu: stop polluting <plat/irqs.h> Felipe Balbi
@ 2011-06-29 21:18 ` Leigh Brown
  2011-07-01  7:55   ` Tony Lindgren
  2 siblings, 1 reply; 5+ messages in thread
From: Leigh Brown @ 2011-06-29 21:18 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Tony Lindgren, Linux OMAP Mailing List

On Wed, 29 Jun 2011 14:46:49 +0300, Felipe Balbi wrote:
> now with Sparse IRQ numbering, we don't need
> to add a bunch of defines in <plat/irqs.h>
>
> Compile tested with omap2plus_defconfig (+cbus)
> and omap1_defconfig (+cbus).
>
> Felipe Balbi (2):
>   cbus: retu: use sparse IRQ numbering
>   cbus: retu: stop polluting <plat/irqs.h>
>
>  arch/arm/mach-omap1/board-nokia770.c   |    2 --
>  arch/arm/mach-omap2/board-n8x0.c       |    2 --
>  arch/arm/plat-omap/include/plat/irqs.h |   10 +---------
>  drivers/cbus/retu.c                    |   25 
> ++++++++++++++++---------
>  include/linux/platform_data/cbus.h     |    2 --
>  5 files changed, 17 insertions(+), 24 deletions(-)

Tested-by: Leigh Brown <leigh@solinno.co.uk>

Booted fine on my N810.

Regards,

Leigh.


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

* Re: [PATCH 0/2] RETU meets Sparse IRQ
  2011-06-29 21:18 ` [PATCH 0/2] RETU meets Sparse IRQ Leigh Brown
@ 2011-07-01  7:55   ` Tony Lindgren
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2011-07-01  7:55 UTC (permalink / raw)
  To: Leigh Brown; +Cc: Felipe Balbi, Linux OMAP Mailing List

* Leigh Brown <leigh@solinno.co.uk> [110629 14:14]:
> On Wed, 29 Jun 2011 14:46:49 +0300, Felipe Balbi wrote:
> >now with Sparse IRQ numbering, we don't need
> >to add a bunch of defines in <plat/irqs.h>
> >
> >Compile tested with omap2plus_defconfig (+cbus)
> >and omap1_defconfig (+cbus).
> >
> >Felipe Balbi (2):
> >  cbus: retu: use sparse IRQ numbering
> >  cbus: retu: stop polluting <plat/irqs.h>
> >
> > arch/arm/mach-omap1/board-nokia770.c   |    2 --
> > arch/arm/mach-omap2/board-n8x0.c       |    2 --
> > arch/arm/plat-omap/include/plat/irqs.h |   10 +---------
> > drivers/cbus/retu.c                    |   25
> >++++++++++++++++---------
> > include/linux/platform_data/cbus.h     |    2 --
> > 5 files changed, 17 insertions(+), 24 deletions(-)
> 
> Tested-by: Leigh Brown <leigh@solinno.co.uk>
> 
> Booted fine on my N810.

Thanks for testing, applying both into cbus branch.

Tony

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

end of thread, other threads:[~2011-07-01  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 11:46 [PATCH 0/2] RETU meets Sparse IRQ Felipe Balbi
2011-06-29 11:46 ` [PATCH 1/2] cbus: retu: use sparse IRQ numbering Felipe Balbi
2011-06-29 11:46 ` [PATCH 2/2] cbus: retu: stop polluting <plat/irqs.h> Felipe Balbi
2011-06-29 21:18 ` [PATCH 0/2] RETU meets Sparse IRQ Leigh Brown
2011-07-01  7:55   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox