public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Linux ARM Kernel Mailing List
	<linux-arm-kernel@lists.infradead.org>,
	Felipe Balbi <balbi@ti.com>
Subject: [RFT/RFC/PATCH 05/31] arm: omap: irq: remove rest of irq_banks usage
Date: Wed, 20 Nov 2013 12:08:52 -0600	[thread overview]
Message-ID: <1384970958-4118-6-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1384970958-4118-1-git-send-email-balbi@ti.com>

now we can finally remove the pointless irq_banks
array.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/irq.c | 128 +++++++++++++++++-----------------------------
 1 file changed, 47 insertions(+), 81 deletions(-)

diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index f6d0d38..cfca775 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -49,8 +49,8 @@
 #define OMAP3_IRQ_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
 #define INTCPS_SIR_IRQ_OFFSET	0x0040	/* omap2/3 active interrupt offset */
 #define ACTIVEIRQ_MASK		0x7f	/* omap2/3 active interrupt bits */
+#define INTCPS_NR_ILR_REGS	128
 #define INTCPS_NR_MIR_REGS	3
-#define INTCPS_NR_IRQS		96
 
 /*
  * OMAP2 has a number of different interrupt controllers, each interrupt
@@ -58,15 +58,6 @@
  * fairly consistent for each bank, but not all registers are implemented
  * for each bank.. when in doubt, consult the TRM.
  */
-static struct omap_irq_bank {
-	void __iomem *base_reg;
-	unsigned int nr_irqs;
-} __attribute__ ((aligned(4))) irq_banks[] = {
-	{
-		/* MPU INTC */
-		.nr_irqs	= 96,
-	},
-};
 
 static struct irq_domain *domain;
 static void __iomem *omap_irq_base;
@@ -78,7 +69,7 @@ struct omap3_intc_regs {
 	u32 protection;
 	u32 idle;
 	u32 threshold;
-	u32 ilr[INTCPS_NR_IRQS];
+	u32 ilr[INTCPS_NR_ILR_REGS];
 	u32 mir[INTCPS_NR_MIR_REGS];
 };
 
@@ -105,13 +96,14 @@ static void omap_mask_ack_irq(struct irq_data *d)
 	omap_ack_irq(d);
 }
 
-static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
+static void __init omap_irq_soft_reset(void)
 {
 	unsigned long tmp;
 
 	tmp = intc_readl(INTC_REVISION) & 0xff;
+
 	pr_info("IRQ: Found an INTC at 0x%p (revision %ld.%ld) with %d interrupts\n",
-		bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
+		omap_irq_base, tmp >> 4, tmp & 0xf, omap_nr_irqs);
 
 	tmp = intc_readl(INTC_SYSCONFIG);
 	tmp |= 1 << 1;	/* soft reset */
@@ -126,17 +118,12 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
 
 int omap_irq_pending(void)
 {
-	int i;
+	int irq;
 
-	for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
-		struct omap_irq_bank *bank = irq_banks + i;
-		int irq;
-
-		for (irq = 0; irq < bank->nr_irqs; irq += 32)
-			if (intc_readl(INTC_PENDING_IRQ0 +
-					       ((irq >> 5) << 5)))
-				return 1;
-	}
+	for (irq = 0; irq < omap_nr_irqs; irq += 32)
+		if (intc_readl(INTC_PENDING_IRQ0 +
+					((irq >> 5) << 5)))
+			return 1;
 	return 0;
 }
 
@@ -163,9 +150,7 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
 static void __init omap_init_irq(u32 base, int nr_irqs,
 				 struct device_node *node)
 {
-	unsigned long nr_of_irqs = 0;
-	unsigned int nr_banks = 0;
-	int i, j, irq_base;
+	int j, irq_base;
 
 	omap_irq_base = ioremap(base, SZ_4K);
 	if (WARN_ON(!omap_irq_base))
@@ -180,31 +165,12 @@ static void __init omap_init_irq(u32 base, int nr_irqs,
 	}
 
 	domain = irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
-				       &irq_domain_simple_ops, NULL);
-
-	for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
-		struct omap_irq_bank *bank = irq_banks + i;
-
-		bank->nr_irqs = nr_irqs;
-
-		/* Static mapping, never released */
-		bank->base_reg = ioremap(base, SZ_4K);
-		if (!bank->base_reg) {
-			pr_err("Could not ioremap irq bank%i\n", i);
-			continue;
-		}
-
-		omap_irq_bank_init_one(bank);
+			&irq_domain_simple_ops, NULL);
 
-		for (j = 0; j < bank->nr_irqs; j += 32)
-			omap_alloc_gc(bank->base_reg + j, j + irq_base, 32);
+	omap_irq_soft_reset();
 
-		nr_of_irqs += bank->nr_irqs;
-		nr_banks++;
-	}
-
-	pr_info("Total of %ld interrupts on %d active controller%s\n",
-		nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
+	for (j = 0; j < omap_nr_irqs; j += 32)
+		omap_alloc_gc(omap_irq_base + j, j + irq_base, 32);
 }
 
 void __init omap2_init_irq(void)
@@ -295,45 +261,45 @@ void __init omap_intc_of_init(void)
 }
 
 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
-static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
+static struct omap3_intc_regs intc_context;
 
 void omap_intc_save_context(void)
 {
-	int ind = 0, i = 0;
-	for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
-		intc_context[ind].sysconfig =
-			intc_readl(INTC_SYSCONFIG);
-		intc_context[ind].protection =
-			intc_readl(INTC_PROTECTION);
-		intc_context[ind].idle =
-			intc_readl(INTC_IDLE);
-		intc_context[ind].threshold =
-			intc_readl(INTC_THRESHOLD);
-		for (i = 0; i < INTCPS_NR_IRQS; i++)
-			intc_context[ind].ilr[i] =
-				intc_readl((INTC_ILR0 + 0x4 * i));
-		for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
-			intc_context[ind].mir[i] =
-				intc_readl(INTC_MIR0 + (0x20 * i));
-	}
+	int i;
+
+	intc_context.sysconfig =
+		intc_readl(INTC_SYSCONFIG);
+	intc_context.protection =
+		intc_readl(INTC_PROTECTION);
+	intc_context.idle =
+		intc_readl(INTC_IDLE);
+	intc_context.threshold =
+		intc_readl(INTC_THRESHOLD);
+
+	for (i = 0; i < omap_nr_irqs; i++)
+		intc_context.ilr[i] =
+			intc_readl((INTC_ILR0 + 0x4 * i));
+	for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
+		intc_context.mir[i] =
+			intc_readl(INTC_MIR0 + (0x20 * i));
 }
 
 void omap_intc_restore_context(void)
 {
-	int ind = 0, i = 0;
-
-	for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
-		intc_writel(INTC_SYSCONFIG, intc_context[ind].sysconfig);
-		intc_writel(INTC_PROTECTION, intc_context[ind].protection);
-		intc_writel(INTC_IDLE, intc_context[ind].idle);
-		intc_writel(INTC_THRESHOLD, intc_context[ind].threshold);
-		for (i = 0; i < INTCPS_NR_IRQS; i++)
-			intc_writel(INTC_ILR0 + 0x4 * i,
-					intc_context[ind].ilr[i]);
-		for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
-			intc_writel(INTC_MIR0 + 0x20 * i,
-				intc_context[ind].mir[i]);
-	}
+	int i;
+
+	intc_writel(INTC_SYSCONFIG, intc_context.sysconfig);
+	intc_writel(INTC_PROTECTION, intc_context.protection);
+	intc_writel(INTC_IDLE, intc_context.idle);
+	intc_writel(INTC_THRESHOLD, intc_context.threshold);
+
+	for (i = 0; i < omap_nr_irqs; i++)
+		intc_writel(INTC_ILR0 + 0x4 * i,
+				intc_context.ilr[i]);
+
+	for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
+		intc_writel(INTC_MIR0 + 0x20 * i,
+			intc_context.mir[i]);
 	/* MIRs are saved and restore with other PRCM registers */
 }
 
-- 
1.8.4.GIT


  parent reply	other threads:[~2013-11-20 18:10 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 18:08 [RFT/RFC/PATCH 00/31] arm: omap: irq: cleanup INTC driver Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 01/31] arm: omap: irq: make omap_irq_base global Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 02/31] arm: omap: irq: define INTC_ILR0 register Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 03/31] arm: omap: irq: start to remove irq_banks array Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 04/31] arm: omap: irq: add a global omap_nr_irqs variable Felipe Balbi
2013-11-20 18:08 ` Felipe Balbi [this message]
2013-11-20 18:08 ` [RFT/RFC/PATCH 06/31] arm: omap: irq: remove unused macro Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 07/31] arm: omap: irq: switch over to intc_readl on omap_intc_handle_irq Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 08/31] arm: omap: irq: remove unnecessary base_addr argument Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 09/31] arm: omap: irq: rename omap3_intc_regs Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 10/31] arm: omap: irq: always define omap3 support Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 11/31] arm: omap: irq: reorganize code a little bit Felipe Balbi
2013-11-20 18:08 ` [RFT/RFC/PATCH 12/31] arm: omap: irq: add suspend/resume methods Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 13/31] arm: omap: irq: remove last bits of our homebrew irqchip pm Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 14/31] arm: omap: irq: make intc_of_init static Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 15/31] arm: omap: irq: call set_handle_irq() from intc_of_init Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 16/31] arm: omap: irq: use IRQCHIP_DECLARE macro Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 17/31] arm: omap: irq: drop .handle_irq and .init_irq fields Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 18/31] arm: omap: irq: add specific compatibles for omap3 and am33xx devices Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 19/31] arm: omap: irq: use compatible flag to figure out number of IRQ lines Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 20/31] arm: boot: dts: am33xx/omap3: fix intc compatible flag Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 21/31] arm: omap: irq: drop ti,intc-size support Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 22/31] arm: boot: dts: omap2/3/am33xx: drop ti,intc-size Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 23/31] arm: omap: irq: move some more code around Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 24/31] arm: omap: irq: call set_handle_irq() from .init_irq Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 25/31] arm: omap: irq: drop omap3_intc_handle_irq() Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 26/31] arm: omap: irq: drop omap2_intc_handle_irq() Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 27/31] arm: omap: irq: drop omap_pending_irq() Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 28/31] arm: omap: irq: remove unnecessary header Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 29/31] arm: omap: irq: remove nr_irqs argument Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 30/31] arm: omap: irq: introduce omap_nr_pending Felipe Balbi
2013-11-20 18:09 ` [RFT/RFC/PATCH 31/31] arm: omap: irq: get rid of ifdef hack Felipe Balbi
2013-12-19 18:48 ` [RFT/RFC/PATCH 00/31] arm: omap: irq: cleanup INTC driver Tony Lindgren
2013-12-19 23:21   ` Felipe Balbi
2013-12-21  0:53     ` Tony Lindgren
2013-12-23 17:34       ` Felipe Balbi
2014-01-02 22:01         ` Felipe Balbi
2014-01-03 12:12           ` Rajendra Nayak
2014-01-03 16:40             ` Felipe Balbi
2014-07-15  9:14               ` Tony Lindgren
2014-07-15 19:56                 ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384970958-4118-6-git-send-email-balbi@ti.com \
    --to=balbi@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox