static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
{
int i;
-@@ -247,7 +263,8 @@ void bcma_core_mips_early_init(struct bc
- void bcma_core_mips_init(struct bcma_drv_mips *mcore)
- {
- struct bcma_bus *bus;
-- struct bcma_device *core;
-+ int irq;
-+
- bus = mcore->core->bus;
-
- if (mcore->setup_done)
-@@ -259,35 +276,44 @@ void bcma_core_mips_init(struct bcma_drv
+@@ -259,35 +275,47 @@ void bcma_core_mips_init(struct bcma_drv
mcore->assigned_irqs = 1;
- bcma_core_mips_set_irq(core,
- mcore->assigned_irqs++);
- break;
-- }
+ switch (bus->chipinfo.id) {
+ case BCMA_CHIP_ID_BCM4716:
+ case BCMA_CHIP_ID_BCM4748:
+ 0);
+ break;
+ default:
++ list_for_each_entry(core, &bus->cores, list) {
++ core->irq = bcma_core_irq(core);
+ }
+ bcma_err(bus,
+ "Unknown device (0x%x) found, can not configure IRQs\n",
+ bus->chipinfo.id);
for (i = 0; i <= 6; i++)
printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
printk("\n");
-@@ -270,7 +270,7 @@ void bcma_core_mips_init(struct bcma_drv
+@@ -269,7 +269,7 @@ void bcma_core_mips_init(struct bcma_drv
if (mcore->setup_done)
return;
bcma_core_mips_early_init(mcore);
-@@ -315,7 +315,7 @@ void bcma_core_mips_init(struct bcma_drv
+@@ -317,7 +317,7 @@ void bcma_core_mips_init(struct bcma_drv
"Unknown device (0x%x) found, can not configure IRQs\n",
bus->chipinfo.id);
}
*/
unsigned int bcma_core_mips_irq(struct bcma_device *dev)
{
-@@ -88,13 +93,18 @@ unsigned int bcma_core_mips_irq(struct b
+@@ -88,13 +93,15 @@ unsigned int bcma_core_mips_irq(struct b
unsigned int irq;
irqflag = bcma_core_mips_irqflag(dev);
+ if (irqflag == 0x3f)
+ return 6;
- for (irq = 1; irq <= 4; irq++)
+- for (irq = 1; irq <= 4; irq++)
++ for (irq = 0; irq <= 4; irq++)
if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
(1 << irqflag))
return irq;
- return 0;
-+ if ((1 << irqflag) & bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)))
-+ return 0;
-+
+ return 5;
}
EXPORT_SYMBOL(bcma_core_mips_irq);
-@@ -115,7 +125,7 @@ static void bcma_core_mips_set_irq(struc
+@@ -115,7 +122,7 @@ static void bcma_core_mips_set_irq(struc
bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0),
bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) &
~(1 << irqflag));
bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);
/* assign the new one */
+@@ -145,7 +152,7 @@ static void bcma_core_mips_set_irq(struc
+ }
+
+ bcma_debug(bus, "set_irq: core 0x%04x, irq %d => %d\n",
+- dev->id.id, oldirq + 2, irq + 2);
++ dev->id.id, oldirq <= 4 ? oldirq + 2 : 0, irq + 2);
+ }
+
+ static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
--- /dev/null
+--- a/drivers/bcma/driver_mips.c
++++ b/drivers/bcma/driver_mips.c
+@@ -280,8 +280,6 @@ void bcma_core_mips_init(struct bcma_drv
+
+ bcma_core_mips_early_init(mcore);
+
+- mcore->assigned_irqs = 1;
+-
+ switch (bus->chipinfo.id) {
+ case BCMA_CHIP_ID_BCM4716:
+ case BCMA_CHIP_ID_BCM4748:
+--- a/include/linux/bcma/bcma_driver_mips.h
++++ b/include/linux/bcma/bcma_driver_mips.h
+@@ -36,7 +36,6 @@ struct bcma_drv_mips {
+ struct bcma_device *core;
+ u8 setup_done:1;
+ u8 early_setup_done:1;
+- unsigned int assigned_irqs;
+ };
+
+ #ifdef CONFIG_BCMA_DRIVER_MIPS
--- /dev/null
+--- a/drivers/bcma/driver_mips.c
++++ b/drivers/bcma/driver_mips.c
+@@ -131,9 +131,9 @@ static void bcma_core_mips_set_irq(struc
+ bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) |
+ (1 << irqflag));
+ } else {
+- u32 oldirqflag = bcma_read32(mdev,
+- BCMA_MIPS_MIPS74K_INTMASK(irq));
+- if (oldirqflag) {
++ u32 irqinitmask = bcma_read32(mdev,
++ BCMA_MIPS_MIPS74K_INTMASK(irq));
++ if (irqinitmask) {
+ struct bcma_device *core;
+
+ /* backplane irq line is in use, find out who uses
+@@ -141,7 +141,7 @@ static void bcma_core_mips_set_irq(struc
+ */
+ list_for_each_entry(core, &bus->cores, list) {
+ if ((1 << bcma_core_mips_irqflag(core)) ==
+- oldirqflag) {
++ irqinitmask) {
+ bcma_core_mips_set_irq(core, 0);
+ break;
+ }
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
-@@ -49,6 +49,6 @@ static inline void bcma_core_mips_early_
+@@ -48,6 +48,6 @@ static inline void bcma_core_mips_early_
extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
{
struct bcma_device *mdev = dev->bus->drv_mips.core;
u32 irqflag;
-@@ -106,7 +106,12 @@ unsigned int bcma_core_mips_irq(struct b
+@@ -103,7 +103,13 @@ unsigned int bcma_core_mips_irq(struct b
return 5;
}
+
+unsigned int bcma_core_irq(struct bcma_device *dev)
+{
-+ return bcma_core_mips_irq(dev) + 2;
++ unsigned int mips_irq = bcma_core_mips_irq(dev);
++ return mips_irq <= 4 ? mips_irq + 2 : 0;
+}
+EXPORT_SYMBOL(bcma_core_irq);
struct bcma_device;
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
-@@ -275,6 +275,32 @@ void bcma_core_mips_early_init(struct bc
+@@ -273,6 +273,32 @@ void bcma_core_mips_early_init(struct bc
mcore->early_setup_done = true;
}
void bcma_core_mips_init(struct bcma_drv_mips *mcore)
{
struct bcma_bus *bus;
-@@ -289,6 +315,8 @@ void bcma_core_mips_init(struct bcma_drv
+@@ -286,6 +312,8 @@ void bcma_core_mips_init(struct bcma_drv
bcma_core_mips_early_init(mcore);
+ bcma_fix_i2s_irqflag(bus);
+
- mcore->assigned_irqs = 1;
-
switch (bus->chipinfo.id) {
+ case BCMA_CHIP_ID_BCM4716:
+ case BCMA_CHIP_ID_BCM4748: