diff options
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 6c51191da567..35bebde23e83 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -432,7 +432,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
432 | { | 432 | { |
433 | void __iomem *base = bank->base; | 433 | void __iomem *base = bank->base; |
434 | u32 gpio_bit = 1 << gpio; | 434 | u32 gpio_bit = 1 << gpio; |
435 | u32 val; | ||
436 | 435 | ||
437 | if (cpu_is_omap44xx()) { | 436 | if (cpu_is_omap44xx()) { |
438 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, | 437 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, |
@@ -455,15 +454,8 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
455 | } | 454 | } |
456 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { | 455 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { |
457 | if (cpu_is_omap44xx()) { | 456 | if (cpu_is_omap44xx()) { |
458 | if (trigger != 0) | 457 | MOD_REG_BIT(OMAP4_GPIO_IRQWAKEN0, gpio_bit, |
459 | __raw_writel(1 << gpio, bank->base+ | 458 | trigger != 0); |
460 | OMAP4_GPIO_IRQWAKEN0); | ||
461 | else { | ||
462 | val = __raw_readl(bank->base + | ||
463 | OMAP4_GPIO_IRQWAKEN0); | ||
464 | __raw_writel(val & (~(1 << gpio)), bank->base + | ||
465 | OMAP4_GPIO_IRQWAKEN0); | ||
466 | } | ||
467 | } else { | 459 | } else { |
468 | /* | 460 | /* |
469 | * GPIO wakeup request can only be generated on edge | 461 | * GPIO wakeup request can only be generated on edge |
@@ -477,8 +469,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
477 | + OMAP24XX_GPIO_CLEARWKUENA); | 469 | + OMAP24XX_GPIO_CLEARWKUENA); |
478 | } | 470 | } |
479 | } | 471 | } |
480 | /* This part needs to be executed always for OMAP34xx */ | 472 | /* This part needs to be executed always for OMAP{34xx, 44xx} */ |
481 | if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) { | 473 | if (cpu_is_omap34xx() || cpu_is_omap44xx() || |
474 | (bank->non_wakeup_gpios & gpio_bit)) { | ||
482 | /* | 475 | /* |
483 | * Log the edge gpio and manually trigger the IRQ | 476 | * Log the edge gpio and manually trigger the IRQ |
484 | * after resume if the input level changes | 477 | * after resume if the input level changes |
@@ -1134,8 +1127,11 @@ static void gpio_irq_shutdown(struct irq_data *d) | |||
1134 | { | 1127 | { |
1135 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1128 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1136 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1129 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1130 | unsigned long flags; | ||
1137 | 1131 | ||
1132 | spin_lock_irqsave(&bank->lock, flags); | ||
1138 | _reset_gpio(bank, gpio); | 1133 | _reset_gpio(bank, gpio); |
1134 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1139 | } | 1135 | } |
1140 | 1136 | ||
1141 | static void gpio_ack_irq(struct irq_data *d) | 1137 | static void gpio_ack_irq(struct irq_data *d) |
@@ -1150,9 +1146,12 @@ static void gpio_mask_irq(struct irq_data *d) | |||
1150 | { | 1146 | { |
1151 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1147 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1152 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1148 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1149 | unsigned long flags; | ||
1153 | 1150 | ||
1151 | spin_lock_irqsave(&bank->lock, flags); | ||
1154 | _set_gpio_irqenable(bank, gpio, 0); | 1152 | _set_gpio_irqenable(bank, gpio, 0); |
1155 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 1153 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); |
1154 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1156 | } | 1155 | } |
1157 | 1156 | ||
1158 | static void gpio_unmask_irq(struct irq_data *d) | 1157 | static void gpio_unmask_irq(struct irq_data *d) |
@@ -1161,7 +1160,9 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1161 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1160 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1162 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1161 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
1163 | u32 trigger = irqd_get_trigger_type(d); | 1162 | u32 trigger = irqd_get_trigger_type(d); |
1163 | unsigned long flags; | ||
1164 | 1164 | ||
1165 | spin_lock_irqsave(&bank->lock, flags); | ||
1165 | if (trigger) | 1166 | if (trigger) |
1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); | 1167 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); |
1167 | 1168 | ||
@@ -1173,6 +1174,7 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | _set_gpio_irqenable(bank, gpio, 1); | 1176 | _set_gpio_irqenable(bank, gpio, 1); |
1177 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | static struct irq_chip gpio_irq_chip = { | 1180 | static struct irq_chip gpio_irq_chip = { |
@@ -1524,7 +1526,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id) | |||
1524 | } | 1526 | } |
1525 | } | 1527 | } |
1526 | 1528 | ||
1527 | static void __init omap_gpio_chip_init(struct gpio_bank *bank) | 1529 | static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) |
1528 | { | 1530 | { |
1529 | int j; | 1531 | int j; |
1530 | static int gpio; | 1532 | static int gpio; |