brcm47xx: improve IRQ handling for bcma based devices
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 183-bcma-mips-show-also-disabled-irqs.patch
1 --- a/drivers/bcma/driver_mips.c
2 +++ b/drivers/bcma/driver_mips.c
3 @@ -75,11 +75,16 @@ static u32 bcma_core_mips_irqflag(struct
4                 return dev->core_index;
5         flag = bcma_aread32(dev, BCMA_MIPS_OOBSELOUTA30);
6  
7 -       return flag & 0x1F;
8 +       if (flag)
9 +               return flag & 0x1F;
10 +       else
11 +               return 0x3f;
12  }
13  
14  /* Get the MIPS IRQ assignment for a specified device.
15   * If unassigned, 0 is returned.
16 + * If disabled, 5 is returned.
17 + * If not supported, 6 is returned.
18   */
19  unsigned int bcma_core_mips_irq(struct bcma_device *dev)
20  {
21 @@ -88,13 +93,18 @@ unsigned int bcma_core_mips_irq(struct b
22         unsigned int irq;
23  
24         irqflag = bcma_core_mips_irqflag(dev);
25 +       if (irqflag == 0x3f)
26 +               return 6;
27  
28         for (irq = 1; irq <= 4; irq++)
29                 if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
30                     (1 << irqflag))
31                         return irq;
32  
33 -       return 0;
34 +       if ((1 << irqflag) & bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)))
35 +               return 0;
36 +
37 +       return 5;
38  }
39  EXPORT_SYMBOL(bcma_core_mips_irq);
40  
41 @@ -115,7 +125,7 @@ static void bcma_core_mips_set_irq(struc
42                 bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0),
43                             bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) &
44                             ~(1 << irqflag));
45 -       else
46 +       else if (oldirq != 5)
47                 bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);
48  
49         /* assign the new one */