brcm47xx: various fixes and code cleanups for irq code

This is based on a patch send by Nathan Hintz <nlhintz@hotmail.com>

SVN-Revision: 34997
This commit is contained in:
Hauke Mehrtens 2013-01-03 16:56:54 +00:00
parent ac383f95a5
commit a105eea1a1
7 changed files with 72 additions and 27 deletions

View File

@ -23,17 +23,7 @@
static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq) static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
{ {
int i; int i;
@@ -247,7 +263,8 @@ void bcma_core_mips_early_init(struct bc @@ -259,35 +275,47 @@ void bcma_core_mips_init(struct bcma_drv
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
mcore->assigned_irqs = 1; mcore->assigned_irqs = 1;
@ -65,7 +55,6 @@
- bcma_core_mips_set_irq(core, - bcma_core_mips_set_irq(core,
- mcore->assigned_irqs++); - mcore->assigned_irqs++);
- break; - break;
- }
+ switch (bus->chipinfo.id) { + switch (bus->chipinfo.id) {
+ case BCMA_CHIP_ID_BCM4716: + case BCMA_CHIP_ID_BCM4716:
+ case BCMA_CHIP_ID_BCM4748: + case BCMA_CHIP_ID_BCM4748:
@ -101,6 +90,9 @@
+ 0); + 0);
+ break; + break;
+ default: + default:
+ list_for_each_entry(core, &bus->cores, list) {
+ core->irq = bcma_core_irq(core);
}
+ bcma_err(bus, + bcma_err(bus,
+ "Unknown device (0x%x) found, can not configure IRQs\n", + "Unknown device (0x%x) found, can not configure IRQs\n",
+ bus->chipinfo.id); + bus->chipinfo.id);

View File

@ -20,7 +20,7 @@
for (i = 0; i <= 6; i++) for (i = 0; i <= 6; i++)
printk(" %s%s", irq_name[i], i == irq ? "*" : " "); printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
printk("\n"); 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) if (mcore->setup_done)
return; return;
@ -29,7 +29,7 @@
bcma_core_mips_early_init(mcore); 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", "Unknown device (0x%x) found, can not configure IRQs\n",
bus->chipinfo.id); bus->chipinfo.id);
} }

View File

@ -18,27 +18,25 @@
*/ */
unsigned int bcma_core_mips_irq(struct bcma_device *dev) 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; unsigned int irq;
irqflag = bcma_core_mips_irqflag(dev); irqflag = bcma_core_mips_irqflag(dev);
+ if (irqflag == 0x3f) + if (irqflag == 0x3f)
+ return 6; + 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)) & if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
(1 << irqflag)) (1 << irqflag))
return irq; return irq;
- return 0; - return 0;
+ if ((1 << irqflag) & bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)))
+ return 0;
+
+ return 5; + return 5;
} }
EXPORT_SYMBOL(bcma_core_mips_irq); 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_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0),
bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) & bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) &
~(1 << irqflag)); ~(1 << irqflag));
@ -47,3 +45,12 @@
bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0); bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);
/* assign the new one */ /* 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,

View File

@ -0,0 +1,21 @@
--- 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

View File

@ -0,0 +1,24 @@
--- 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;
}

View File

@ -1,6 +1,6 @@
--- a/include/linux/bcma/bcma_driver_mips.h --- a/include/linux/bcma/bcma_driver_mips.h
+++ b/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); extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
@ -30,7 +30,7 @@
{ {
struct bcma_device *mdev = dev->bus->drv_mips.core; struct bcma_device *mdev = dev->bus->drv_mips.core;
u32 irqflag; 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; return 5;
} }
@ -38,7 +38,8 @@
+ +
+unsigned int bcma_core_irq(struct bcma_device *dev) +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); +EXPORT_SYMBOL(bcma_core_irq);

View File

@ -10,7 +10,7 @@
struct bcma_device; struct bcma_device;
--- a/drivers/bcma/driver_mips.c --- a/drivers/bcma/driver_mips.c
+++ b/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; mcore->early_setup_done = true;
} }
@ -43,12 +43,12 @@
void bcma_core_mips_init(struct bcma_drv_mips *mcore) void bcma_core_mips_init(struct bcma_drv_mips *mcore)
{ {
struct bcma_bus *bus; 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_core_mips_early_init(mcore);
+ bcma_fix_i2s_irqflag(bus); + bcma_fix_i2s_irqflag(bus);
+ +
mcore->assigned_irqs = 1;
switch (bus->chipinfo.id) { switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM4716:
case BCMA_CHIP_ID_BCM4748: