aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cm-x300.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r--arch/arm/mach-pxa/cm-x300.c71
1 files changed, 12 insertions, 59 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 465da26591bd..aac2cda60e09 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -306,68 +306,21 @@ static void cm_x300_mci_exit(struct device *dev, void *data)
306} 306}
307 307
308static struct pxamci_platform_data cm_x300_mci_platform_data = { 308static struct pxamci_platform_data cm_x300_mci_platform_data = {
309 .detect_delay = 20, 309 .detect_delay = 20,
310 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 310 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
311 .init = cm_x300_mci_init, 311 .init = cm_x300_mci_init,
312 .exit = cm_x300_mci_exit, 312 .exit = cm_x300_mci_exit,
313 .gpio_card_detect = -1,
314 .gpio_card_ro = -1,
315 .gpio_power = -1,
313}; 316};
314 317
315static int cm_x300_mci2_ro(struct device *dev)
316{
317 return gpio_get_value(GPIO85_MMC2_WP);
318}
319
320static int cm_x300_mci2_init(struct device *dev,
321 irq_handler_t cm_x300_detect_int,
322 void *data)
323{
324 int err;
325
326 /*
327 * setup GPIO for CM-X300 MMC controller
328 */
329 err = gpio_request(GPIO82_MMC2_IRQ, "mmc card detect");
330 if (err)
331 goto err_request_cd;
332 gpio_direction_input(GPIO82_MMC2_IRQ);
333
334 err = gpio_request(GPIO85_MMC2_WP, "mmc write protect");
335 if (err)
336 goto err_request_wp;
337 gpio_direction_input(GPIO85_MMC2_WP);
338
339 err = request_irq(CM_X300_MMC2_IRQ, cm_x300_detect_int,
340 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
341 "MMC card detect", data);
342 if (err) {
343 printk(KERN_ERR "%s: MMC/SD/SDIO: "
344 "can't request card detect IRQ\n", __func__);
345 goto err_request_irq;
346 }
347
348 return 0;
349
350err_request_irq:
351 gpio_free(GPIO85_MMC2_WP);
352err_request_wp:
353 gpio_free(GPIO82_MMC2_IRQ);
354err_request_cd:
355 return err;
356}
357
358static void cm_x300_mci2_exit(struct device *dev, void *data)
359{
360 free_irq(CM_X300_MMC2_IRQ, data);
361 gpio_free(GPIO82_MMC2_IRQ);
362 gpio_free(GPIO85_MMC2_WP);
363}
364
365static struct pxamci_platform_data cm_x300_mci2_platform_data = { 318static struct pxamci_platform_data cm_x300_mci2_platform_data = {
366 .detect_delay = 20, 319 .detect_delay = 20,
367 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 320 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
368 .init = cm_x300_mci2_init, 321 .gpio_card_detect = GPIO82_MMC2_IRQ,
369 .exit = cm_x300_mci2_exit, 322 .gpio_card_ro = GPIO85_MMC2_WP,
370 .get_ro = cm_x300_mci2_ro, 323 .gpio_power = -1,
371}; 324};
372 325
373static void __init cm_x300_init_mmc(void) 326static void __init cm_x300_init_mmc(void)