linux-mips
[Top] [All Lists]

[PATCH] bcma: prevent irq handler from firing when registered

To: ralf@linux-mips.org, blogic@openwrt.org
Subject: [PATCH] bcma: prevent irq handler from firing when registered
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Thu, 2 Jan 2014 19:01:08 +0100
Cc: linux-mips@linux-mips.org, zajec5@gmail.com, Hauke Mehrtens <hauke@hauke-m.de>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
With this patch we prevent the irq from being fired when it is
registered. The Hardware fires an IRQ when input signal XOR polarity
AND gpio mask is 1. Now we are setting polarity to a vlaue so that is
is 0 when we register it.

In addition we also set the irq mask register to 0 when the irq handler
is initialized, so all gpio irqs are masked and there will be no
unexpected irq.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/bcma/driver_gpio.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c
index ec422a9..c2728a0 100644
--- a/drivers/bcma/driver_gpio.c
+++ b/drivers/bcma/driver_gpio.c
@@ -91,7 +91,9 @@ static void bcma_gpio_irq_unmask(struct irq_data *d)
 {
        struct bcma_drv_cc *cc = irq_data_get_irq_chip_data(d);
        int gpio = irqd_to_hwirq(d);
+       u32 val = bcma_chipco_gpio_in(cc, BIT(gpio));
 
+       bcma_chipco_gpio_polarity(cc, BIT(gpio), val);
        bcma_chipco_gpio_intmask(cc, BIT(gpio), BIT(gpio));
 }
 
@@ -156,6 +158,7 @@ static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc)
        if (err)
                goto err_req_irq;
 
+       bcma_chipco_gpio_intmask(cc, ~0, 0);
        bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO);
 
        return 0;
-- 
1.7.10.4


<Prev in Thread] Current Thread [Next in Thread>