f664deb307c96839877495907ed602f3e61bfd0f
[lede.git] / target / linux / lantiq / patches-4.4 / 0047-irq-fixes.patch
1 --- a/arch/mips/lantiq/irq.c
2 +++ b/arch/mips/lantiq/irq.c
3 @@ -67,7 +67,7 @@ int gic_present;
4  #endif
5  
6  static int exin_avail;
7 -static struct resource ltq_eiu_irq[MAX_EIU];
8 +static u32 ltq_eiu_irq[MAX_EIU];
9  static void __iomem *ltq_icu_membase[MAX_IM];
10  static void __iomem *ltq_eiu_membase;
11  static struct irq_domain *ltq_domain;
12 @@ -76,7 +76,7 @@ static int ltq_perfcount_irq;
13  int ltq_eiu_get_irq(int exin)
14  {
15         if (exin < exin_avail)
16 -               return ltq_eiu_irq[exin].start;
17 +               return ltq_eiu_irq[exin];
18         return -1;
19  }
20  
21 @@ -128,7 +128,7 @@ static int ltq_eiu_settype(struct irq_da
22         int i;
23  
24         for (i = 0; i < MAX_EIU; i++) {
25 -               if (d->hwirq == ltq_eiu_irq[i].start) {
26 +               if (d->hwirq == ltq_eiu_irq[i]) {
27                         int val = 0;
28                         int edge = 0;
29  
30 @@ -176,7 +176,7 @@ static unsigned int ltq_startup_eiu_irq(
31  
32         ltq_enable_irq(d);
33         for (i = 0; i < MAX_EIU; i++) {
34 -               if (d->hwirq == ltq_eiu_irq[i].start) {
35 +               if (d->hwirq == ltq_eiu_irq[i]) {
36                         /* by default we are low level triggered */
37                         ltq_eiu_settype(d, IRQF_TRIGGER_LOW);
38                         /* clear all pending */
39 @@ -198,7 +198,7 @@ static void ltq_shutdown_eiu_irq(struct
40  
41         ltq_disable_irq(d);
42         for (i = 0; i < MAX_EIU; i++) {
43 -               if (d->hwirq == ltq_eiu_irq[i].start) {
44 +               if (d->hwirq == ltq_eiu_irq[i]) {
45                         /* disable */
46                         ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
47                                 LTQ_EIU_EXIN_INEN);
48 @@ -344,10 +344,10 @@ static int icu_map(struct irq_domain *d,
49                 return 0;
50  
51         for (i = 0; i < exin_avail; i++)
52 -               if (hw == ltq_eiu_irq[i].start)
53 +               if (hw == ltq_eiu_irq[i])
54                         chip = &ltq_eiu_type;
55  
56 -       irq_set_chip_and_handler(hw, chip, handle_level_irq);
57 +       irq_set_chip_and_handler(irq, chip, handle_level_irq);
58  
59         return 0;
60  }
61 @@ -437,14 +437,14 @@ int __init icu_of_init(struct device_nod
62         eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
63         if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
64                 /* find out how many external irq sources we have */
65 -               exin_avail = of_irq_count(eiu_node);
66 +               exin_avail = of_property_count_u32_elems(eiu_node, "lantiq,eiu-irqs");
67  
68                 if (exin_avail > MAX_EIU)
69                         exin_avail = MAX_EIU;
70  
71 -               ret = of_irq_to_resource_table(eiu_node,
72 +               ret = of_property_read_u32_array(eiu_node, "lantiq,eiu-irqs",
73                                                 ltq_eiu_irq, exin_avail);
74 -               if (ret != exin_avail)
75 +               if (ret)
76                         panic("failed to load external irq resources");
77  
78                 if (!request_mem_region(res.start, resource_size(&res),