atheros: leave the gpio interrupts alone when user space changes the gpio input settings, fixes #4493

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18036 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2009-10-11 19:50:16 +00:00
parent db74177204
commit 9fe1867ccc
4 changed files with 42 additions and 12 deletions

View File

@ -2105,7 +2105,7 @@
+ +
--- /dev/null --- /dev/null
+++ b/arch/mips/ar231x/ar2315.c +++ b/arch/mips/ar231x/ar2315.c
@@ -0,0 +1,643 @@ @@ -0,0 +1,658 @@
+/* +/*
+ * This file is subject to the terms and conditions of the GNU General Public + * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive + * License. See the file "COPYING" in the main directory of this archive
@ -2163,6 +2163,10 @@
+ if (!pend) + if (!pend)
+ ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO); + ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO);
+ +
+ /* Enable interrupt with edge detection */
+ if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(bit)) != AR2315_GPIO_CR_I(bit))
+ return;
+
+ if (bit >= 0) + if (bit >= 0)
+ do_IRQ(AR531X_GPIO_IRQ_BASE + bit); + do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
+} +}
@ -2220,14 +2224,24 @@
+{ +{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE; + unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
+ +
+ /* reconfigure GPIO line as input */
+ ar231x_mask_reg(AR2315_GPIO_CR, AR2315_GPIO_CR_M(gpio), AR2315_GPIO_CR_I(gpio));
+
+ /* Enable interrupt with edge detection */ + /* Enable interrupt with edge detection */
+ if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(gpio)) != AR2315_GPIO_CR_I(gpio))
+ return;
+
+ gpiointmask |= (1 << gpio); + gpiointmask |= (1 << gpio);
+ ar2315_set_gpiointmask(gpio, 3); + ar2315_set_gpiointmask(gpio, 3);
+} +}
+ +
+static unsigned int ar2315_gpio_intr_startup(unsigned int irq)
+{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
+
+ /* reconfigure GPIO line as input */
+ ar231x_mask_reg(AR2315_GPIO_CR, AR2315_GPIO_CR_M(gpio), AR2315_GPIO_CR_I(gpio));
+ ar2315_gpio_intr_enable(irq);
+ return 0;
+}
+
+static void ar2315_gpio_intr_disable(unsigned int irq) +static void ar2315_gpio_intr_disable(unsigned int irq)
+{ +{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE; + unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
@ -2246,6 +2260,7 @@
+ +
+static struct irq_chip ar2315_gpio_intr_controller = { +static struct irq_chip ar2315_gpio_intr_controller = {
+ .typename = "AR2315-GPIO", + .typename = "AR2315-GPIO",
+ .startup = ar2315_gpio_intr_startup,
+ .ack = ar2315_gpio_intr_disable, + .ack = ar2315_gpio_intr_disable,
+ .mask_ack = ar2315_gpio_intr_disable, + .mask_ack = ar2315_gpio_intr_disable,
+ .mask = ar2315_gpio_intr_disable, + .mask = ar2315_gpio_intr_disable,

View File

@ -256,7 +256,7 @@
+ default y + default y
--- a/arch/mips/ar231x/ar2315.c --- a/arch/mips/ar231x/ar2315.c
+++ b/arch/mips/ar231x/ar2315.c +++ b/arch/mips/ar231x/ar2315.c
@@ -59,6 +59,27 @@ static inline void ar2315_gpio_irq(void) @@ -63,6 +63,27 @@ static inline void ar2315_gpio_irq(void)
do_IRQ(AR531X_GPIO_IRQ_BASE + bit); do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
} }
@ -284,7 +284,7 @@
/* /*
* Called when an interrupt is received, this function * Called when an interrupt is received, this function
@@ -77,6 +98,10 @@ ar2315_irq_dispatch(void) @@ -81,6 +102,10 @@ ar2315_irq_dispatch(void)
do_IRQ(AR2315_IRQ_WLAN0_INTRS); do_IRQ(AR2315_IRQ_WLAN0_INTRS);
else if (pending & CAUSEF_IP4) else if (pending & CAUSEF_IP4)
do_IRQ(AR2315_IRQ_ENET0_INTRS); do_IRQ(AR2315_IRQ_ENET0_INTRS);

View File

@ -2107,7 +2107,7 @@
+ +
--- /dev/null --- /dev/null
+++ b/arch/mips/ar231x/ar2315.c +++ b/arch/mips/ar231x/ar2315.c
@@ -0,0 +1,643 @@ @@ -0,0 +1,658 @@
+/* +/*
+ * This file is subject to the terms and conditions of the GNU General Public + * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive + * License. See the file "COPYING" in the main directory of this archive
@ -2165,6 +2165,10 @@
+ if (!pend) + if (!pend)
+ ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO); + ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO);
+ +
+ /* Enable interrupt with edge detection */
+ if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(bit)) != AR2315_GPIO_CR_I(bit))
+ return;
+
+ if (bit >= 0) + if (bit >= 0)
+ do_IRQ(AR531X_GPIO_IRQ_BASE + bit); + do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
+} +}
@ -2222,14 +2226,24 @@
+{ +{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE; + unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
+ +
+ /* reconfigure GPIO line as input */
+ ar231x_mask_reg(AR2315_GPIO_CR, AR2315_GPIO_CR_M(gpio), AR2315_GPIO_CR_I(gpio));
+
+ /* Enable interrupt with edge detection */ + /* Enable interrupt with edge detection */
+ if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(gpio)) != AR2315_GPIO_CR_I(gpio))
+ return;
+
+ gpiointmask |= (1 << gpio); + gpiointmask |= (1 << gpio);
+ ar2315_set_gpiointmask(gpio, 3); + ar2315_set_gpiointmask(gpio, 3);
+} +}
+ +
+static unsigned int ar2315_gpio_intr_startup(unsigned int irq)
+{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
+
+ /* reconfigure GPIO line as input */
+ ar231x_mask_reg(AR2315_GPIO_CR, AR2315_GPIO_CR_M(gpio), AR2315_GPIO_CR_I(gpio));
+ ar2315_gpio_intr_enable(irq);
+ return 0;
+}
+
+static void ar2315_gpio_intr_disable(unsigned int irq) +static void ar2315_gpio_intr_disable(unsigned int irq)
+{ +{
+ unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE; + unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
@ -2248,6 +2262,7 @@
+ +
+static struct irq_chip ar2315_gpio_intr_controller = { +static struct irq_chip ar2315_gpio_intr_controller = {
+ .typename = "AR2315-GPIO", + .typename = "AR2315-GPIO",
+ .startup = ar2315_gpio_intr_startup,
+ .ack = ar2315_gpio_intr_disable, + .ack = ar2315_gpio_intr_disable,
+ .mask_ack = ar2315_gpio_intr_disable, + .mask_ack = ar2315_gpio_intr_disable,
+ .mask = ar2315_gpio_intr_disable, + .mask = ar2315_gpio_intr_disable,

View File

@ -256,7 +256,7 @@
+ default y + default y
--- a/arch/mips/ar231x/ar2315.c --- a/arch/mips/ar231x/ar2315.c
+++ b/arch/mips/ar231x/ar2315.c +++ b/arch/mips/ar231x/ar2315.c
@@ -59,6 +59,27 @@ static inline void ar2315_gpio_irq(void) @@ -63,6 +63,27 @@ static inline void ar2315_gpio_irq(void)
do_IRQ(AR531X_GPIO_IRQ_BASE + bit); do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
} }
@ -284,7 +284,7 @@
/* /*
* Called when an interrupt is received, this function * Called when an interrupt is received, this function
@@ -77,6 +98,10 @@ ar2315_irq_dispatch(void) @@ -81,6 +102,10 @@ ar2315_irq_dispatch(void)
do_IRQ(AR2315_IRQ_WLAN0_INTRS); do_IRQ(AR2315_IRQ_WLAN0_INTRS);
else if (pending & CAUSEF_IP4) else if (pending & CAUSEF_IP4)
do_IRQ(AR2315_IRQ_ENET0_INTRS); do_IRQ(AR2315_IRQ_ENET0_INTRS);