diff options
Diffstat (limited to 'arch/arm/mach-pxa/mioa701.c')
-rw-r--r-- | arch/arm/mach-pxa/mioa701.c | 84 |
1 files changed, 15 insertions, 69 deletions
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 2d28132c725b..3cab452e5567 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -434,72 +434,15 @@ struct gpio_vbus_mach_info gpio_vbus_data = { | |||
434 | /* | 434 | /* |
435 | * SDIO/MMC Card controller | 435 | * SDIO/MMC Card controller |
436 | */ | 436 | */ |
437 | static void mci_setpower(struct device *dev, unsigned int vdd) | ||
438 | { | ||
439 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
440 | |||
441 | if ((1 << vdd) & p_d->ocr_mask) | ||
442 | gpio_set_value(GPIO91_SDIO_EN, 1); /* enable SDIO power */ | ||
443 | else | ||
444 | gpio_set_value(GPIO91_SDIO_EN, 0); /* disable SDIO power */ | ||
445 | } | ||
446 | |||
447 | static int mci_get_ro(struct device *dev) | ||
448 | { | ||
449 | return gpio_get_value(GPIO78_SDIO_RO); | ||
450 | } | ||
451 | |||
452 | struct gpio_ress mci_gpios[] = { | ||
453 | MIO_GPIO_IN(GPIO78_SDIO_RO, "SDIO readonly detect"), | ||
454 | MIO_GPIO_IN(GPIO15_SDIO_INSERT, "SDIO insertion detect"), | ||
455 | MIO_GPIO_OUT(GPIO91_SDIO_EN, 0, "SDIO power enable") | ||
456 | }; | ||
457 | |||
458 | static void mci_exit(struct device *dev, void *data) | ||
459 | { | ||
460 | mio_gpio_free(ARRAY_AND_SIZE(mci_gpios)); | ||
461 | free_irq(gpio_to_irq(GPIO15_SDIO_INSERT), data); | ||
462 | } | ||
463 | |||
464 | static struct pxamci_platform_data mioa701_mci_info; | ||
465 | |||
466 | /** | 437 | /** |
467 | * The card detect interrupt isn't debounced so we delay it by 250ms | 438 | * The card detect interrupt isn't debounced so we delay it by 250ms |
468 | * to give the card a chance to fully insert/eject. | 439 | * to give the card a chance to fully insert/eject. |
469 | */ | 440 | */ |
470 | static int mci_init(struct device *dev, irq_handler_t detect_int, void *data) | ||
471 | { | ||
472 | int rc; | ||
473 | int irq = gpio_to_irq(GPIO15_SDIO_INSERT); | ||
474 | |||
475 | rc = mio_gpio_request(ARRAY_AND_SIZE(mci_gpios)); | ||
476 | if (rc) | ||
477 | goto err_gpio; | ||
478 | /* enable RE/FE interrupt on card insertion and removal */ | ||
479 | rc = request_irq(irq, detect_int, | ||
480 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
481 | IRQF_TRIGGER_FALLING, | ||
482 | "MMC card detect", data); | ||
483 | if (rc) | ||
484 | goto err_irq; | ||
485 | |||
486 | mioa701_mci_info.detect_delay = msecs_to_jiffies(250); | ||
487 | return 0; | ||
488 | |||
489 | err_irq: | ||
490 | dev_err(dev, "mioa701_mci_init: MMC/SD:" | ||
491 | " can't request MMC card detect IRQ\n"); | ||
492 | mio_gpio_free(ARRAY_AND_SIZE(mci_gpios)); | ||
493 | err_gpio: | ||
494 | return rc; | ||
495 | } | ||
496 | |||
497 | static struct pxamci_platform_data mioa701_mci_info = { | 441 | static struct pxamci_platform_data mioa701_mci_info = { |
498 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 442 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
499 | .init = mci_init, | 443 | .gpio_card_detect = GPIO15_SDIO_INSERT, |
500 | .get_ro = mci_get_ro, | 444 | .gpio_card_ro = GPIO78_SDIO_RO, |
501 | .setpower = mci_setpower, | 445 | .gpio_power = GPIO91_SDIO_EN, |
502 | .exit = mci_exit, | ||
503 | }; | 446 | }; |
504 | 447 | ||
505 | /* FlashRAM */ | 448 | /* FlashRAM */ |
@@ -765,19 +708,20 @@ static struct i2c_board_info __initdata mioa701_pi2c_devices[] = { | |||
765 | }, | 708 | }, |
766 | }; | 709 | }; |
767 | 710 | ||
768 | static struct soc_camera_link iclink = { | ||
769 | .bus_id = 0, /* Must match id in pxa27x_device_camera in device.c */ | ||
770 | }; | ||
771 | |||
772 | /* Board I2C devices. */ | 711 | /* Board I2C devices. */ |
773 | static struct i2c_board_info __initdata mioa701_i2c_devices[] = { | 712 | static struct i2c_board_info __initdata mioa701_i2c_devices[] = { |
774 | { | 713 | { |
775 | /* Must initialize before the camera(s) */ | ||
776 | I2C_BOARD_INFO("mt9m111", 0x5d), | 714 | I2C_BOARD_INFO("mt9m111", 0x5d), |
777 | .platform_data = &iclink, | ||
778 | }, | 715 | }, |
779 | }; | 716 | }; |
780 | 717 | ||
718 | static struct soc_camera_link iclink = { | ||
719 | .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ | ||
720 | .board_info = &mioa701_i2c_devices[0], | ||
721 | .i2c_adapter_id = 0, | ||
722 | .module_name = "mt9m111", | ||
723 | }; | ||
724 | |||
781 | struct i2c_pxa_platform_data i2c_pdata = { | 725 | struct i2c_pxa_platform_data i2c_pdata = { |
782 | .fast_mode = 1, | 726 | .fast_mode = 1, |
783 | }; | 727 | }; |
@@ -811,6 +755,7 @@ MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) | |||
811 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) | 755 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) |
812 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) | 756 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) |
813 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); | 757 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); |
758 | MIO_SIMPLE_DEV(mioa701_camera, "soc-camera-pdrv",&iclink); | ||
814 | 759 | ||
815 | static struct platform_device *devices[] __initdata = { | 760 | static struct platform_device *devices[] __initdata = { |
816 | &mioa701_gpio_keys, | 761 | &mioa701_gpio_keys, |
@@ -821,6 +766,7 @@ static struct platform_device *devices[] __initdata = { | |||
821 | &power_dev, | 766 | &power_dev, |
822 | &strataflash, | 767 | &strataflash, |
823 | &gpio_vbus, | 768 | &gpio_vbus, |
769 | &mioa701_camera, | ||
824 | &mioa701_board, | 770 | &mioa701_board, |
825 | }; | 771 | }; |
826 | 772 | ||
@@ -841,7 +787,7 @@ static void mioa701_restart(char c, const char *cmd) | |||
841 | static struct gpio_ress global_gpios[] = { | 787 | static struct gpio_ress global_gpios[] = { |
842 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), | 788 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), |
843 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), | 789 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), |
844 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power") | 790 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power"), |
845 | }; | 791 | }; |
846 | 792 | ||
847 | static void __init mioa701_machine_init(void) | 793 | static void __init mioa701_machine_init(void) |
@@ -855,6 +801,7 @@ static void __init mioa701_machine_init(void) | |||
855 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); | 801 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); |
856 | bootstrap_init(); | 802 | bootstrap_init(); |
857 | set_pxa_fb_info(&mioa701_pxafb_info); | 803 | set_pxa_fb_info(&mioa701_pxafb_info); |
804 | mioa701_mci_info.detect_delay = msecs_to_jiffies(250); | ||
858 | pxa_set_mci_info(&mioa701_mci_info); | 805 | pxa_set_mci_info(&mioa701_mci_info); |
859 | pxa_set_keypad_info(&mioa701_keypad_info); | 806 | pxa_set_keypad_info(&mioa701_keypad_info); |
860 | wm97xx_bat_set_pdata(&mioa701_battery_data); | 807 | wm97xx_bat_set_pdata(&mioa701_battery_data); |
@@ -869,7 +816,6 @@ static void __init mioa701_machine_init(void) | |||
869 | pxa_set_i2c_info(&i2c_pdata); | 816 | pxa_set_i2c_info(&i2c_pdata); |
870 | pxa27x_set_i2c_power_info(NULL); | 817 | pxa27x_set_i2c_power_info(NULL); |
871 | pxa_set_camera_info(&mioa701_pxacamera_platform_data); | 818 | pxa_set_camera_info(&mioa701_pxacamera_platform_data); |
872 | i2c_register_board_info(0, ARRAY_AND_SIZE(mioa701_i2c_devices)); | ||
873 | } | 819 | } |
874 | 820 | ||
875 | static void mioa701_machine_exit(void) | 821 | static void mioa701_machine_exit(void) |