Re: [PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-03-03 Thread Shawn Guo
On Thu, Feb 04, 2021 at 05:38:46PM -0800, Saravana Kannan wrote:
> Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
> these interrupt controllers to be populated as struct devices. Without
> this change, fw_devlink=on will make the consumers of these interrupt
> controllers wait for the struct device to be added and thereby block the
> consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
> issues on imx25 with fw_devlink=on that were reported by Martin.
> 
> This also removes a lot of boilerplate code.
> 
> Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> Reported-by: Martin Kaiser 
> Signed-off-by: Saravana Kannan 
> Tested-by: Martin Kaiser 

Applied, thanks.


Re: [PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-02-26 Thread Saravana Kannan
On Mon, Feb 22, 2021 at 6:33 PM Saravana Kannan  wrote:
>
> On Thu, Feb 4, 2021 at 6:07 PM Saravana Kannan  wrote:
> >
> > On Thu, Feb 4, 2021 at 5:54 PM Fabio Estevam  wrote:
> > >
> > > Hi Saravana,
> > >
> > > On Thu, Feb 4, 2021 at 10:39 PM Saravana Kannan  
> > > wrote:
> > > >
> > > > Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
> > > > these interrupt controllers to be populated as struct devices. Without
> > > > this change, fw_devlink=on will make the consumers of these interrupt
> > > > controllers wait for the struct device to be added and thereby block the
> > > > consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
> > > > issues on imx25 with fw_devlink=on that were reported by Martin.
> > > >
> > > > This also removes a lot of boilerplate code.
> > > >
> > > > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> > > > Reported-by: Martin Kaiser 
> > > > Signed-off-by: Saravana Kannan 
> > > > Tested-by: Martin Kaiser 
> > >
> > > Thanks for the respin:
> > >
> > > Reviewed-by: Fabio Estevam 
> >
> > Thanks for the quick review.
> >
>
> Maintainers,
>
> Is this getting picked up for 5.12?
>

Gentle reminder.

-Saravana


Re: [PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-02-22 Thread Saravana Kannan
On Thu, Feb 4, 2021 at 6:07 PM Saravana Kannan  wrote:
>
> On Thu, Feb 4, 2021 at 5:54 PM Fabio Estevam  wrote:
> >
> > Hi Saravana,
> >
> > On Thu, Feb 4, 2021 at 10:39 PM Saravana Kannan  
> > wrote:
> > >
> > > Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
> > > these interrupt controllers to be populated as struct devices. Without
> > > this change, fw_devlink=on will make the consumers of these interrupt
> > > controllers wait for the struct device to be added and thereby block the
> > > consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
> > > issues on imx25 with fw_devlink=on that were reported by Martin.
> > >
> > > This also removes a lot of boilerplate code.
> > >
> > > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> > > Reported-by: Martin Kaiser 
> > > Signed-off-by: Saravana Kannan 
> > > Tested-by: Martin Kaiser 
> >
> > Thanks for the respin:
> >
> > Reviewed-by: Fabio Estevam 
>
> Thanks for the quick review.
>

Maintainers,

Is this getting picked up for 5.12?

-Saravana


Re: [PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-02-04 Thread Saravana Kannan
On Thu, Feb 4, 2021 at 5:54 PM Fabio Estevam  wrote:
>
> Hi Saravana,
>
> On Thu, Feb 4, 2021 at 10:39 PM Saravana Kannan  wrote:
> >
> > Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
> > these interrupt controllers to be populated as struct devices. Without
> > this change, fw_devlink=on will make the consumers of these interrupt
> > controllers wait for the struct device to be added and thereby block the
> > consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
> > issues on imx25 with fw_devlink=on that were reported by Martin.
> >
> > This also removes a lot of boilerplate code.
> >
> > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> > Reported-by: Martin Kaiser 
> > Signed-off-by: Saravana Kannan 
> > Tested-by: Martin Kaiser 
>
> Thanks for the respin:
>
> Reviewed-by: Fabio Estevam 

Thanks for the quick review.

-Saravana


Re: [PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-02-04 Thread Fabio Estevam
Hi Saravana,

On Thu, Feb 4, 2021 at 10:39 PM Saravana Kannan  wrote:
>
> Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
> these interrupt controllers to be populated as struct devices. Without
> this change, fw_devlink=on will make the consumers of these interrupt
> controllers wait for the struct device to be added and thereby block the
> consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
> issues on imx25 with fw_devlink=on that were reported by Martin.
>
> This also removes a lot of boilerplate code.
>
> Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> Reported-by: Martin Kaiser 
> Signed-off-by: Saravana Kannan 
> Tested-by: Martin Kaiser 

Thanks for the respin:

Reviewed-by: Fabio Estevam 


[PATCH v3] ARM: imx: avic: Convert to using IRQCHIP_DECLARE

2021-02-04 Thread Saravana Kannan
Using IRQCHIP_DECLARE lets fw_devlink know that it should not wait for
these interrupt controllers to be populated as struct devices. Without
this change, fw_devlink=on will make the consumers of these interrupt
controllers wait for the struct device to be added and thereby block the
consumers' probes forever. Converting to IRQCHIP_DECLARE addresses boot
issues on imx25 with fw_devlink=on that were reported by Martin.

This also removes a lot of boilerplate code.

Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
Reported-by: Martin Kaiser 
Signed-off-by: Saravana Kannan 
Tested-by: Martin Kaiser 
---

v1 -> v2:
- Fixed compatible string
- Added Tested-by

v2 -> v3:
- Improved commit text

 arch/arm/mach-imx/avic.c   | 16 +++-
 arch/arm/mach-imx/common.h |  1 -
 arch/arm/mach-imx/mach-imx1.c  | 11 ---
 arch/arm/mach-imx/mach-imx25.c | 12 
 arch/arm/mach-imx/mach-imx27.c | 12 
 arch/arm/mach-imx/mach-imx31.c |  1 -
 arch/arm/mach-imx/mach-imx35.c |  1 -
 arch/arm/mach-imx/mm-imx3.c| 24 
 8 files changed, 15 insertions(+), 63 deletions(-)

diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index 322caa21bcb3..21bce4049cec 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -162,7 +163,7 @@ 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 mxc_init_irq(void __iomem *irqbase)
 {
struct device_node *np;
int irq_base;
@@ -220,3 +221,16 @@ void __init mxc_init_irq(void __iomem *irqbase)
 
printk(KERN_INFO "MXC IRQ initialized\n");
 }
+
+static int __init imx_avic_init(struct device_node *node,
+  struct device_node *parent)
+{
+   void __iomem *avic_base;
+
+   avic_base = of_iomap(node, 0);
+   BUG_ON(!avic_base);
+   mxc_init_irq(avic_base);
+   return 0;
+}
+
+IRQCHIP_DECLARE(imx_avic, "fsl,avic", imx_avic_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 2d76e2c6c99e..e988b0978a42 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -22,7 +22,6 @@ void mx35_map_io(void);
 void imx21_init_early(void);
 void imx31_init_early(void);
 void imx35_init_early(void);
-void mxc_init_irq(void __iomem *);
 void mx31_init_irq(void);
 void mx35_init_irq(void);
 void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/mach-imx1.c b/arch/arm/mach-imx/mach-imx1.c
index 32df3b8012f9..8eca92d66a2e 100644
--- a/arch/arm/mach-imx/mach-imx1.c
+++ b/arch/arm/mach-imx/mach-imx1.c
@@ -17,16 +17,6 @@ static void __init imx1_init_early(void)
mxc_set_cpu_type(MXC_CPU_MX1);
 }
 
-static void __init imx1_init_irq(void)
-{
-   void __iomem *avic_addr;
-
-   avic_addr = ioremap(MX1_AVIC_ADDR, SZ_4K);
-   WARN_ON(!avic_addr);
-
-   mxc_init_irq(avic_addr);
-}
-
 static const char * const imx1_dt_board_compat[] __initconst = {
"fsl,imx1",
NULL
@@ -34,7 +24,6 @@ static const char * const imx1_dt_board_compat[] __initconst 
= {
 
 DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)")
.init_early = imx1_init_early,
-   .init_irq   = imx1_init_irq,
.dt_compat  = imx1_dt_board_compat,
.restart= mxc_restart,
 MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx25.c b/arch/arm/mach-imx/mach-imx25.c
index 95de48a1aa7d..51927bd08aef 100644
--- a/arch/arm/mach-imx/mach-imx25.c
+++ b/arch/arm/mach-imx/mach-imx25.c
@@ -22,17 +22,6 @@ static void __init imx25_dt_init(void)
imx_aips_allow_unprivileged_access("fsl,imx25-aips");
 }
 
-static void __init mx25_init_irq(void)
-{
-   struct device_node *np;
-   void __iomem *avic_base;
-
-   np = of_find_compatible_node(NULL, NULL, "fsl,avic");
-   avic_base = of_iomap(np, 0);
-   BUG_ON(!avic_base);
-   mxc_init_irq(avic_base);
-}
-
 static const char * const imx25_dt_board_compat[] __initconst = {
"fsl,imx25",
NULL
@@ -42,6 +31,5 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree 
Support)")
.init_early = imx25_init_early,
.init_machine   = imx25_dt_init,
.init_late  = imx25_pm_init,
-   .init_irq   = mx25_init_irq,
.dt_compat  = imx25_dt_board_compat,
 MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx27.c b/arch/arm/mach-imx/mach-imx27.c
index 262422a9c196..e325c9468105 100644
--- a/arch/arm/mach-imx/mach-imx27.c
+++ b/arch/arm/mach-imx/mach-imx27.c
@@ -56,17 +56,6 @@ static void __init imx27_init_early(void)
mxc_set_cpu_type(MXC_CPU_MX27);
 }
 
-static void __init mx27_init_irq(void)
-{
-   void __iomem *avic_base;
-