External IRQs are currently broken, fix the BCM6345_EXT_IRQ driver.

Since the adoption of the new driver irq-bcm6345-ext, in Chaos Calmer,
external IRQs don't work. It seems there were some minor errors at the initial
development of the driver.

This patch fixes the ticket https://dev.openwrt.org/ticket/21613

Signed-off-by: Daniel Gonzalez <dgcb...@gmail.com>
diff --git 
a/target/linux/brcm63xx/patches-4.1/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
 
b/target/linux/brcm63xx/patches-4.1/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
index 5ee5ee2..4dd5130 100644
--- 
a/target/linux/brcm63xx/patches-4.1/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
+++ 
b/target/linux/brcm63xx/patches-4.1/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
@@ -148,7 +148,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg |= hwirq << (EXTIRQ_CFG_CLEAR * priv->shift);
++      reg |= 1 << (hwirq + EXTIRQ_CFG_CLEAR * priv->shift);
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -161,7 +161,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg &= ~(hwirq << (EXTIRQ_CFG_MASK * priv->shift));
++      reg &= ~(1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift));
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -174,7 +174,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg |= hwirq << (EXTIRQ_CFG_MASK * priv->shift);
++      reg |= 1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift);
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -222,17 +222,17 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +      reg = __raw_readl(priv->reg);
 +
 +      if (levelsense)
-+              reg |= hwirq << (EXTIRQ_CFG_LEVELSENSE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_LEVELSENSE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift));
 +      if (sense)
-+              reg |= hwirq << (EXTIRQ_CFG_SENSE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_SENSE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift));
 +      if (bothedge)
-+              reg |= hwirq << (EXTIRQ_CFG_BOTHEDGE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_BOTHEDGE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift));
 +
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
diff --git 
a/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
 
b/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
index 4f4d7bd..2526456 100644
--- 
a/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
+++ 
b/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch
@@ -148,7 +148,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg |= hwirq << (EXTIRQ_CFG_CLEAR * priv->shift);
++      reg |= 1 << (hwirq + EXTIRQ_CFG_CLEAR * priv->shift);
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -161,7 +161,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg &= ~(hwirq << (EXTIRQ_CFG_MASK * priv->shift));
++      reg &= ~(1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift));
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -174,7 +174,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +
 +      raw_spin_lock(&priv->lock);
 +      reg = __raw_readl(priv->reg);
-+      reg |= hwirq << (EXTIRQ_CFG_MASK * priv->shift);
++      reg |= 1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift);
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
 +}
@@ -222,17 +222,17 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +      reg = __raw_readl(priv->reg);
 +
 +      if (levelsense)
-+              reg |= hwirq << (EXTIRQ_CFG_LEVELSENSE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_LEVELSENSE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift));
 +      if (sense)
-+              reg |= hwirq << (EXTIRQ_CFG_SENSE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_SENSE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift));
 +      if (bothedge)
-+              reg |= hwirq << (EXTIRQ_CFG_BOTHEDGE * priv->shift);
++              reg |= 1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift);
 +      else
-+              reg &= ~(hwirq << (EXTIRQ_CFG_BOTHEDGE * priv->shift));
++              reg &= ~(1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift));
 +
 +      __raw_writel(reg, priv->reg);
 +      raw_spin_unlock(&priv->lock);
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to