MLK-16155-11 mmc: sdhci: correct the maximum timeout when enable CMDQ
authorHaibo Chen <haibo.chen@nxp.com>
Fri, 4 Aug 2017 03:21:03 +0000 (11:21 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:20 +0000 (15:38 -0500)
Priority use the callback set_timeout() to set the maximum timeout
if the host has.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
drivers/mmc/host/sdhci.c

index 4336fa9..1fea634 100644 (file)
@@ -676,7 +676,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
 static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 {
        u8 count;
-       struct mmc_data *data = cmd->data;
+       struct mmc_data *data;
        unsigned target_timeout, current_timeout;
 
        /*
@@ -688,6 +688,12 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
        if (host->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL)
                return 0xE;
 
+       /* Unspecified command, assume max */
+       if (cmd == NULL)
+               return 0xE;
+
+       data = cmd->data;
+
        /* Unspecified timeout, assume max */
        if (!data && !cmd->busy_timeout)
                return 0xE;
@@ -3010,7 +3016,7 @@ void sdhci_cqe_enable(struct mmc_host *mmc)
                     SDHCI_BLOCK_SIZE);
 
        /* Set maximum timeout */
-       sdhci_writeb(host, 0xE, SDHCI_TIMEOUT_CONTROL);
+       sdhci_set_timeout(host, NULL);
 
        host->ier = host->cqe_ier;