diff options
| author | Roland Stigge <stigge@antcom.de> | 2012-06-20 10:33:52 -0400 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2012-07-12 07:40:17 -0400 |
| commit | 0bdfeddc49a80eeb4544ae50b46db7ed695accb8 (patch) | |
| tree | 67e9589bd68befe81b08ca65f94714f8026e3edc /drivers | |
| parent | 0c65ddd460086084079eeeb14d062c9a0c437ca0 (diff) | |
gpio: gpio-lpc32xx: Add gpio_to_irq mapping
This patch helps mapping with gpio_to_irq for the GPIOs that are irq enabled.
Signed-off-by: Roland Stigge <stigge@antcom.de>
Tested-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpio/gpio-lpc32xx.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index c8c2a513ba84..8a420f13905e 100644 --- a/drivers/gpio/gpio-lpc32xx.c +++ b/drivers/gpio/gpio-lpc32xx.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
| 29 | #include <mach/platform.h> | 29 | #include <mach/platform.h> |
| 30 | #include <mach/gpio-lpc32xx.h> | 30 | #include <mach/gpio-lpc32xx.h> |
| 31 | #include <mach/irqs.h> | ||
| 31 | 32 | ||
| 32 | #define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) | 33 | #define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) |
| 33 | #define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) | 34 | #define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) |
| @@ -367,6 +368,66 @@ static int lpc32xx_gpio_request(struct gpio_chip *chip, unsigned pin) | |||
| 367 | return -EINVAL; | 368 | return -EINVAL; |
| 368 | } | 369 | } |
| 369 | 370 | ||
| 371 | static int lpc32xx_gpio_to_irq_p01(struct gpio_chip *chip, unsigned offset) | ||
| 372 | { | ||
| 373 | return IRQ_LPC32XX_P0_P1_IRQ; | ||
| 374 | } | ||
| 375 | |||
| 376 | static const char lpc32xx_gpio_to_irq_gpio_p3_table[] = { | ||
| 377 | IRQ_LPC32XX_GPIO_00, | ||
| 378 | IRQ_LPC32XX_GPIO_01, | ||
| 379 | IRQ_LPC32XX_GPIO_02, | ||
| 380 | IRQ_LPC32XX_GPIO_03, | ||
| 381 | IRQ_LPC32XX_GPIO_04, | ||
| 382 | IRQ_LPC32XX_GPIO_05, | ||
| 383 | }; | ||
| 384 | |||
| 385 | static int lpc32xx_gpio_to_irq_gpio_p3(struct gpio_chip *chip, unsigned offset) | ||
| 386 | { | ||
| 387 | if (offset < ARRAY_SIZE(lpc32xx_gpio_to_irq_gpio_p3_table)) | ||
| 388 | return lpc32xx_gpio_to_irq_gpio_p3_table[offset]; | ||
| 389 | return -ENXIO; | ||
| 390 | } | ||
| 391 | |||
| 392 | static const char lpc32xx_gpio_to_irq_gpi_p3_table[] = { | ||
| 393 | IRQ_LPC32XX_GPI_00, | ||
| 394 | IRQ_LPC32XX_GPI_01, | ||
| 395 | IRQ_LPC32XX_GPI_02, | ||
| 396 | IRQ_LPC32XX_GPI_03, | ||
| 397 | IRQ_LPC32XX_GPI_04, | ||
| 398 | IRQ_LPC32XX_GPI_05, | ||
| 399 | IRQ_LPC32XX_GPI_06, | ||
| 400 | IRQ_LPC32XX_GPI_07, | ||
| 401 | IRQ_LPC32XX_GPI_08, | ||
| 402 | IRQ_LPC32XX_GPI_09, | ||
| 403 | -ENXIO, /* 10 */ | ||
| 404 | -ENXIO, /* 11 */ | ||
| 405 | -ENXIO, /* 12 */ | ||
| 406 | -ENXIO, /* 13 */ | ||
| 407 | -ENXIO, /* 14 */ | ||
| 408 | -ENXIO, /* 15 */ | ||
| 409 | -ENXIO, /* 16 */ | ||
| 410 | -ENXIO, /* 17 */ | ||
| 411 | -ENXIO, /* 18 */ | ||
| 412 | IRQ_LPC32XX_GPI_19, | ||
| 413 | -ENXIO, /* 20 */ | ||
| 414 | -ENXIO, /* 21 */ | ||
| 415 | -ENXIO, /* 22 */ | ||
| 416 | -ENXIO, /* 23 */ | ||
| 417 | -ENXIO, /* 24 */ | ||
| 418 | -ENXIO, /* 25 */ | ||
| 419 | -ENXIO, /* 26 */ | ||
| 420 | -ENXIO, /* 27 */ | ||
| 421 | IRQ_LPC32XX_GPI_28, | ||
| 422 | }; | ||
| 423 | |||
| 424 | static int lpc32xx_gpio_to_irq_gpi_p3(struct gpio_chip *chip, unsigned offset) | ||
| 425 | { | ||
| 426 | if (offset < ARRAY_SIZE(lpc32xx_gpio_to_irq_gpi_p3_table)) | ||
| 427 | return lpc32xx_gpio_to_irq_gpi_p3_table[offset]; | ||
| 428 | return -ENXIO; | ||
| 429 | } | ||
| 430 | |||
| 370 | static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { | 431 | static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { |
| 371 | { | 432 | { |
| 372 | .chip = { | 433 | .chip = { |
| @@ -376,6 +437,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { | |||
| 376 | .direction_output = lpc32xx_gpio_dir_output_p012, | 437 | .direction_output = lpc32xx_gpio_dir_output_p012, |
| 377 | .set = lpc32xx_gpio_set_value_p012, | 438 | .set = lpc32xx_gpio_set_value_p012, |
| 378 | .request = lpc32xx_gpio_request, | 439 | .request = lpc32xx_gpio_request, |
| 440 | .to_irq = lpc32xx_gpio_to_irq_p01, | ||
| 379 | .base = LPC32XX_GPIO_P0_GRP, | 441 | .base = LPC32XX_GPIO_P0_GRP, |
| 380 | .ngpio = LPC32XX_GPIO_P0_MAX, | 442 | .ngpio = LPC32XX_GPIO_P0_MAX, |
| 381 | .names = gpio_p0_names, | 443 | .names = gpio_p0_names, |
| @@ -391,6 +453,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { | |||
| 391 | .direction_output = lpc32xx_gpio_dir_output_p012, | 453 | .direction_output = lpc32xx_gpio_dir_output_p012, |
| 392 | .set = lpc32xx_gpio_set_value_p012, | 454 | .set = lpc32xx_gpio_set_value_p012, |
| 393 | .request = lpc32xx_gpio_request, | 455 | .request = lpc32xx_gpio_request, |
| 456 | .to_irq = lpc32xx_gpio_to_irq_p01, | ||
| 394 | .base = LPC32XX_GPIO_P1_GRP, | 457 | .base = LPC32XX_GPIO_P1_GRP, |
| 395 | .ngpio = LPC32XX_GPIO_P1_MAX, | 458 | .ngpio = LPC32XX_GPIO_P1_MAX, |
| 396 | .names = gpio_p1_names, | 459 | .names = gpio_p1_names, |
| @@ -421,6 +484,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { | |||
| 421 | .direction_output = lpc32xx_gpio_dir_output_p3, | 484 | .direction_output = lpc32xx_gpio_dir_output_p3, |
| 422 | .set = lpc32xx_gpio_set_value_p3, | 485 | .set = lpc32xx_gpio_set_value_p3, |
| 423 | .request = lpc32xx_gpio_request, | 486 | .request = lpc32xx_gpio_request, |
| 487 | .to_irq = lpc32xx_gpio_to_irq_gpio_p3, | ||
| 424 | .base = LPC32XX_GPIO_P3_GRP, | 488 | .base = LPC32XX_GPIO_P3_GRP, |
| 425 | .ngpio = LPC32XX_GPIO_P3_MAX, | 489 | .ngpio = LPC32XX_GPIO_P3_MAX, |
| 426 | .names = gpio_p3_names, | 490 | .names = gpio_p3_names, |
| @@ -434,6 +498,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { | |||
| 434 | .direction_input = lpc32xx_gpio_dir_in_always, | 498 | .direction_input = lpc32xx_gpio_dir_in_always, |
| 435 | .get = lpc32xx_gpi_get_value, | 499 | .get = lpc32xx_gpi_get_value, |
| 436 | .request = lpc32xx_gpio_request, | 500 | .request = lpc32xx_gpio_request, |
| 501 | .to_irq = lpc32xx_gpio_to_irq_gpi_p3, | ||
| 437 | .base = LPC32XX_GPI_P3_GRP, | 502 | .base = LPC32XX_GPI_P3_GRP, |
| 438 | .ngpio = LPC32XX_GPI_P3_MAX, | 503 | .ngpio = LPC32XX_GPI_P3_MAX, |
| 439 | .names = gpi_p3_names, | 504 | .names = gpi_p3_names, |
