diff options
author | Aaron Lu <aaron.lu@amd.com> | 2012-07-03 05:27:49 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-07-22 15:25:46 -0400 |
commit | 473b095a72a95ba719905b1f2e82cd18d099a427 (patch) | |
tree | 0c7f3b6da06047070f0e8e0b64c1fe5a7428e5c9 | |
parent | 55fc05b7414274f17795cd0e8a3b1546f3649d5e (diff) |
mmc: sdhci: fix incorrect command used in tuning
For SD hosts using retuning mode 1, when retuning timer expired, it will
need to do retuning in sdhci_request before processing the actual
request. But the retuning command is fixed: cmd19 for SD card and cmd21
for eMMC card, so we can't use the original request's command to do the
tuning.
And since the tuning command depends on the card type attached to the
host, we will need to know the card type to use the correct tuning
command.
Signed-off-by: Aaron Lu <aaron.lu@amd.com>
Reviewed-by: Philip Rakity <prakity@marvell.com>
Cc: stable <stable@vger.kernel.org> [3.3+]
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/sdhci.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 101f9d43196f..12015151fab9 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/mmc/mmc.h> | 28 | #include <linux/mmc/mmc.h> |
29 | #include <linux/mmc/host.h> | 29 | #include <linux/mmc/host.h> |
30 | #include <linux/mmc/card.h> | ||
30 | 31 | ||
31 | #include "sdhci.h" | 32 | #include "sdhci.h" |
32 | 33 | ||
@@ -1245,6 +1246,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1245 | struct sdhci_host *host; | 1246 | struct sdhci_host *host; |
1246 | bool present; | 1247 | bool present; |
1247 | unsigned long flags; | 1248 | unsigned long flags; |
1249 | u32 tuning_opcode; | ||
1248 | 1250 | ||
1249 | host = mmc_priv(mmc); | 1251 | host = mmc_priv(mmc); |
1250 | 1252 | ||
@@ -1292,8 +1294,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1292 | */ | 1294 | */ |
1293 | if ((host->flags & SDHCI_NEEDS_RETUNING) && | 1295 | if ((host->flags & SDHCI_NEEDS_RETUNING) && |
1294 | !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) { | 1296 | !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) { |
1297 | /* eMMC uses cmd21 while sd and sdio use cmd19 */ | ||
1298 | tuning_opcode = mmc->card->type == MMC_TYPE_MMC ? | ||
1299 | MMC_SEND_TUNING_BLOCK_HS200 : | ||
1300 | MMC_SEND_TUNING_BLOCK; | ||
1295 | spin_unlock_irqrestore(&host->lock, flags); | 1301 | spin_unlock_irqrestore(&host->lock, flags); |
1296 | sdhci_execute_tuning(mmc, mrq->cmd->opcode); | 1302 | sdhci_execute_tuning(mmc, tuning_opcode); |
1297 | spin_lock_irqsave(&host->lock, flags); | 1303 | spin_lock_irqsave(&host->lock, flags); |
1298 | 1304 | ||
1299 | /* Restore original mmc_request structure */ | 1305 | /* Restore original mmc_request structure */ |