diff options
author | Harry Hong <hhong@nvidia.com> | 2013-09-11 14:50:59 +0900 |
---|---|---|
committer | Gabby Lee <galee@nvidia.com> | 2013-09-11 21:52:28 -0700 |
commit | 231878c245ff1e4f4e457c5a3c1094275f77b850 (patch) | |
tree | 95d8dc894612f01a60f7ad9e1a8d565f41fe4271 | |
parent | b4c1cbb7af55a8a67e32bc788138c731b5e1d239 (diff) |
mmc: tegra: error handling if no card
if sd card removed during tap_delay tuning,
don't exit until trying MAX_TAP_VALUES.
it makes the system un-responsive for 2 sec.
Therefore, adding to check card_present before starting
freq_tuning.
if card is not present, return error
and then exit tuning procedure.
bug 1364449
Change-Id: Ib8dff29a1c1faade2acaa93c3e97ea23d3e3041c
Signed-off-by: Harry Hong <hhong@nvidia.com>
Reviewed-on: http://git-master/r/272902
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gabby Lee <galee@nvidia.com>
-rw-r--r-- | drivers/mmc/host/sdhci-tegra.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 2b3f559b846b..8e942ab75cf0 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1632,6 +1632,7 @@ static int sdhci_tegra_run_frequency_tuning(struct sdhci_host *sdhci) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci); struct sdhci_tegra *tegra_host = pltfm_host->priv; + const struct tegra_sdhci_platform_data *plat = tegra_host->plat; int err = 0; u8 ctrl; u32 mask; @@ -1639,6 +1640,10 @@ static int sdhci_tegra_run_frequency_tuning(struct sdhci_host *sdhci) int flags; u32 intstatus; + if (gpio_is_valid(plat->cd_gpio) + && (gpio_get_value(plat->cd_gpio) != 0)) + return -ENODEV; + mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT; while (sdhci_readl(sdhci, SDHCI_PRESENT_STATE) & mask) { if (timeout == 0) { @@ -1700,7 +1705,7 @@ static int sdhci_tegra_run_frequency_tuning(struct sdhci_host *sdhci) } else { tegra_sdhci_reset(sdhci, SDHCI_RESET_CMD); tegra_sdhci_reset(sdhci, SDHCI_RESET_DATA); - err = -EIO; + err = -EAGAIN; } if (sdhci->tuning_done) { @@ -1710,7 +1715,7 @@ static int sdhci_tegra_run_frequency_tuning(struct sdhci_host *sdhci) (ctrl & SDHCI_CTRL_TUNED_CLK)) err = 0; else - err = -EIO; + err = -EAGAIN; } mdelay(1); out: @@ -1730,6 +1735,8 @@ static int sdhci_tegra_scan_tap_values(struct sdhci_host *sdhci, /* Run frequency tuning */ err = sdhci_tegra_run_frequency_tuning(sdhci); + if (err == -ENODEV) + return err; if (err && retry) { retry--; continue; @@ -1765,7 +1772,10 @@ static int sdhci_tegra_get_tap_window_data(struct sdhci_host *sdhci, /* Get the partial window data */ tap_value = 0; tap_value = sdhci_tegra_scan_tap_values(sdhci, tap_value, false); - if (!tap_value) { + if (tap_value < 0) { + err = -EIO; + goto out; + } else if (!tap_value) { tap_data->abandon_partial_win = true; tap_data->partial_win = 0; } else if (tap_value > MAX_TAP_VALUES) { @@ -1789,7 +1799,10 @@ static int sdhci_tegra_get_tap_window_data(struct sdhci_host *sdhci, /* Get the full window start */ tap_value++; tap_value = sdhci_tegra_scan_tap_values(sdhci, tap_value, true); - if (tap_value > MAX_TAP_VALUES) { + if (tap_value < 0) { + err = -EIO; + goto out; + } else if (tap_value > MAX_TAP_VALUES) { /* All tap values exhausted. No full window */ tap_data->abandon_full_win = true; goto out; |