diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2010-11-29 05:17:17 -0500 |
---|---|---|
committer | Lennert Buytenhek <buytenh@wantstofly.org> | 2011-01-13 11:19:11 -0500 |
commit | e9191028e84a7a55146b2659e96bea998021b171 (patch) | |
tree | c0be2bce42c314d090193ccff5bf050901a0f068 /arch/arm/plat-omap | |
parent | f272c00e6b72a27035b39d30ecb73dee93d6760f (diff) |
ARM: plat-omap: irq_data conversion.
Signed-off-by: Lennert Buytenhek <buytenh@secretlab.ca>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 93 |
1 files changed, 46 insertions, 47 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 1f98e0b94847..99f57b9c7fa3 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -729,17 +729,17 @@ bad: | |||
729 | return -EINVAL; | 729 | return -EINVAL; |
730 | } | 730 | } |
731 | 731 | ||
732 | static int gpio_irq_type(unsigned irq, unsigned type) | 732 | static int gpio_irq_type(struct irq_data *d, unsigned type) |
733 | { | 733 | { |
734 | struct gpio_bank *bank; | 734 | struct gpio_bank *bank; |
735 | unsigned gpio; | 735 | unsigned gpio; |
736 | int retval; | 736 | int retval; |
737 | unsigned long flags; | 737 | unsigned long flags; |
738 | 738 | ||
739 | if (!cpu_class_is_omap2() && irq > IH_MPUIO_BASE) | 739 | if (!cpu_class_is_omap2() && d->irq > IH_MPUIO_BASE) |
740 | gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); | 740 | gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE); |
741 | else | 741 | else |
742 | gpio = irq - IH_GPIO_BASE; | 742 | gpio = d->irq - IH_GPIO_BASE; |
743 | 743 | ||
744 | if (check_gpio(gpio) < 0) | 744 | if (check_gpio(gpio) < 0) |
745 | return -EINVAL; | 745 | return -EINVAL; |
@@ -752,19 +752,19 @@ static int gpio_irq_type(unsigned irq, unsigned type) | |||
752 | && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) | 752 | && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) |
753 | return -EINVAL; | 753 | return -EINVAL; |
754 | 754 | ||
755 | bank = get_irq_chip_data(irq); | 755 | bank = irq_data_get_irq_chip_data(d); |
756 | spin_lock_irqsave(&bank->lock, flags); | 756 | spin_lock_irqsave(&bank->lock, flags); |
757 | retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type); | 757 | retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type); |
758 | if (retval == 0) { | 758 | if (retval == 0) { |
759 | irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK; | 759 | irq_desc[d->irq].status &= ~IRQ_TYPE_SENSE_MASK; |
760 | irq_desc[irq].status |= type; | 760 | irq_desc[d->irq].status |= type; |
761 | } | 761 | } |
762 | spin_unlock_irqrestore(&bank->lock, flags); | 762 | spin_unlock_irqrestore(&bank->lock, flags); |
763 | 763 | ||
764 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | 764 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
765 | __set_irq_handler_unlocked(irq, handle_level_irq); | 765 | __set_irq_handler_unlocked(d->irq, handle_level_irq); |
766 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 766 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
767 | __set_irq_handler_unlocked(irq, handle_edge_irq); | 767 | __set_irq_handler_unlocked(d->irq, handle_edge_irq); |
768 | 768 | ||
769 | return retval; | 769 | return retval; |
770 | } | 770 | } |
@@ -1021,15 +1021,15 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 1023 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
1024 | static int gpio_wake_enable(unsigned int irq, unsigned int enable) | 1024 | static int gpio_wake_enable(struct irq_data *d, unsigned int enable) |
1025 | { | 1025 | { |
1026 | unsigned int gpio = irq - IH_GPIO_BASE; | 1026 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1027 | struct gpio_bank *bank; | 1027 | struct gpio_bank *bank; |
1028 | int retval; | 1028 | int retval; |
1029 | 1029 | ||
1030 | if (check_gpio(gpio) < 0) | 1030 | if (check_gpio(gpio) < 0) |
1031 | return -ENODEV; | 1031 | return -ENODEV; |
1032 | bank = get_irq_chip_data(irq); | 1032 | bank = irq_data_get_irq_chip_data(d); |
1033 | retval = _set_gpio_wakeup(bank, get_gpio_index(gpio), enable); | 1033 | retval = _set_gpio_wakeup(bank, get_gpio_index(gpio), enable); |
1034 | 1034 | ||
1035 | return retval; | 1035 | return retval; |
@@ -1142,7 +1142,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1142 | u32 retrigger = 0; | 1142 | u32 retrigger = 0; |
1143 | int unmasked = 0; | 1143 | int unmasked = 0; |
1144 | 1144 | ||
1145 | desc->chip->ack(irq); | 1145 | desc->irq_data.chip->irq_ack(&desc->irq_data); |
1146 | 1146 | ||
1147 | bank = get_irq_data(irq); | 1147 | bank = get_irq_data(irq); |
1148 | #ifdef CONFIG_ARCH_OMAP1 | 1148 | #ifdef CONFIG_ARCH_OMAP1 |
@@ -1199,7 +1199,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1199 | configured, we could unmask GPIO bank interrupt immediately */ | 1199 | configured, we could unmask GPIO bank interrupt immediately */ |
1200 | if (!level_mask && !unmasked) { | 1200 | if (!level_mask && !unmasked) { |
1201 | unmasked = 1; | 1201 | unmasked = 1; |
1202 | desc->chip->unmask(irq); | 1202 | desc->irq_data.chip->irq_unmask(&desc->irq_data); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | isr |= retrigger; | 1205 | isr |= retrigger; |
@@ -1235,41 +1235,40 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1235 | interrupt */ | 1235 | interrupt */ |
1236 | exit: | 1236 | exit: |
1237 | if (!unmasked) | 1237 | if (!unmasked) |
1238 | desc->chip->unmask(irq); | 1238 | desc->irq_data.chip->irq_unmask(&desc->irq_data); |
1239 | |||
1240 | } | 1239 | } |
1241 | 1240 | ||
1242 | static void gpio_irq_shutdown(unsigned int irq) | 1241 | static void gpio_irq_shutdown(struct irq_data *d) |
1243 | { | 1242 | { |
1244 | unsigned int gpio = irq - IH_GPIO_BASE; | 1243 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1245 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1244 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1246 | 1245 | ||
1247 | _reset_gpio(bank, gpio); | 1246 | _reset_gpio(bank, gpio); |
1248 | } | 1247 | } |
1249 | 1248 | ||
1250 | static void gpio_ack_irq(unsigned int irq) | 1249 | static void gpio_ack_irq(struct irq_data *d) |
1251 | { | 1250 | { |
1252 | unsigned int gpio = irq - IH_GPIO_BASE; | 1251 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1253 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1252 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1254 | 1253 | ||
1255 | _clear_gpio_irqstatus(bank, gpio); | 1254 | _clear_gpio_irqstatus(bank, gpio); |
1256 | } | 1255 | } |
1257 | 1256 | ||
1258 | static void gpio_mask_irq(unsigned int irq) | 1257 | static void gpio_mask_irq(struct irq_data *d) |
1259 | { | 1258 | { |
1260 | unsigned int gpio = irq - IH_GPIO_BASE; | 1259 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1261 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1260 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1262 | 1261 | ||
1263 | _set_gpio_irqenable(bank, gpio, 0); | 1262 | _set_gpio_irqenable(bank, gpio, 0); |
1264 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 1263 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); |
1265 | } | 1264 | } |
1266 | 1265 | ||
1267 | static void gpio_unmask_irq(unsigned int irq) | 1266 | static void gpio_unmask_irq(struct irq_data *d) |
1268 | { | 1267 | { |
1269 | unsigned int gpio = irq - IH_GPIO_BASE; | 1268 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1270 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1269 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1271 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1270 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
1272 | struct irq_desc *desc = irq_to_desc(irq); | 1271 | struct irq_desc *desc = irq_to_desc(d->irq); |
1273 | u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK; | 1272 | u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK; |
1274 | 1273 | ||
1275 | if (trigger) | 1274 | if (trigger) |
@@ -1287,12 +1286,12 @@ static void gpio_unmask_irq(unsigned int irq) | |||
1287 | 1286 | ||
1288 | static struct irq_chip gpio_irq_chip = { | 1287 | static struct irq_chip gpio_irq_chip = { |
1289 | .name = "GPIO", | 1288 | .name = "GPIO", |
1290 | .shutdown = gpio_irq_shutdown, | 1289 | .irq_shutdown = gpio_irq_shutdown, |
1291 | .ack = gpio_ack_irq, | 1290 | .irq_ack = gpio_ack_irq, |
1292 | .mask = gpio_mask_irq, | 1291 | .irq_mask = gpio_mask_irq, |
1293 | .unmask = gpio_unmask_irq, | 1292 | .irq_unmask = gpio_unmask_irq, |
1294 | .set_type = gpio_irq_type, | 1293 | .irq_set_type = gpio_irq_type, |
1295 | .set_wake = gpio_wake_enable, | 1294 | .irq_set_wake = gpio_wake_enable, |
1296 | }; | 1295 | }; |
1297 | 1296 | ||
1298 | /*---------------------------------------------------------------------*/ | 1297 | /*---------------------------------------------------------------------*/ |
@@ -1301,36 +1300,36 @@ static struct irq_chip gpio_irq_chip = { | |||
1301 | 1300 | ||
1302 | /* MPUIO uses the always-on 32k clock */ | 1301 | /* MPUIO uses the always-on 32k clock */ |
1303 | 1302 | ||
1304 | static void mpuio_ack_irq(unsigned int irq) | 1303 | static void mpuio_ack_irq(struct irq_data *d) |
1305 | { | 1304 | { |
1306 | /* The ISR is reset automatically, so do nothing here. */ | 1305 | /* The ISR is reset automatically, so do nothing here. */ |
1307 | } | 1306 | } |
1308 | 1307 | ||
1309 | static void mpuio_mask_irq(unsigned int irq) | 1308 | static void mpuio_mask_irq(struct irq_data *d) |
1310 | { | 1309 | { |
1311 | unsigned int gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); | 1310 | unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE); |
1312 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1311 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1313 | 1312 | ||
1314 | _set_gpio_irqenable(bank, gpio, 0); | 1313 | _set_gpio_irqenable(bank, gpio, 0); |
1315 | } | 1314 | } |
1316 | 1315 | ||
1317 | static void mpuio_unmask_irq(unsigned int irq) | 1316 | static void mpuio_unmask_irq(struct irq_data *d) |
1318 | { | 1317 | { |
1319 | unsigned int gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); | 1318 | unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE); |
1320 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1319 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1321 | 1320 | ||
1322 | _set_gpio_irqenable(bank, gpio, 1); | 1321 | _set_gpio_irqenable(bank, gpio, 1); |
1323 | } | 1322 | } |
1324 | 1323 | ||
1325 | static struct irq_chip mpuio_irq_chip = { | 1324 | static struct irq_chip mpuio_irq_chip = { |
1326 | .name = "MPUIO", | 1325 | .name = "MPUIO", |
1327 | .ack = mpuio_ack_irq, | 1326 | .irq_ack = mpuio_ack_irq, |
1328 | .mask = mpuio_mask_irq, | 1327 | .irq_mask = mpuio_mask_irq, |
1329 | .unmask = mpuio_unmask_irq, | 1328 | .irq_unmask = mpuio_unmask_irq, |
1330 | .set_type = gpio_irq_type, | 1329 | .irq_set_type = gpio_irq_type, |
1331 | #ifdef CONFIG_ARCH_OMAP16XX | 1330 | #ifdef CONFIG_ARCH_OMAP16XX |
1332 | /* REVISIT: assuming only 16xx supports MPUIO wake events */ | 1331 | /* REVISIT: assuming only 16xx supports MPUIO wake events */ |
1333 | .set_wake = gpio_wake_enable, | 1332 | .irq_set_wake = gpio_wake_enable, |
1334 | #endif | 1333 | #endif |
1335 | }; | 1334 | }; |
1336 | 1335 | ||