broadcom-diag: add diag support for Linksys E1000 V1
[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 @@ -247,7 +263,8 @@ void bcma_core_mips_early_init(struct bc
27  void bcma_core_mips_init(struct bcma_drv_mips *mcore)
28  {
29         struct bcma_bus *bus;
30 -       struct bcma_device *core;
31 +       int irq;
32 +
33         bus = mcore->core->bus;
34  
35         if (mcore->setup_done)
36 @@ -259,35 +276,44 @@ void bcma_core_mips_init(struct bcma_drv
37  
38         mcore->assigned_irqs = 1;
39  
40 -       /* Assign IRQs to all cores on the bus */
41 -       list_for_each_entry(core, &bus->cores, list) {
42 -               int mips_irq;
43 -               if (core->irq)
44 -                       continue;
45 -
46 -               mips_irq = bcma_core_mips_irq(core);
47 -               if (mips_irq > 4)
48 -                       core->irq = 0;
49 -               else
50 -                       core->irq = mips_irq + 2;
51 -               if (core->irq > 5)
52 -                       continue;
53 -               switch (core->id.id) {
54 -               case BCMA_CORE_PCI:
55 -               case BCMA_CORE_PCIE:
56 -               case BCMA_CORE_ETHERNET:
57 -               case BCMA_CORE_ETHERNET_GBIT:
58 -               case BCMA_CORE_MAC_GBIT:
59 -               case BCMA_CORE_80211:
60 -               case BCMA_CORE_USB20_HOST:
61 -                       /* These devices get their own IRQ line if available,
62 -                        * the rest goes on IRQ0
63 -                        */
64 -                       if (mcore->assigned_irqs <= 4)
65 -                               bcma_core_mips_set_irq(core,
66 -                                                      mcore->assigned_irqs++);
67 -                       break;
68 -               }
69 +       switch (bus->chipinfo.id) {
70 +       case BCMA_CHIP_ID_BCM4716:
71 +       case BCMA_CHIP_ID_BCM4748:
72 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
73 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
74 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
75 +               bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_PCIE, 0);
76 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
77 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
78 +               break;
79 +       case BCMA_CHIP_ID_BCM5356:
80 +       case BCMA_CHIP_ID_BCM47162:
81 +       case BCMA_CHIP_ID_BCM53572:
82 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
83 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
84 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
85 +               break;
86 +       case BCMA_CHIP_ID_BCM5357:
87 +       case BCMA_CHIP_ID_BCM4749:
88 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
89 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
90 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
91 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
92 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
93 +               break;
94 +       case BCMA_CHIP_ID_BCM4706:
95 +               bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_PCIE, 0);
96 +               bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_4706_MAC_GBIT,
97 +                                           0);
98 +               bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
99 +               bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
100 +               bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
101 +                                           0);
102 +               break;
103 +       default:
104 +               bcma_err(bus,
105 +                        "Unknown device (0x%x) found, can not configure IRQs\n",
106 +                        bus->chipinfo.id);
107         }
108         bcma_info(bus, "IRQ reconfiguration done\n");
109         bcma_core_mips_dump_irq(bus);