aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-01-03 18:51:21 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-07 15:18:28 -0500
commite3f05a42faac627d8704c76c1927e09b22443b7b (patch)
tree2d89386107ad0b7158082d5c239764dac0e9db38 /drivers/bcma
parent929a03aeb149017e88fbe5878c2b6585cfda8704 (diff)
bcma: mips: explicit assign IRQ numbers
The assignment of the IRQs to the cores of the chips by iterating over the cores is complicated and causes problems with SoC like the BCM4706 with two GMAC core where just one should get a dedicated IRQ number. Now the code assigns the same IRQs to the cores as the code from the Broadcom SDK does. If the SoC is not know the current assigned IRQs are only read out and an error message is printed. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/driver_mips.c84
1 files changed, 56 insertions, 28 deletions
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index 792daad28cbc..171be0f541e0 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -147,6 +147,22 @@ static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
147 dev->id.id, oldirq + 2, irq + 2); 147 dev->id.id, oldirq + 2, irq + 2);
148} 148}
149 149
150static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
151 u16 coreid, u8 unit)
152{
153 struct bcma_device *core;
154
155 core = bcma_find_core_unit(bus, coreid, unit);
156 if (!core) {
157 bcma_warn(bus,
158 "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
159 coreid, unit);
160 return;
161 }
162
163 bcma_core_mips_set_irq(core, irq);
164}
165
150static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq) 166static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
151{ 167{
152 int i; 168 int i;
@@ -242,35 +258,47 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
242 258
243 mcore->assigned_irqs = 1; 259 mcore->assigned_irqs = 1;
244 260
245 /* Assign IRQs to all cores on the bus */ 261 switch (bus->chipinfo.id) {
246 list_for_each_entry(core, &bus->cores, list) { 262 case BCMA_CHIP_ID_BCM4716:
247 int mips_irq; 263 case BCMA_CHIP_ID_BCM4748:
248 if (core->irq) 264 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
249 continue; 265 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
250 266 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
251 mips_irq = bcma_core_mips_irq(core); 267 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_PCIE, 0);
252 if (mips_irq > 4) 268 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
253 core->irq = 0; 269 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
254 else 270 break;
255 core->irq = mips_irq + 2; 271 case BCMA_CHIP_ID_BCM5356:
256 if (core->irq > 5) 272 case BCMA_CHIP_ID_BCM47162:
257 continue; 273 case BCMA_CHIP_ID_BCM53572:
258 switch (core->id.id) { 274 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
259 case BCMA_CORE_PCI: 275 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
260 case BCMA_CORE_PCIE: 276 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
261 case BCMA_CORE_ETHERNET: 277 break;
262 case BCMA_CORE_ETHERNET_GBIT: 278 case BCMA_CHIP_ID_BCM5357:
263 case BCMA_CORE_MAC_GBIT: 279 case BCMA_CHIP_ID_BCM4749:
264 case BCMA_CORE_80211: 280 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
265 case BCMA_CORE_USB20_HOST: 281 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
266 /* These devices get their own IRQ line if available, 282 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
267 * the rest goes on IRQ0 283 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
268 */ 284 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
269 if (mcore->assigned_irqs <= 4) 285 break;
270 bcma_core_mips_set_irq(core, 286 case BCMA_CHIP_ID_BCM4706:
271 mcore->assigned_irqs++); 287 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_PCIE, 0);
272 break; 288 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_4706_MAC_GBIT,
289 0);
290 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
291 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
292 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
293 0);
294 break;
295 default:
296 list_for_each_entry(core, &bus->cores, list) {
297 core->irq = bcma_core_irq(core);
273 } 298 }
299 bcma_err(bus,
300 "Unknown device (0x%x) found, can not configure IRQs\n",
301 bus->chipinfo.id);
274 } 302 }
275 bcma_info(bus, "IRQ reconfiguration done\n"); 303 bcma_info(bus, "IRQ reconfiguration done\n");
276 bcma_core_mips_dump_irq(bus); 304 bcma_core_mips_dump_irq(bus);