diff options
author | Jaehoon Chung <jh80.chung@samsung.com> | 2011-02-24 21:08:15 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-03-17 15:35:18 -0400 |
commit | fc3d7720541d4b70cbae25ac121d7e6343125090 (patch) | |
tree | f1ca22f9e6363c2ddfc84dfdc6e4992299e4f93a | |
parent | 860cfe796c793bfad1e666de9600852f2d653c57 (diff) |
mmc: dw_mmc: add quirks for unreliable card detect, and capabilities
This patch adds quirks and capabilities to platdata.
Some cards don't use the CDn pin; in that case, we assume the card's
inserted. Some boards need other capabilities. So, we add capabilities
in the board's platdata.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 10 | ||||
-rw-r--r-- | include/linux/mmc/dw_mmc.h | 10 |
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 299c1d61b6b3..94ec6502bdde 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -729,7 +729,9 @@ static int dw_mci_get_cd(struct mmc_host *mmc) | |||
729 | struct dw_mci_board *brd = slot->host->pdata; | 729 | struct dw_mci_board *brd = slot->host->pdata; |
730 | 730 | ||
731 | /* Use platform get_cd function, else try onboard card detect */ | 731 | /* Use platform get_cd function, else try onboard card detect */ |
732 | if (brd->get_cd) | 732 | if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) |
733 | present = 1; | ||
734 | else if (brd->get_cd) | ||
733 | present = !brd->get_cd(slot->id); | 735 | present = !brd->get_cd(slot->id); |
734 | else | 736 | else |
735 | present = (mci_readl(slot->host, CDETECT) & (1 << slot->id)) | 737 | present = (mci_readl(slot->host, CDETECT) & (1 << slot->id)) |
@@ -1403,7 +1405,11 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) | |||
1403 | if (host->pdata->setpower) | 1405 | if (host->pdata->setpower) |
1404 | host->pdata->setpower(id, 0); | 1406 | host->pdata->setpower(id, 0); |
1405 | 1407 | ||
1406 | mmc->caps = 0; | 1408 | if (host->pdata->caps) |
1409 | mmc->caps = host->pdata->caps; | ||
1410 | else | ||
1411 | mmc->caps = 0; | ||
1412 | |||
1407 | if (host->pdata->get_bus_wd) | 1413 | if (host->pdata->get_bus_wd) |
1408 | if (host->pdata->get_bus_wd(slot->id) >= 4) | 1414 | if (host->pdata->get_bus_wd(slot->id) >= 4) |
1409 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1415 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index 3f22c201ee3a..f08163198877 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h | |||
@@ -166,11 +166,13 @@ struct dw_mci_dma_ops { | |||
166 | 166 | ||
167 | /* IP Quirks/flags. */ | 167 | /* IP Quirks/flags. */ |
168 | /* DTO fix for command transmission with IDMAC configured */ | 168 | /* DTO fix for command transmission with IDMAC configured */ |
169 | #define DW_MCI_QUIRK_IDMAC_DTO BIT(0) | 169 | #define DW_MCI_QUIRK_IDMAC_DTO BIT(0) |
170 | /* delay needed between retries on some 2.11a implementations */ | 170 | /* delay needed between retries on some 2.11a implementations */ |
171 | #define DW_MCI_QUIRK_RETRY_DELAY BIT(1) | 171 | #define DW_MCI_QUIRK_RETRY_DELAY BIT(1) |
172 | /* High Speed Capable - Supports HS cards (upto 50MHz) */ | 172 | /* High Speed Capable - Supports HS cards (upto 50MHz) */ |
173 | #define DW_MCI_QUIRK_HIGHSPEED BIT(2) | 173 | #define DW_MCI_QUIRK_HIGHSPEED BIT(2) |
174 | /* Unreliable card detection */ | ||
175 | #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) | ||
174 | 176 | ||
175 | 177 | ||
176 | struct dma_pdata; | 178 | struct dma_pdata; |
@@ -190,6 +192,8 @@ struct dw_mci_board { | |||
190 | u32 quirks; /* Workaround / Quirk flags */ | 192 | u32 quirks; /* Workaround / Quirk flags */ |
191 | unsigned int bus_hz; /* Bus speed */ | 193 | unsigned int bus_hz; /* Bus speed */ |
192 | 194 | ||
195 | unsigned int caps; /* Capabilities */ | ||
196 | |||
193 | /* delay in mS before detecting cards after interrupt */ | 197 | /* delay in mS before detecting cards after interrupt */ |
194 | u32 detect_delay_ms; | 198 | u32 detect_delay_ms; |
195 | 199 | ||