提交 f5f93117 编写于 作者: M Mika Westerberg 提交者: Grant Likely

gpio/langwell: clear IRQ edge detect registers at init

The boot firmware might leave the registers configured causing interrupts
to happen even when no handler for them is yet registered. Fix this by
clearing the IRQ edge detect registers at init.
Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 b3e35af2
...@@ -263,6 +263,24 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -263,6 +263,24 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc)
chip->irq_eoi(data); chip->irq_eoi(data);
} }
static void lnw_irq_init_hw(struct lnw_gpio *lnw)
{
void __iomem *reg;
unsigned base;
for (base = 0; base < lnw->chip.ngpio; base += 32) {
/* Clear the rising-edge detect register */
reg = gpio_reg(&lnw->chip, base, GRER);
writel(0, reg);
/* Clear the falling-edge detect register */
reg = gpio_reg(&lnw->chip, base, GFER);
writel(0, reg);
/* Clear the edge detect status register */
reg = gpio_reg(&lnw->chip, base, GEDR);
writel(~0, reg);
}
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int lnw_gpio_runtime_resume(struct device *dev) static int lnw_gpio_runtime_resume(struct device *dev)
{ {
...@@ -371,6 +389,9 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, ...@@ -371,6 +389,9 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval); dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval);
goto err4; goto err4;
} }
lnw_irq_init_hw(lnw);
irq_set_handler_data(pdev->irq, lnw); irq_set_handler_data(pdev->irq, lnw);
irq_set_chained_handler(pdev->irq, lnw_irq_handler); irq_set_chained_handler(pdev->irq, lnw_irq_handler);
for (i = 0; i < lnw->chip.ngpio; i++) { for (i = 0; i < lnw->chip.ngpio; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册