Hi,

On Thu, May 05 2011, Arindam Nath wrote:
> Host Controller v3.00 can support retuning modes 1,2 or 3 depending on
> the bits 46-47 of the Capabilities register. Also, the timer count for
> retuning is indicated by bits 40-43 of the same register. We initialize
> timer_list for retuning the first time we execute tuning procedure. This
> condition is indicated by SDHCI_NEEDS_RETUNING not being set. Since
> retuning mode 1 sets a limit of 4MB on the maximum data length, we set
> max_blk_count appropriately. Once the tuning timer expires, we set
> SDHCI_NEEDS_RETUNING flag, and if the flag is set, we execute tuning
> procedure before sending the next command. We need to restore mmc_request
> structure after executing retuning procedure since host->mrq is used
> inside the procedure to send CMD19. We also disable and re-enable this
> flag during suspend and resume respectively, as per the spec v3.00.
>
> Signed-off-by: Arindam Nath <arindam.n...@amd.com>
> Reviewed-by: Philip Rakity <prak...@marvell.com>
> Tested-by: Philip Rakity <prak...@marvell.com>

Thanks, pushed to mmc-next for .40 with the trivial changes below:

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d90c300..e00c759 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1218,8 +1218,7 @@ static void sdhci_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
                 * tuning procedure before sending command.
                 */
                if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-                   !(present_state & (SDHCI_DOING_WRITE |
-                    SDHCI_DOING_READ))) {
+                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
                        spin_unlock_irqrestore(&host->lock, flags);
                        sdhci_execute_tuning(mmc);
                        spin_lock_irqsave(&host->lock, flags);
@@ -1703,8 +1702,8 @@ out:
         */
        if (!(host->flags & SDHCI_NEEDS_RETUNING) && host->tuning_count &&
            (host->tuning_mode == SDHCI_TUNING_MODE_1)) {
-               mod_timer(&host->tuning_timer, jiffies + host->tuning_count *
-                       HZ);
+               mod_timer(&host->tuning_timer, jiffies +
+                       host->tuning_count * HZ);
                /* Tuning mode 1 limits the maximum data length to 4MB */
                mmc->max_blk_count = (4 * 1024 * 1024) / mmc->max_blk_size;
        } else {
@@ -1831,7 +1830,6 @@ static void sdhci_tasklet_finish(unsigned long param)
        if (host->version >= SDHCI_SPEC_300)
                del_timer(&host->tuning_timer);
 
-
        mrq = host->mrq;
 
        /*
@@ -2194,8 +2192,7 @@ int sdhci_suspend_host(struct sdhci_host *host, 
pm_message_t state)
        sdhci_disable_card_detection(host);
 
        /* Disable tuning since we are suspending */
-       if ((host->version >= SDHCI_SPEC_300) &&
-           host->tuning_count &&
+       if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
            host->tuning_mode == SDHCI_TUNING_MODE_1) {
                host->flags &= ~SDHCI_NEEDS_RETUNING;
                mod_timer(&host->tuning_timer, jiffies +
@@ -2244,8 +2241,7 @@ int sdhci_resume_host(struct sdhci_host *host)
        sdhci_enable_card_detection(host);
 
        /* Set the re-tuning expiration flag */
-       if ((host->version >= SDHCI_SPEC_300) &&
-           host->tuning_count &&
+       if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
            host->tuning_mode == SDHCI_TUNING_MODE_1)
                host->flags |= SDHCI_NEEDS_RETUNING;
 


- Chris.
-- 
Chris Ball   <c...@laptop.org>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to