501f8d66b31888ab8f7343410e495232f97fd04c
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 181-bcma-explicit-assigne-irq-numbers.patch
1 --- a/drivers/bcma/driver_mips.c
2 +++ b/drivers/bcma/driver_mips.c
3 @@ -148,6 +148,22 @@ static void bcma_core_mips_set_irq(struc
4                   dev->id.id, oldirq + 2, irq + 2);
5  }
6  
7 +static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
8 +                                       u16 coreid, u8 unit)
9 +{
10 +       struct bcma_device *core;
11 +
12 +       core = bcma_find_core_unit(bus, coreid, unit);
13 +       if (!core) {
14 +               bcma_warn(bus,
15 +                         "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
16 +                         coreid, unit);
17 +               return;
18 +       }
19 +
20 +       bcma_core_mips_set_irq(core, irq);
21 +}
22 +
23  static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
24  {
25         int i;
26 @@ -259,35 +275,47 @@ void bcma_core_mips_init(struct bcma_drv
27  
28         mcore->assigned_irqs = 1;
29  
30 -       /* Assign IRQs to all cores on the bus */
31 -       list_for_each_entry(core, &bus->cores, list) {
32 -               int mips_irq;
33 -               if (core->irq)
34 -                       continue;
35 -
36 -               mips_irq = bcma_core_mips_irq(core);
37 -               if (mips_irq > 4)
38 -                       core->irq = 0;
39 -               else
40 -                       core->irq = mips_irq + 2;
41 -               if (core->irq > 5)
42 -                       continue;
43 -               switch (core->id.id) {
44 -               case BCMA_CORE_PCI:
45 -               case BCMA_CORE_PCIE:
46 -               case BCMA_CORE_ETHERNET:
47 -               case BCMA_CORE_ETHERNET_GBIT:
48 -               case BCMA_CORE_MAC_GBIT:
49 -               case BCMA_CORE_80211:
50 -               case BCMA_CORE_USB20_HOST:
51 -                       /* These devices get their own IRQ line if available,
52 -                        * the rest goes on IRQ0
53 -                        */
54 -                       if (mcore->assigned_irqs <= 4)
55 -                               bcma_core_mips_set_irq(core,
56 -                                                      mcore->assigned_irqs++);
57 -                       break;
58 +       switch (bus->chipinfo.id) {
59 +       case BCMA_CHIP_ID_BCM4716:
60 +       case BCMA_CHIP_ID_BCM4748:
61 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
62 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
63 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
64 +               bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_PCIE, 0);
65 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
66 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
67 +               break;
68 +       case BCMA_CHIP_ID_BCM5356:
69 +       case BCMA_CHIP_ID_BCM47162:
70 +       case BCMA_CHIP_ID_BCM53572:
71 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
72 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
73 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
74 +               break;
75 +       case BCMA_CHIP_ID_BCM5357:
76 +       case BCMA_CHIP_ID_BCM4749:
77 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
78 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
79 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
80 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
81 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
82 +               break;
83 +       case BCMA_CHIP_ID_BCM4706:
84 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_PCIE, 0);
85 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_4706_MAC_GBIT,
86 +                                           0);
87 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
88 +               bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
89 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
90 +                                           0);
91 +               break;
92 +       default:
93 +               list_for_each_entry(core, &bus->cores, list) {
94 +                       core->irq = bcma_core_irq(core);
95                 }
96 +               bcma_err(bus,
97 +                        "Unknown device (0x%x) found, can not configure IRQs\n",
98 +                        bus->chipinfo.id);
99         }
100         bcma_info(bus, "IRQ reconfiguration done\n");
101         bcma_core_mips_dump_irq(bus);