aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2010-02-15 13:03:35 -0500
committerTony Lindgren <tony@atomide.com>2010-02-15 13:03:35 -0500
commitb702b1060ab1c29ac08b904a0c188c61cda880eb (patch)
treea7d18e224acae6fd13d84b72853d94848e04615f /drivers/mmc
parente0eb2424469ec2333885672d3db8bd07d322455d (diff)
omap_hsmmc: allow compile without regulator framework
It is still possible to use the omap_hsmmc module without the regulator framework. Accordingly, ifdef out regulator-specific functions. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c133
1 files changed, 79 insertions, 54 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index af374771bed0..83f0affadcae 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -236,6 +236,8 @@ static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
236 236
237#endif 237#endif
238 238
239#ifdef CONFIG_REGULATOR
240
239static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on, 241static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on,
240 int vdd) 242 int vdd)
241{ 243{
@@ -357,59 +359,6 @@ static int omap_hsmmc_23_set_sleep(struct device *dev, int slot, int sleep,
357 return regulator_enable(host->vcc_aux); 359 return regulator_enable(host->vcc_aux);
358} 360}
359 361
360static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
361{
362 int ret;
363
364 if (gpio_is_valid(pdata->slots[0].switch_pin)) {
365 pdata->suspend = omap_hsmmc_suspend_cdirq;
366 pdata->resume = omap_hsmmc_resume_cdirq;
367 if (pdata->slots[0].cover)
368 pdata->slots[0].get_cover_state =
369 omap_hsmmc_get_cover_state;
370 else
371 pdata->slots[0].card_detect = omap_hsmmc_card_detect;
372 pdata->slots[0].card_detect_irq =
373 gpio_to_irq(pdata->slots[0].switch_pin);
374 ret = gpio_request(pdata->slots[0].switch_pin, "mmc_cd");
375 if (ret)
376 return ret;
377 ret = gpio_direction_input(pdata->slots[0].switch_pin);
378 if (ret)
379 goto err_free_sp;
380 } else
381 pdata->slots[0].switch_pin = -EINVAL;
382
383 if (gpio_is_valid(pdata->slots[0].gpio_wp)) {
384 pdata->slots[0].get_ro = omap_hsmmc_get_wp;
385 ret = gpio_request(pdata->slots[0].gpio_wp, "mmc_wp");
386 if (ret)
387 goto err_free_cd;
388 ret = gpio_direction_input(pdata->slots[0].gpio_wp);
389 if (ret)
390 goto err_free_wp;
391 } else
392 pdata->slots[0].gpio_wp = -EINVAL;
393
394 return 0;
395
396err_free_wp:
397 gpio_free(pdata->slots[0].gpio_wp);
398err_free_cd:
399 if (gpio_is_valid(pdata->slots[0].switch_pin))
400err_free_sp:
401 gpio_free(pdata->slots[0].switch_pin);
402 return ret;
403}
404
405static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
406{
407 if (gpio_is_valid(pdata->slots[0].gpio_wp))
408 gpio_free(pdata->slots[0].gpio_wp);
409 if (gpio_is_valid(pdata->slots[0].switch_pin))
410 gpio_free(pdata->slots[0].switch_pin);
411}
412
413static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) 362static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
414{ 363{
415 struct regulator *reg; 364 struct regulator *reg;
@@ -488,6 +437,82 @@ static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
488 mmc_slot(host).set_sleep = NULL; 437 mmc_slot(host).set_sleep = NULL;
489} 438}
490 439
440static inline int omap_hsmmc_have_reg(void)
441{
442 return 1;
443}
444
445#else
446
447static inline int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
448{
449 return -EINVAL;
450}
451
452static inline void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
453{
454}
455
456static inline int omap_hsmmc_have_reg(void)
457{
458 return 0;
459}
460
461#endif
462
463static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
464{
465 int ret;
466
467 if (gpio_is_valid(pdata->slots[0].switch_pin)) {
468 pdata->suspend = omap_hsmmc_suspend_cdirq;
469 pdata->resume = omap_hsmmc_resume_cdirq;
470 if (pdata->slots[0].cover)
471 pdata->slots[0].get_cover_state =
472 omap_hsmmc_get_cover_state;
473 else
474 pdata->slots[0].card_detect = omap_hsmmc_card_detect;
475 pdata->slots[0].card_detect_irq =
476 gpio_to_irq(pdata->slots[0].switch_pin);
477 ret = gpio_request(pdata->slots[0].switch_pin, "mmc_cd");
478 if (ret)
479 return ret;
480 ret = gpio_direction_input(pdata->slots[0].switch_pin);
481 if (ret)
482 goto err_free_sp;
483 } else
484 pdata->slots[0].switch_pin = -EINVAL;
485
486 if (gpio_is_valid(pdata->slots[0].gpio_wp)) {
487 pdata->slots[0].get_ro = omap_hsmmc_get_wp;
488 ret = gpio_request(pdata->slots[0].gpio_wp, "mmc_wp");
489 if (ret)
490 goto err_free_cd;
491 ret = gpio_direction_input(pdata->slots[0].gpio_wp);
492 if (ret)
493 goto err_free_wp;
494 } else
495 pdata->slots[0].gpio_wp = -EINVAL;
496
497 return 0;
498
499err_free_wp:
500 gpio_free(pdata->slots[0].gpio_wp);
501err_free_cd:
502 if (gpio_is_valid(pdata->slots[0].switch_pin))
503err_free_sp:
504 gpio_free(pdata->slots[0].switch_pin);
505 return ret;
506}
507
508static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
509{
510 if (gpio_is_valid(pdata->slots[0].gpio_wp))
511 gpio_free(pdata->slots[0].gpio_wp);
512 if (gpio_is_valid(pdata->slots[0].switch_pin))
513 gpio_free(pdata->slots[0].switch_pin);
514}
515
491/* 516/*
492 * Stop clock to the card 517 * Stop clock to the card
493 */ 518 */
@@ -2119,7 +2144,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
2119 } 2144 }
2120 } 2145 }
2121 2146
2122 if (!mmc_slot(host).set_power) { 2147 if (omap_hsmmc_have_reg() && !mmc_slot(host).set_power) {
2123 ret = omap_hsmmc_reg_get(host); 2148 ret = omap_hsmmc_reg_get(host);
2124 if (ret) 2149 if (ret)
2125 goto err_reg; 2150 goto err_reg;