From a105eea1a13347ae64525a1b4e162edbb76e4ecc Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 3 Jan 2013 16:56:54 +0000 Subject: [PATCH] brcm47xx: various fixes and code cleanups for irq code This is based on a patch send by Nathan Hintz SVN-Revision: 34997 --- ...81-bcma-explicit-assigne-irq-numbers.patch | 16 ++++--------- ...2-bcma-make-some-info-messages-debug.patch | 4 ++-- ...83-bcma-mips-show-also-disabled-irqs.patch | 19 ++++++++++----- .../184-bcma-mips-remove-assigned_irqs.patch | 21 ++++++++++++++++ ...rqflag-to-irqinitmask-to-better-matc.patch | 24 +++++++++++++++++++ .../235-bcma-dont-expose-mips-irq.patch | 7 +++--- ...237-bcma-bcm4716-bcm4748-i2s-irqflag.patch | 8 +++---- 7 files changed, 72 insertions(+), 27 deletions(-) create mode 100644 target/linux/brcm47xx/patches-3.6/184-bcma-mips-remove-assigned_irqs.patch create mode 100644 target/linux/brcm47xx/patches-3.6/185-bcma-rename-oldirqflag-to-irqinitmask-to-better-matc.patch diff --git a/target/linux/brcm47xx/patches-3.6/181-bcma-explicit-assigne-irq-numbers.patch b/target/linux/brcm47xx/patches-3.6/181-bcma-explicit-assigne-irq-numbers.patch index 7fac41535d..501f8d66b3 100644 --- a/target/linux/brcm47xx/patches-3.6/181-bcma-explicit-assigne-irq-numbers.patch +++ b/target/linux/brcm47xx/patches-3.6/181-bcma-explicit-assigne-irq-numbers.patch @@ -23,17 +23,7 @@ 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: @@ -101,6 +90,9 @@ + 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); diff --git a/target/linux/brcm47xx/patches-3.6/182-bcma-make-some-info-messages-debug.patch b/target/linux/brcm47xx/patches-3.6/182-bcma-make-some-info-messages-debug.patch index 3506fe55ab..4250216f30 100644 --- a/target/linux/brcm47xx/patches-3.6/182-bcma-make-some-info-messages-debug.patch +++ b/target/linux/brcm47xx/patches-3.6/182-bcma-make-some-info-messages-debug.patch @@ -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); } diff --git a/target/linux/brcm47xx/patches-3.6/183-bcma-mips-show-also-disabled-irqs.patch b/target/linux/brcm47xx/patches-3.6/183-bcma-mips-show-also-disabled-irqs.patch index 6606970e69..d44b3068e7 100644 --- a/target/linux/brcm47xx/patches-3.6/183-bcma-mips-show-also-disabled-irqs.patch +++ b/target/linux/brcm47xx/patches-3.6/183-bcma-mips-show-also-disabled-irqs.patch @@ -18,27 +18,25 @@ */ 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)); @@ -47,3 +45,12 @@ 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 index 0000000000..c402e111f8 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.6/184-bcma-mips-remove-assigned_irqs.patch @@ -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 index 0000000000..5fb952f604 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.6/185-bcma-rename-oldirqflag-to-irqinitmask-to-better-matc.patch @@ -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; + } diff --git a/target/linux/brcm47xx/patches-3.6/235-bcma-dont-expose-mips-irq.patch b/target/linux/brcm47xx/patches-3.6/235-bcma-dont-expose-mips-irq.patch index 90d05bc8fd..5df8636058 100644 --- a/target/linux/brcm47xx/patches-3.6/235-bcma-dont-expose-mips-irq.patch +++ b/target/linux/brcm47xx/patches-3.6/235-bcma-dont-expose-mips-irq.patch @@ -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); diff --git a/target/linux/brcm47xx/patches-3.6/237-bcma-bcm4716-bcm4748-i2s-irqflag.patch b/target/linux/brcm47xx/patches-3.6/237-bcma-bcm4716-bcm4748-i2s-irqflag.patch index e369abdd47..d77050d2e9 100644 --- a/target/linux/brcm47xx/patches-3.6/237-bcma-bcm4716-bcm4748-i2s-irqflag.patch +++ b/target/linux/brcm47xx/patches-3.6/237-bcma-bcm4716-bcm4748-i2s-irqflag.patch @@ -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; } @@ -43,12 +43,12 @@ 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: -- 2.30.2