diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-08-26 21:16:30 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-23 17:04:35 -0400 |
commit | 9d7087527f51c4eb7f30f0a9a3ad514e76bde3fd (patch) | |
tree | fe0f0d460d85fc55cd257a543a6bac957eba71c3 /arch | |
parent | 9ee40d9acf928ef561d655e78cf6c97546b8b4fc (diff) |
[ARM] pxa/corgi: convert to use new GPIO API
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 79 |
1 files changed, 61 insertions, 18 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index e703a8d209e2..6aff30615b30 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
22 | #include <linux/pm.h> | 22 | #include <linux/pm.h> |
23 | #include <linux/gpio.h> | ||
23 | #include <linux/backlight.h> | 24 | #include <linux/backlight.h> |
24 | #include <video/w100fb.h> | 25 | #include <video/w100fb.h> |
25 | 26 | ||
@@ -414,17 +415,43 @@ static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, vo | |||
414 | /* setup GPIO for PXA25x MMC controller */ | 415 | /* setup GPIO for PXA25x MMC controller */ |
415 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | 416 | pxa_gpio_mode(GPIO6_MMCCLK_MD); |
416 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | 417 | pxa_gpio_mode(GPIO8_MMCCS0_MD); |
417 | pxa_gpio_mode(CORGI_GPIO_nSD_DETECT | GPIO_IN); | ||
418 | pxa_gpio_mode(CORGI_GPIO_SD_PWR | GPIO_OUT); | ||
419 | 418 | ||
420 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 419 | err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT"); |
420 | if (err) | ||
421 | goto err_out; | ||
421 | 422 | ||
422 | err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, | 423 | err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP"); |
423 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
424 | "MMC card detect", data); | ||
425 | if (err) | 424 | if (err) |
426 | printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 425 | goto err_free_1; |
426 | |||
427 | err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR"); | ||
428 | if (err) | ||
429 | goto err_free_2; | ||
430 | |||
431 | gpio_direction_input(CORGI_GPIO_nSD_DETECT); | ||
432 | gpio_direction_input(CORGI_GPIO_nSD_WP); | ||
433 | gpio_direction_output(CORGI_GPIO_SD_PWR, 0); | ||
427 | 434 | ||
435 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
436 | |||
437 | err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, | ||
438 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
439 | IRQF_TRIGGER_FALLING, | ||
440 | "MMC card detect", data); | ||
441 | if (err) { | ||
442 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
443 | __func__); | ||
444 | goto err_free_3; | ||
445 | } | ||
446 | return 0; | ||
447 | |||
448 | err_free_3: | ||
449 | gpio_free(CORGI_GPIO_SD_PWR); | ||
450 | err_free_2: | ||
451 | gpio_free(CORGI_GPIO_nSD_WP); | ||
452 | err_free_1: | ||
453 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
454 | err_out: | ||
428 | return err; | 455 | return err; |
429 | } | 456 | } |
430 | 457 | ||
@@ -432,20 +459,20 @@ static void corgi_mci_setpower(struct device *dev, unsigned int vdd) | |||
432 | { | 459 | { |
433 | struct pxamci_platform_data* p_d = dev->platform_data; | 460 | struct pxamci_platform_data* p_d = dev->platform_data; |
434 | 461 | ||
435 | if (( 1 << vdd) & p_d->ocr_mask) | 462 | gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask)); |
436 | GPSR1 = GPIO_bit(CORGI_GPIO_SD_PWR); | ||
437 | else | ||
438 | GPCR1 = GPIO_bit(CORGI_GPIO_SD_PWR); | ||
439 | } | 463 | } |
440 | 464 | ||
441 | static int corgi_mci_get_ro(struct device *dev) | 465 | static int corgi_mci_get_ro(struct device *dev) |
442 | { | 466 | { |
443 | return GPLR(CORGI_GPIO_nSD_WP) & GPIO_bit(CORGI_GPIO_nSD_WP); | 467 | return gpio_get_value(CORGI_GPIO_nSD_WP); |
444 | } | 468 | } |
445 | 469 | ||
446 | static void corgi_mci_exit(struct device *dev, void *data) | 470 | static void corgi_mci_exit(struct device *dev, void *data) |
447 | { | 471 | { |
448 | free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); | 472 | free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); |
473 | gpio_free(CORGI_GPIO_SD_PWR); | ||
474 | gpio_free(CORGI_GPIO_nSD_WP); | ||
475 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
449 | } | 476 | } |
450 | 477 | ||
451 | static struct pxamci_platform_data corgi_mci_platform_data = { | 478 | static struct pxamci_platform_data corgi_mci_platform_data = { |
@@ -462,16 +489,32 @@ static struct pxamci_platform_data corgi_mci_platform_data = { | |||
462 | */ | 489 | */ |
463 | static void corgi_irda_transceiver_mode(struct device *dev, int mode) | 490 | static void corgi_irda_transceiver_mode(struct device *dev, int mode) |
464 | { | 491 | { |
465 | if (mode & IR_OFF) | 492 | gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF); |
466 | GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); | ||
467 | else | ||
468 | GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); | ||
469 | pxa2xx_transceiver_mode(dev, mode); | 493 | pxa2xx_transceiver_mode(dev, mode); |
470 | } | 494 | } |
471 | 495 | ||
496 | static int corgi_irda_startup(struct device *dev) | ||
497 | { | ||
498 | int err; | ||
499 | |||
500 | err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON"); | ||
501 | if (err) | ||
502 | return err; | ||
503 | |||
504 | gpio_direction_output(CORGI_GPIO_IR_ON, 1); | ||
505 | return 0; | ||
506 | } | ||
507 | |||
508 | static void corgi_irda_shutdown(struct device *dev) | ||
509 | { | ||
510 | gpio_free(CORGI_GPIO_IR_ON); | ||
511 | } | ||
512 | |||
472 | static struct pxaficp_platform_data corgi_ficp_platform_data = { | 513 | static struct pxaficp_platform_data corgi_ficp_platform_data = { |
473 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 514 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
474 | .transceiver_mode = corgi_irda_transceiver_mode, | 515 | .transceiver_mode = corgi_irda_transceiver_mode, |
516 | .startup = corgi_irda_startup, | ||
517 | .shutdown = corgi_irda_shutdown, | ||
475 | }; | 518 | }; |
476 | 519 | ||
477 | 520 | ||