Commit c0f0c28b authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Fix gpio irq level detection

The new way to pass level detection is with the SA_TRIGGER_*
flags wit request_irq instead of set_irq_type().

As we may get other flags in the trigger, we must mask the flag
instead of comparing it directly.
parent 567e8f54
...@@ -402,13 +402,13 @@ static inline void set_24xx_gpio_triggering(void __iomem *base, int gpio, int tr ...@@ -402,13 +402,13 @@ static inline void set_24xx_gpio_triggering(void __iomem *base, int gpio, int tr
u32 gpio_bit = 1 << gpio; u32 gpio_bit = 1 << gpio;
MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit, MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit,
trigger & IRQT_LOW); trigger & __IRQT_LOWLVL);
MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit, MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit,
trigger & IRQT_HIGH); trigger & __IRQT_HIGHLVL);
MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit, MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit,
trigger & IRQT_RISING); trigger & __IRQT_RISEDGE);
MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit, MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit,
trigger & IRQT_FALLING); trigger & __IRQT_FALEDGE);
/* FIXME: Possibly do 'set_irq_handler(j, do_level_IRQ)' if only level /* FIXME: Possibly do 'set_irq_handler(j, do_level_IRQ)' if only level
* triggering requested. */ * triggering requested. */
} }
...@@ -422,9 +422,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) ...@@ -422,9 +422,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
case METHOD_MPUIO: case METHOD_MPUIO:
reg += OMAP_MPUIO_GPIO_INT_EDGE; reg += OMAP_MPUIO_GPIO_INT_EDGE;
l = __raw_readl(reg); l = __raw_readl(reg);
if (trigger == IRQT_RISING) if (trigger & __IRQT_RISEDGE)
l |= 1 << gpio; l |= 1 << gpio;
else if (trigger == IRQT_FALLING) else if (trigger & __IRQT_FALEDGE)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
...@@ -432,9 +432,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) ...@@ -432,9 +432,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
case METHOD_GPIO_1510: case METHOD_GPIO_1510:
reg += OMAP1510_GPIO_INT_CONTROL; reg += OMAP1510_GPIO_INT_CONTROL;
l = __raw_readl(reg); l = __raw_readl(reg);
if (trigger == IRQT_RISING) if (trigger & __IRQT_RISEDGE)
l |= 1 << gpio; l |= 1 << gpio;
else if (trigger == IRQT_FALLING) else if (trigger & __IRQT_FALEDGE)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
...@@ -450,9 +450,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) ...@@ -450,9 +450,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
BUG(); BUG();
l = __raw_readl(reg); l = __raw_readl(reg);
l &= ~(3 << (gpio << 1)); l &= ~(3 << (gpio << 1));
if (trigger == IRQT_RISING) if (trigger & __IRQT_RISEDGE)
l |= 2 << gpio; l |= 2 << gpio;
else if (trigger == IRQT_FALLING) else if (trigger & __IRQT_FALEDGE)
l |= 1 << gpio; l |= 1 << gpio;
else else
goto bad; goto bad;
...@@ -460,9 +460,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) ...@@ -460,9 +460,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
case METHOD_GPIO_730: case METHOD_GPIO_730:
reg += OMAP730_GPIO_INT_CONTROL; reg += OMAP730_GPIO_INT_CONTROL;
l = __raw_readl(reg); l = __raw_readl(reg);
if (trigger == IRQT_RISING) if (trigger & __IRQT_RISEDGE)
l |= 1 << gpio; l |= 1 << gpio;
else if (trigger == IRQT_FALLING) else if (trigger & __IRQT_FALEDGE)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment