diff mbox

[1/3] ARM: i.MX: avic: Use irqchip_init() for IRQ initialization in DT case

Message ID 1401516095-31020-1-git-send-email-shc_work@mail.ru
State New
Headers show

Commit Message

Alexander Shiyan May 31, 2014, 6:01 a.m. UTC
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(-)

Comments

Shawn Guo June 2, 2014, 2:21 a.m. UTC | #1
On Sat, May 31, 2014 at 10:01:30AM +0400, Alexander Shiyan wrote:
> 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.

What's the whole plan of the moving?  IOW, what's left after this patch
and what's the plan for those?

> As a temporary solution to do it, we use OF_DECLARE_2()

I do not see OF_DECLARE_2() is defined anywhere?

> instead of IRQCHIP_DECLARE().
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

The patch number in the subject is confusing.  There are 6 patches in
the series rather than 3.

Shawn

> ---
>  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
>
Alexander Shiyan June 2, 2014, 4:24 a.m. UTC | #2
Mon, 2 Jun 2014 10:21:21 +0800 от Shawn Guo <shawn.guo@freescale.com>:
> On Sat, May 31, 2014 at 10:01:30AM +0400, Alexander Shiyan wrote:
> > 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.
> 
> What's the whole plan of the moving?  IOW, what's left after this patch
> and what's the plan for those?

For the full movement of these drivers into drivers/irqchip, we need to find a
solution for i.MX specific functions, such as mxc_set_irq_fiq() and
tzic_enable_wake(). I haven't found a good solution yet...

> > As a temporary solution to do it, we use OF_DECLARE_2()
> 
> I do not see OF_DECLARE_2() is defined anywhere?

<include/linux/of.h>

---
Alexander Shiyan June 2, 2014, 5:09 a.m. UTC | #3
Mon, 2 Jun 2014 10:21:21 +0800 от Shawn Guo <shawn.guo@freescale.com>:
> On Sat, May 31, 2014 at 10:01:30AM +0400, Alexander Shiyan wrote:
> > 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.
...

> The patch number in the subject is confusing.  There are 6 patches in
> the series rather than 3.

This is a separate series of three patches for AVIC and similar series for TZIC.
You want me to combine them into one?

---
Shawn Guo June 2, 2014, 6:14 a.m. UTC | #4
On Mon, Jun 02, 2014 at 09:09:27AM +0400, Alexander Shiyan wrote:
> Mon, 2 Jun 2014 10:21:21 +0800 от Shawn Guo <shawn.guo@freescale.com>:
> > On Sat, May 31, 2014 at 10:01:30AM +0400, Alexander Shiyan wrote:
> > > 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.
> ...
> 
> > The patch number in the subject is confusing.  There are 6 patches in
> > the series rather than 3.
> 
> This is a separate series of three patches for AVIC and similar series for TZIC.
> You want me to combine them into one?

As all other 5 patches are in reply to the first one [1], I thought they
are just one series.

Shawn

[1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/330129
Shawn Guo June 2, 2014, 6:19 a.m. UTC | #5
On Mon, Jun 02, 2014 at 08:24:34AM +0400, Alexander Shiyan wrote:
> Mon, 2 Jun 2014 10:21:21 +0800 от Shawn Guo <shawn.guo@freescale.com>:
> > On Sat, May 31, 2014 at 10:01:30AM +0400, Alexander Shiyan wrote:
> > > 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.
> > 
> > What's the whole plan of the moving?  IOW, what's left after this patch
> > and what's the plan for those?
> 
> For the full movement of these drivers into drivers/irqchip, we need to find a
> solution for i.MX specific functions, such as mxc_set_irq_fiq() and
> tzic_enable_wake(). I haven't found a good solution yet...
> 
> > > As a temporary solution to do it, we use OF_DECLARE_2()
> > 
> > I do not see OF_DECLARE_2() is defined anywhere?
> 
> <include/linux/of.h>

The <include/linux/of.h> on my tree doesn't have it yet.  So I cannot
apply it for now anyway.

Shawn
diff mbox

Patch

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 = {