brcm47xx: various fixes and code cleanups for irq code
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 3 Jan 2013 16:56:54 +0000 (16:56 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 3 Jan 2013 16:56:54 +0000 (16:56 +0000)
This is based on a patch send by Nathan Hintz <nlhintz@hotmail.com>

SVN-Revision: 34997

target/linux/brcm47xx/patches-3.6/181-bcma-explicit-assigne-irq-numbers.patch
target/linux/brcm47xx/patches-3.6/182-bcma-make-some-info-messages-debug.patch
target/linux/brcm47xx/patches-3.6/183-bcma-mips-show-also-disabled-irqs.patch
target/linux/brcm47xx/patches-3.6/184-bcma-mips-remove-assigned_irqs.patch [new file with mode: 0644]
target/linux/brcm47xx/patches-3.6/185-bcma-rename-oldirqflag-to-irqinitmask-to-better-matc.patch [new file with mode: 0644]
target/linux/brcm47xx/patches-3.6/235-bcma-dont-expose-mips-irq.patch
target/linux/brcm47xx/patches-3.6/237-bcma-bcm4716-bcm4748-i2s-irqflag.patch

index 7fac41535dde448e442c10c42592220bc588e3d9..501f8d66b31888ab8f7343410e495232f97fd04c 100644 (file)
  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;
  
@@ -65,7 +55,6 @@
 -                              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);
index 3506fe55ab8001b6682f5697b88928c7a1c8719b..4250216f30c9ccbae6e2fb171d0fbd20e3a69876 100644 (file)
@@ -20,7 +20,7 @@
        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;
  
@@ -29,7 +29,7 @@
  
        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);
        }
index 6606970e698d1ddfee80bbea137168132fa16655..d44b3068e701debae22e3d2adc9ccd56da21faec 100644 (file)
   */
  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,
diff --git a/target/linux/brcm47xx/patches-3.6/184-bcma-mips-remove-assigned_irqs.patch b/target/linux/brcm47xx/patches-3.6/184-bcma-mips-remove-assigned_irqs.patch
new file mode 100644 (file)
index 0000000..c402e11
--- /dev/null
@@ -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
diff --git a/target/linux/brcm47xx/patches-3.6/185-bcma-rename-oldirqflag-to-irqinitmask-to-better-matc.patch b/target/linux/brcm47xx/patches-3.6/185-bcma-rename-oldirqflag-to-irqinitmask-to-better-matc.patch
new file mode 100644 (file)
index 0000000..5fb952f
--- /dev/null
@@ -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;
+                               }
index 90d05bc8fd781fd4fbd10764cd7165e2f9ed0d70..5df8636058e39c059795fe6fb2808cb5057ed87a 100644 (file)
@@ -1,6 +1,6 @@
 --- 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);
  
@@ -30,7 +30,7 @@
  {
        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;
  }
@@ -38,7 +38,8 @@
 +
 +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);
  
index e369abdd47987079fc660bbdd5f649806ac9d12e..d77050d2e973e592976671a58ea8183b2f4680db 100644 (file)
@@ -10,7 +10,7 @@
  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: