aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/spitz.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r--arch/arm/mach-pxa/spitz.c62
1 files changed, 6 insertions, 56 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index dda310fe71c8..da85327e630c 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -378,45 +378,6 @@ static inline void spitz_init_spi(void) {}
378 * The card detect interrupt isn't debounced so we delay it by 250ms 378 * The card detect interrupt isn't debounced so we delay it by 250ms
379 * to give the card a chance to fully insert/eject. 379 * to give the card a chance to fully insert/eject.
380 */ 380 */
381
382static struct pxamci_platform_data spitz_mci_platform_data;
383
384static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data)
385{
386 int err;
387
388 err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT");
389 if (err)
390 goto err_out;
391
392 err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP");
393 if (err)
394 goto err_free_1;
395
396 gpio_direction_input(SPITZ_GPIO_nSD_DETECT);
397 gpio_direction_input(SPITZ_GPIO_nSD_WP);
398
399 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
400
401 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
402 IRQF_DISABLED | IRQF_TRIGGER_RISING |
403 IRQF_TRIGGER_FALLING,
404 "MMC card detect", data);
405 if (err) {
406 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
407 __func__);
408 goto err_free_2;
409 }
410 return 0;
411
412err_free_2:
413 gpio_free(SPITZ_GPIO_nSD_WP);
414err_free_1:
415 gpio_free(SPITZ_GPIO_nSD_DETECT);
416err_out:
417 return err;
418}
419
420static void spitz_mci_setpower(struct device *dev, unsigned int vdd) 381static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
421{ 382{
422 struct pxamci_platform_data* p_d = dev->platform_data; 383 struct pxamci_platform_data* p_d = dev->platform_data;
@@ -427,24 +388,12 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
427 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); 388 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
428} 389}
429 390
430static int spitz_mci_get_ro(struct device *dev)
431{
432 return gpio_get_value(SPITZ_GPIO_nSD_WP);
433}
434
435static void spitz_mci_exit(struct device *dev, void *data)
436{
437 free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
438 gpio_free(SPITZ_GPIO_nSD_WP);
439 gpio_free(SPITZ_GPIO_nSD_DETECT);
440}
441
442static struct pxamci_platform_data spitz_mci_platform_data = { 391static struct pxamci_platform_data spitz_mci_platform_data = {
443 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 392 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
444 .init = spitz_mci_init, 393 .setpower = spitz_mci_setpower,
445 .get_ro = spitz_mci_get_ro, 394 .gpio_card_detect = SPITZ_GPIO_nSD_DETECT,
446 .setpower = spitz_mci_setpower, 395 .gpio_card_ro = SPITZ_GPIO_nSD_WP,
447 .exit = spitz_mci_exit, 396 .gpio_power = -1,
448}; 397};
449 398
450 399
@@ -695,6 +644,7 @@ static void __init common_init(void)
695 spitz_init_spi(); 644 spitz_init_spi();
696 645
697 platform_add_devices(devices, ARRAY_SIZE(devices)); 646 platform_add_devices(devices, ARRAY_SIZE(devices));
647 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
698 pxa_set_mci_info(&spitz_mci_platform_data); 648 pxa_set_mci_info(&spitz_mci_platform_data);
699 pxa_set_ohci_info(&spitz_ohci_platform_data); 649 pxa_set_ohci_info(&spitz_ohci_platform_data);
700 pxa_set_ficp_info(&spitz_ficp_platform_data); 650 pxa_set_ficp_info(&spitz_ficp_platform_data);