mmc: tegra: Handle retune request case in tuning
R Raj Kumar [Thu, 19 Sep 2013 09:17:28 +0000 (14:17 +0530)]
Need to handle retune request case also in the tuning procedure.
We set retune flag if we remove (un-plug) SD card.
So, tuning should be done next time when SD card is inserted.

Bug 1371498

Change-Id: I1c1232313aefe835f9c71dac10a2fe2034853d2a
Signed-off-by: R Raj Kumar <rrajk@nvidia.com>
(cherry picked from commit f40e0a66661685b5d8c2260e2bca4281526f33b8)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>

drivers/mmc/host/sdhci-tegra.c

index 78f996b..dd536eb 100644 (file)
@@ -364,6 +364,7 @@ struct sdhci_tegra {
        unsigned int tap_cmd;
        /* Tuning status */
        unsigned int tuning_status;
+       bool force_retune;
 #define TUNING_STATUS_DONE     1
 #define TUNING_STATUS_RETUNE   2
        /* Freq tuning information for each sampling clock freq */
@@ -907,6 +908,7 @@ static irqreturn_t carddetect_irq(int irq, void *data)
                 * a card is inserted.
                 */
                tegra_host->tuning_status = TUNING_STATUS_RETUNE;
+               tegra_host->force_retune = true;
                tegra_host->calib_1v8_offsets_done = false;
        }
 
@@ -2341,6 +2343,11 @@ static int sdhci_tegra_execute_tuning(struct sdhci_host *sdhci, u32 opcode)
                        goto out;
        }
 
+       if (tegra_host->force_retune == true) {
+               force_retuning = true;
+               tegra_host->force_retune = false;
+       }
+
        tegra_host->tuning_status = 0;
        err = sdhci_tegra_get_tuning_constraints(sdhci);
        if (err) {