diff options
author | James Hogan <james.hogan@imgtec.com> | 2013-03-12 06:43:32 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-03-22 12:41:54 -0400 |
commit | e6f34e2fd3a7c6bc4893c08583d55599ac15eb9d (patch) | |
tree | 2b12777cf3adce91edadfb00f9ae23a3c93bb888 /drivers/mmc/host/dw_mmc.c | |
parent | a3361abaae810b717fcb7191e0558bcbdaf1c12d (diff) |
mmc: dw_mmc: setpower on MMC_POWER_{UP,OFF}
Call the setpower platform callback in response to set_ios with
ios->power_mode == MMC_POWER_UP or MMC_POWER_OFF, instead of from the
card detect work function.
This appears to fix a problem I have where a card stuck in a funny state
doesn't get properly cleared by the power being turned off, presumably
due to lack of power sequencing. This resulted in the following log
messages after boot:
mmc0: error -110 whilst initialising SD card
mmc_host mmc0: Bus speed (slot 0) = 99840000Hz (slot req 300000Hz, actual 298922HZ div = 167)
mmc0: error -110 whilst initialising SD card
mmc_host mmc0: Bus speed (slot 0) = 99840000Hz (slot req 200000Hz, actual 199680HZ div = 250)
mmc0: error -110 whilst initialising SD card
mmc_host mmc0: Bus speed (slot 0) = 99840000Hz (slot req 195765Hz, actual 195764HZ div = 255)
mmc0: error -110 whilst initialising SD card
mmc_host mmc0: Bus speed (slot 0) = 99840000Hz (slot req 400000Hz, actual 399360HZ div = 125)
mmc0: error -110 whilst initialising SD card
mmc_host mmc0: Bus speed (slot 0) = 99840000Hz (slot req 300000Hz, actual 298922HZ div = 167)
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/dw_mmc.c')
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 38732d85009d..6891fd131b0a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -818,6 +818,14 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
818 | switch (ios->power_mode) { | 818 | switch (ios->power_mode) { |
819 | case MMC_POWER_UP: | 819 | case MMC_POWER_UP: |
820 | set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags); | 820 | set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags); |
821 | /* Power up slot */ | ||
822 | if (slot->host->pdata->setpower) | ||
823 | slot->host->pdata->setpower(slot->id, mmc->ocr_avail); | ||
824 | break; | ||
825 | case MMC_POWER_OFF: | ||
826 | /* Power down slot */ | ||
827 | if (slot->host->pdata->setpower) | ||
828 | slot->host->pdata->setpower(slot->id, 0); | ||
821 | break; | 829 | break; |
822 | default: | 830 | default: |
823 | break; | 831 | break; |
@@ -1676,10 +1684,6 @@ static void dw_mci_work_routine_card(struct work_struct *work) | |||
1676 | dev_dbg(&slot->mmc->class_dev, "card %s\n", | 1684 | dev_dbg(&slot->mmc->class_dev, "card %s\n", |
1677 | present ? "inserted" : "removed"); | 1685 | present ? "inserted" : "removed"); |
1678 | 1686 | ||
1679 | /* Power up slot (before spin_lock, may sleep) */ | ||
1680 | if (present != 0 && host->pdata->setpower) | ||
1681 | host->pdata->setpower(slot->id, mmc->ocr_avail); | ||
1682 | |||
1683 | spin_lock_bh(&host->lock); | 1687 | spin_lock_bh(&host->lock); |
1684 | 1688 | ||
1685 | /* Card change detected */ | 1689 | /* Card change detected */ |
@@ -1762,10 +1766,6 @@ static void dw_mci_work_routine_card(struct work_struct *work) | |||
1762 | 1766 | ||
1763 | spin_unlock_bh(&host->lock); | 1767 | spin_unlock_bh(&host->lock); |
1764 | 1768 | ||
1765 | /* Power down slot (after spin_unlock, may sleep) */ | ||
1766 | if (present == 0 && host->pdata->setpower) | ||
1767 | host->pdata->setpower(slot->id, 0); | ||
1768 | |||
1769 | present = dw_mci_get_cd(mmc); | 1769 | present = dw_mci_get_cd(mmc); |
1770 | } | 1770 | } |
1771 | 1771 | ||