32e4ab89d9db11d1d5a4c8955ec0de8b3bf6d47e
[15.05/openwrt.git] / target / linux / lantiq / patches-3.14 / 0037-MIPS-lantiq-move-eiu-init-after-irq_domain-register.patch
1 From baea71233ed1796651cab6ead484a18666a765aa Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 11 Sep 2014 19:25:25 +0200
4 Subject: [PATCH] MIPS: lantiq: move eiu init after irq_domain register
5
6 Signed-off-by: John Crispin <blogic@openwrt.org>
7 ---
8  arch/mips/lantiq/irq.c |   48 ++++++++++++++++++++++++------------------------
9  1 file changed, 24 insertions(+), 24 deletions(-)
10
11 --- a/arch/mips/lantiq/irq.c
12 +++ b/arch/mips/lantiq/irq.c
13 @@ -380,30 +380,6 @@ int __init icu_of_init(struct device_nod
14                         panic("Failed to remap icu memory");
15         }
16  
17 -       /* the external interrupts are optional and xway only */
18 -       eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
19 -       if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
20 -               /* find out how many external irq sources we have */
21 -               exin_avail = of_irq_count(eiu_node);
22 -
23 -               if (exin_avail > MAX_EIU)
24 -                       exin_avail = MAX_EIU;
25 -
26 -               ret = of_irq_to_resource_table(eiu_node,
27 -                                               ltq_eiu_irq, exin_avail);
28 -               if (ret != exin_avail)
29 -                       panic("failed to load external irq resources");
30 -
31 -               if (request_mem_region(res.start, resource_size(&res),
32 -                                                       res.name) < 0)
33 -                       pr_err("Failed to request eiu memory");
34 -
35 -               ltq_eiu_membase = ioremap_nocache(res.start,
36 -                                                       resource_size(&res));
37 -               if (!ltq_eiu_membase)
38 -                       panic("Failed to remap eiu memory");
39 -       }
40 -
41         /* turn off all irqs by default */
42         for (i = 0; i < MAX_IM; i++) {
43                 /* make sure all irqs are turned off by default */
44 @@ -460,6 +436,30 @@ int __init icu_of_init(struct device_nod
45         if (MIPS_CPU_TIMER_IRQ != 7)
46                 irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ);
47  
48 +       /* the external interrupts are optional and xway only */
49 +       eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
50 +       if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
51 +               /* find out how many external irq sources we have */
52 +               exin_avail = of_irq_count(eiu_node);
53 +
54 +               if (exin_avail > MAX_EIU)
55 +                       exin_avail = MAX_EIU;
56 +
57 +               ret = of_irq_to_resource_table(eiu_node,
58 +                                               ltq_eiu_irq, exin_avail);
59 +               if (ret != exin_avail)
60 +                       panic("failed to load external irq resources");
61 +
62 +               if (request_mem_region(res.start, resource_size(&res),
63 +                                                       res.name) < 0)
64 +                       pr_err("Failed to request eiu memory");
65 +
66 +               ltq_eiu_membase = ioremap_nocache(res.start,
67 +                                                       resource_size(&res));
68 +               if (!ltq_eiu_membase)
69 +                       panic("Failed to remap eiu memory");
70 +       }
71 +
72         return 0;
73  }
74