brcm47xx: various fixes and code cleanups for irq code
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 237-bcma-bcm4716-bcm4748-i2s-irqflag.patch
1 --- a/include/linux/bcma/bcma_driver_mips.h
2 +++ b/include/linux/bcma/bcma_driver_mips.h
3 @@ -28,6 +28,7 @@
4  #define BCMA_MIPS_MIPS74K_GPIOEN       0x0048
5  #define BCMA_MIPS_MIPS74K_CLKCTLST     0x01E0
6  
7 +#define BCMA_MIPS_OOBSELINA74          0x004
8  #define BCMA_MIPS_OOBSELOUTA30         0x100
9  
10  struct bcma_device;
11 --- a/drivers/bcma/driver_mips.c
12 +++ b/drivers/bcma/driver_mips.c
13 @@ -273,6 +273,32 @@ void bcma_core_mips_early_init(struct bc
14         mcore->early_setup_done = true;
15  }
16  
17 +static void bcma_fix_i2s_irqflag(struct bcma_bus *bus)
18 +{
19 +       struct bcma_device *cpu, *pcie, *i2s;
20 +
21 +       /* Fixup the interrupts in 4716/4748 for i2s core (2010 Broadcom SDK)
22 +        * (IRQ flags > 7 are ignored when setting the interrupt masks)
23 +        */
24 +       if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4716 &&
25 +           bus->chipinfo.id != BCMA_CHIP_ID_BCM4748)
26 +               return;
27 +
28 +       cpu = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
29 +       pcie = bcma_find_core(bus, BCMA_CORE_PCIE);
30 +       i2s = bcma_find_core(bus, BCMA_CORE_I2S);
31 +       if ((cpu && pcie && i2s) &&
32 +           (bcma_aread32(cpu, BCMA_MIPS_OOBSELINA74) == 0x08060504 &&
33 +            bcma_aread32(pcie, BCMA_MIPS_OOBSELINA74) == 0x08060504 &&
34 +            bcma_aread32(i2s, BCMA_MIPS_OOBSELOUTA30) == 0x88)) {
35 +               bcma_awrite32(cpu, BCMA_MIPS_OOBSELINA74, 0x07060504);
36 +               bcma_awrite32(pcie, BCMA_MIPS_OOBSELINA74, 0x07060504);
37 +               bcma_awrite32(i2s, BCMA_MIPS_OOBSELOUTA30, 0x87);
38 +               bcma_info(bus,
39 +                         "Moved i2s interrupt to oob line 7 instead of 8\n");
40 +       }
41 +}
42 +
43  void bcma_core_mips_init(struct bcma_drv_mips *mcore)
44  {
45         struct bcma_bus *bus;
46 @@ -286,6 +312,8 @@ void bcma_core_mips_init(struct bcma_drv
47  
48         bcma_core_mips_early_init(mcore);
49  
50 +       bcma_fix_i2s_irqflag(bus);
51 +
52         switch (bus->chipinfo.id) {
53         case BCMA_CHIP_ID_BCM4716:
54         case BCMA_CHIP_ID_BCM4748: