linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shc_work@mail.ru (Alexander Shiyan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: i.MX: avic: Use irqchip_init() for IRQ initialization in DT case
Date: Sat, 31 May 2014 10:01:30 +0400	[thread overview]
Message-ID: <1401516095-31020-1-git-send-email-shc_work@mail.ru> (raw)

Use generic irqchip_init() DT call to initialize IRQs, so after this patch,
the mxc-avic driver is quite prepared to move to drivers/irqchip.
As a temporary solution to do it, we use OF_DECLARE_2()
instead of IRQCHIP_DECLARE().

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/avic.c     | 29 ++++++++++++++++++++++-------
 arch/arm/mach-imx/imx25-dt.c |  1 -
 arch/arm/mach-imx/imx27-dt.c |  1 -
 arch/arm/mach-imx/imx31-dt.c |  1 -
 arch/arm/mach-imx/imx35-dt.c |  3 ++-
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index 24b103c..9adcad2 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -22,6 +22,7 @@
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <asm/mach/irq.h>
 #include <asm/exception.h>
 
@@ -153,13 +154,10 @@ static void __exception_irq_entry avic_handle_irq(struct pt_regs *regs)
  * interrupts. It registers the interrupt enable and disable functions
  * to the kernel for each interrupt source.
  */
-void __init mxc_init_irq(void __iomem *irqbase)
+static void __init _avic_init_irq(struct device_node *np)
 {
-	struct device_node *np;
 	int irq_base;
-	int i;
-
-	avic_base = irqbase;
+	unsigned i;
 
 	/* put the AVIC into the reset value with
 	 * all interrupts disabled
@@ -178,7 +176,6 @@ void __init mxc_init_irq(void __iomem *irqbase)
 	irq_base = irq_alloc_descs(-1, 0, AVIC_NUM_IRQS, numa_node_id());
 	WARN_ON(irq_base < 0);
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,avic");
 	domain = irq_domain_add_legacy(np, AVIC_NUM_IRQS, irq_base, 0,
 				       &irq_domain_simple_ops, NULL);
 	WARN_ON(!domain);
@@ -196,6 +193,24 @@ void __init mxc_init_irq(void __iomem *irqbase)
 	/* Initialize FIQ */
 	init_FIQ(FIQ_START);
 #endif
+}
+
+void __init mxc_init_irq(void __iomem *irqbase)
+{
+	avic_base = irqbase;
+
+	_avic_init_irq(NULL);
+}
 
-	printk(KERN_INFO "MXC IRQ initialized\n");
+static int __init avic_init_irq_dt(struct device_node *np,
+				   struct device_node *parent)
+{
+	avic_base = of_iomap(np, 0);
+	if (!avic_base)
+		return -ENOMEM;
+
+	_avic_init_irq(np);
+
+	return 0;
 }
+OF_DECLARE_2(irqchip, mxc_avic, "fsl,avic", avic_init_irq_dt);
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 42a65e0..2f97743 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -37,7 +37,6 @@ static void __init imx25_timer_init(void)
 DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
 	.map_io		= mx25_map_io,
 	.init_early	= imx25_init_early,
-	.init_irq	= mx25_init_irq,
 	.init_time	= imx25_timer_init,
 	.init_machine	= imx25_dt_init,
 	.dt_compat	= imx25_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 17bd405..09c577c 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -42,7 +42,6 @@ static void __init imx27_timer_init(void)
 DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
 	.map_io		= mx27_map_io,
 	.init_early	= imx27_init_early,
-	.init_irq	= mx27_init_irq,
 	.init_time	= imx27_timer_init,
 	.init_machine	= imx27_dt_init,
 	.dt_compat	= imx27_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 581f4d6..6e7a4c2 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -38,7 +38,6 @@ static void __init imx31_dt_timer_init(void)
 DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)")
 	.map_io		= mx31_map_io,
 	.init_early	= imx31_init_early,
-	.init_irq	= mx31_init_irq,
 	.init_time	= imx31_dt_timer_init,
 	.init_machine	= imx31_dt_init,
 	.dt_compat	= imx31_dt_board_compat,
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index a62854c..6b74123 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -9,6 +9,7 @@
  */
 
 #include <linux/irq.h>
+#include <linux/irqchip.h>
 #include <linux/irqdomain.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -31,7 +32,7 @@ static void __init imx35_dt_init(void)
 static void __init imx35_irq_init(void)
 {
 	imx_init_l2cache();
-	mx35_init_irq();
+	irqchip_init();
 }
 
 static const char *imx35_dt_board_compat[] __initconst = {
-- 
1.8.5.5

             reply	other threads:[~2014-05-31  6:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-31  6:01 Alexander Shiyan [this message]
2014-05-31  6:01 ` [PATCH 1/3] ARM: i.MX: tzic: Use irqchip_init() for IRQ initialization in DT case Alexander Shiyan
2014-05-31  6:01 ` [PATCH 2/3] ARM: i.MX: avic: Remove #ifdef CONFIG_PM Alexander Shiyan
2014-05-31  6:01 ` [PATCH 2/3] ARM: i.MX: tzic: " Alexander Shiyan
2014-05-31  6:01 ` [PATCH 3/3] ARM: i.MX: avic: Cleanup driver Alexander Shiyan
2014-05-31  6:01 ` [PATCH 3/3] ARM: i.MX: tzic: " Alexander Shiyan
2014-06-02  2:21 ` [PATCH 1/3] ARM: i.MX: avic: Use irqchip_init() for IRQ initialization in DT case Shawn Guo
2014-06-02  4:24   ` Alexander Shiyan
2014-06-02  6:19     ` Shawn Guo
2014-06-02  5:09   ` Alexander Shiyan
2014-06-02  6:14     ` Shawn Guo

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=1401516095-31020-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).