aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mx31moboard-devboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mx31moboard-devboard.c')
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 0a69a4f212a3..b3e8f251ac79 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -56,14 +56,40 @@ static int devboard_sdhc2_get_ro(struct device *dev)
56static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq, 56static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
57 void *data) 57 void *data)
58{ 58{
59 return request_irq(gpio_to_irq(SDHC2_CD), detect_irq, 59 int ret;
60
61 ret = gpio_request(SDHC2_CD, "sdhc-detect");
62 if (ret)
63 return ret;
64
65 gpio_direction_input(SDHC2_CD);
66
67 ret = gpio_request(SDHC2_WP, "sdhc-wp");
68 if (ret)
69 goto err_gpio_free;
70 gpio_direction_input(SDHC2_WP);
71
72 ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
60 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 73 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
61 "sdhc2-card-detect", data); 74 "sdhc2-card-detect", data);
75 if (ret)
76 goto err_gpio_free_2;
77
78 return 0;
79
80err_gpio_free_2:
81 gpio_free(SDHC2_WP);
82err_gpio_free:
83 gpio_free(SDHC2_CD);
84
85 return ret;
62} 86}
63 87
64static void devboard_sdhc2_exit(struct device *dev, void *data) 88static void devboard_sdhc2_exit(struct device *dev, void *data)
65{ 89{
66 free_irq(gpio_to_irq(SDHC2_CD), data); 90 free_irq(gpio_to_irq(SDHC2_CD), data);
91 gpio_free(SDHC2_WP);
92 gpio_free(SDHC2_CD);
67} 93}
68 94
69static struct imxmmc_platform_data sdhc2_pdata = { 95static struct imxmmc_platform_data sdhc2_pdata = {