diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2012-08-08 00:15:20 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-09-04 13:58:20 -0400 |
commit | 7a8a43c46a4c91475ff93eb00897cbbc5ec98874 (patch) | |
tree | da27aaada296d4ead1485cc86f519210a803c090 | |
parent | c5e4a2e4c6fe47d88a1b172e54ed47a463f0ce45 (diff) |
mmc: bfin_sdh: Reset SD controller when resume from power saving mode.
Without reset, SD controller may stay in disable mode, SD card can't
be detected when resume from power saving mode.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/bfin_sdh.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index 7776614fb2a5..b9b463eca1ec 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c | |||
@@ -505,6 +505,23 @@ static irqreturn_t sdh_stat_irq(int irq, void *devid) | |||
505 | return IRQ_RETVAL(handled); | 505 | return IRQ_RETVAL(handled); |
506 | } | 506 | } |
507 | 507 | ||
508 | static void sdh_reset(void) | ||
509 | { | ||
510 | #if defined(CONFIG_BF54x) | ||
511 | /* Secure Digital Host shares DMA with Nand controller */ | ||
512 | bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); | ||
513 | #endif | ||
514 | |||
515 | bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN); | ||
516 | SSYNC(); | ||
517 | |||
518 | /* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and | ||
519 | * mmc stack will do the detection. | ||
520 | */ | ||
521 | bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3)); | ||
522 | SSYNC(); | ||
523 | } | ||
524 | |||
508 | static int __devinit sdh_probe(struct platform_device *pdev) | 525 | static int __devinit sdh_probe(struct platform_device *pdev) |
509 | { | 526 | { |
510 | struct mmc_host *mmc; | 527 | struct mmc_host *mmc; |
@@ -581,19 +598,8 @@ static int __devinit sdh_probe(struct platform_device *pdev) | |||
581 | dev_err(&pdev->dev, "unable to request peripheral pins\n"); | 598 | dev_err(&pdev->dev, "unable to request peripheral pins\n"); |
582 | goto out4; | 599 | goto out4; |
583 | } | 600 | } |
584 | #if defined(CONFIG_BF54x) | ||
585 | /* Secure Digital Host shares DMA with Nand controller */ | ||
586 | bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); | ||
587 | #endif | ||
588 | 601 | ||
589 | bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN); | 602 | sdh_reset(); |
590 | SSYNC(); | ||
591 | |||
592 | /* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and | ||
593 | * mmc stack will do the detection. | ||
594 | */ | ||
595 | bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3)); | ||
596 | SSYNC(); | ||
597 | 603 | ||
598 | mmc_add_host(mmc); | 604 | mmc_add_host(mmc); |
599 | return 0; | 605 | return 0; |
@@ -660,10 +666,7 @@ static int sdh_resume(struct platform_device *dev) | |||
660 | return ret; | 666 | return ret; |
661 | } | 667 | } |
662 | 668 | ||
663 | #if defined(CONFIG_BF54x) | 669 | sdh_reset(); |
664 | /* Secure Digital Host shares DMA with Nand controller */ | ||
665 | bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); | ||
666 | #endif | ||
667 | 670 | ||
668 | if (mmc) | 671 | if (mmc) |
669 | ret = mmc_resume_host(mmc); | 672 | ret = mmc_resume_host(mmc); |