driver_mips.c (1a2d50329832c4b5c77be569f20eec303a0d07b8) driver_mips.c (e2aa19fadd718d7dd920a3994118863861a4b61e)
1/*
2 * Broadcom specific AMBA
3 * Broadcom MIPS32 74K core driver
4 *
5 * Copyright 2009, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
7 * Copyright 2010, Bernhard Loos <bernhardloos@googlemail.com>
8 * Copyright 2011, Hauke Mehrtens <hauke@hauke-m.de>

--- 71 unchanged lines hidden (view full) ---

80 return 0x3f;
81}
82
83/* Get the MIPS IRQ assignment for a specified device.
84 * If unassigned, 0 is returned.
85 * If disabled, 5 is returned.
86 * If not supported, 6 is returned.
87 */
1/*
2 * Broadcom specific AMBA
3 * Broadcom MIPS32 74K core driver
4 *
5 * Copyright 2009, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
7 * Copyright 2010, Bernhard Loos <bernhardloos@googlemail.com>
8 * Copyright 2011, Hauke Mehrtens <hauke@hauke-m.de>

--- 71 unchanged lines hidden (view full) ---

80 return 0x3f;
81}
82
83/* Get the MIPS IRQ assignment for a specified device.
84 * If unassigned, 0 is returned.
85 * If disabled, 5 is returned.
86 * If not supported, 6 is returned.
87 */
88unsigned int bcma_core_mips_irq(struct bcma_device *dev)
88static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
89{
90 struct bcma_device *mdev = dev->bus->drv_mips.core;
91 u32 irqflag;
92 unsigned int irq;
93
94 irqflag = bcma_core_mips_irqflag(dev);
95 if (irqflag == 0x3f)
96 return 6;
97
98 for (irq = 0; irq <= 4; irq++)
99 if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
100 (1 << irqflag))
101 return irq;
102
103 return 5;
104}
89{
90 struct bcma_device *mdev = dev->bus->drv_mips.core;
91 u32 irqflag;
92 unsigned int irq;
93
94 irqflag = bcma_core_mips_irqflag(dev);
95 if (irqflag == 0x3f)
96 return 6;
97
98 for (irq = 0; irq <= 4; irq++)
99 if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
100 (1 << irqflag))
101 return irq;
102
103 return 5;
104}
105EXPORT_SYMBOL(bcma_core_mips_irq);
106
105
106unsigned int bcma_core_irq(struct bcma_device *dev)
107{
108 unsigned int mips_irq = bcma_core_mips_irq(dev);
109 return mips_irq <= 4 ? mips_irq + 2 : 0;
110}
111EXPORT_SYMBOL(bcma_core_irq);
112
107static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
108{
109 unsigned int oldirq = bcma_core_mips_irq(dev);
110 struct bcma_bus *bus = dev->bus;
111 struct bcma_device *mdev = bus->drv_mips.core;
112 u32 irqflag;
113
114 irqflag = bcma_core_mips_irqflag(dev);

--- 179 unchanged lines hidden (view full) ---

294 0);
295 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
296 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
297 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
298 0);
299 break;
300 default:
301 list_for_each_entry(core, &bus->cores, list) {
113static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
114{
115 unsigned int oldirq = bcma_core_mips_irq(dev);
116 struct bcma_bus *bus = dev->bus;
117 struct bcma_device *mdev = bus->drv_mips.core;
118 u32 irqflag;
119
120 irqflag = bcma_core_mips_irqflag(dev);

--- 179 unchanged lines hidden (view full) ---

300 0);
301 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
302 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
303 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
304 0);
305 break;
306 default:
307 list_for_each_entry(core, &bus->cores, list) {
302 core->irq = bcma_core_mips_irq(core) + 2;
308 core->irq = bcma_core_irq(core);
303 }
304 bcma_err(bus,
305 "Unknown device (0x%x) found, can not configure IRQs\n",
306 bus->chipinfo.id);
307 }
308 bcma_debug(bus, "IRQ reconfiguration done\n");
309 bcma_core_mips_dump_irq(bus);
310
311 mcore->setup_done = true;
312}
309 }
310 bcma_err(bus,
311 "Unknown device (0x%x) found, can not configure IRQs\n",
312 bus->chipinfo.id);
313 }
314 bcma_debug(bus, "IRQ reconfiguration done\n");
315 bcma_core_mips_dump_irq(bus);
316
317 mcore->setup_done = true;
318}