diff mbox series

[4/9] ARM: imx27: Retrieve AVIC base address from devicetree

Message ID 20200911124034.6792-5-festevam@gmail.com
State New
Headers show
Series ARM: imx: Remove more board related code | expand

Commit Message

Fabio Estevam Sept. 11, 2020, 12:40 p.m. UTC
Now that imx27 has been converted to a devicetree-only platform,
retrieve the AVIC base address from devicetree.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 arch/arm/mach-imx/mach-imx27.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Arnd Bergmann Sept. 11, 2020, 2:29 p.m. UTC | #1
On Fri, Sep 11, 2020 at 2:41 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Now that imx27 has been converted to a devicetree-only platform,
> retrieve the AVIC base address from devicetree.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

>  static void __init mx27_init_irq(void)
>  {
> -       mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
> +       void __iomem *avic_base;
> +       struct device_node *np;
> +
> +       np = of_find_compatible_node(NULL, NULL, "fsl,avic");
> +       avic_base = of_iomap(np, 0);
> +       BUG_ON(!avic_base);
> +       mxc_init_irq(avic_base);
>  }
>

I see this function is identical to mx25_init_irq(). Maybe just move the code
into mxc_init_irq() directly and pass NULL from mx27_init_irq()?

Are you able to completely eliminate MX27_IO_ADDRESS()? If not,
I probably wouldn't bother, but if you can, that sounds like a useful
cleanup.

      Arnd
Fabio Estevam Sept. 11, 2020, 3:38 p.m. UTC | #2
Hi Arnd,

On Fri, Sep 11, 2020 at 11:29 AM Arnd Bergmann <arnd@arndb.de> wrote:

> I see this function is identical to mx25_init_irq(). Maybe just move the code
> into mxc_init_irq() directly and pass NULL from mx27_init_irq()?

Yes, good idea. I will do as suggested on a follow-up series.

> Are you able to completely eliminate MX27_IO_ADDRESS()? If not,
> I probably wouldn't bother, but if you can, that sounds like a useful
> cleanup.

Yes, I plan to eliminate MX27_IO_ADDRESS(), MX31_IO_ADDRESS() and
MX35_IO_ADDRESS().

Will handle this in a follow-up series as well after this one lands in
linux-next.

Thanks,

Fabio Estevam
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/mach-imx27.c b/arch/arm/mach-imx/mach-imx27.c
index 2d981d1eafbf..84396ccf23f2 100644
--- a/arch/arm/mach-imx/mach-imx27.c
+++ b/arch/arm/mach-imx/mach-imx27.c
@@ -5,6 +5,7 @@ 
 
 #include <linux/init.h>
 #include <linux/irq.h>
+#include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/mm.h>
@@ -58,7 +59,13 @@  static void __init imx27_init_early(void)
 
 static void __init mx27_init_irq(void)
 {
-	mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
+	void __iomem *avic_base;
+	struct device_node *np;
+
+	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 imx27_dt_board_compat[] __initconst = {