[3/5] mmc: sdhci: correct the maximum timeout when enable CMDQ
diff mbox series

Message ID 20190107101757.27647-3-haibo.chen@nxp.com
State New
Headers show
Series
  • [1/5] mmc: sdhci-esdhc-imx: remove the 100MHz limitation for Strobe DLL
Related show

Commit Message

BOUGH CHEN Jan. 7, 2019, 10:11 a.m. UTC
Change to use sdhci_set_timeout() to set the maximum timeout, so that
the host can use it's own set_timeout() callback to set the maximum
timeout if the host has.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mmc/host/sdhci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Adrian Hunter Jan. 14, 2019, 8:50 a.m. UTC | #1
On 7/01/19 12:11 PM, BOUGH CHEN wrote:
> Change to use sdhci_set_timeout() to set the maximum timeout, so that
> the host can use it's own set_timeout() callback to set the maximum
> timeout if the host has.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3c188a7a9b66..d481f6aa36ec 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -867,7 +867,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>  			     bool *too_big)
>  {
>  	u8 count;
> -	struct mmc_data *data = cmd->data;
> +	struct mmc_data *data;
>  	unsigned target_timeout, current_timeout;
>  
>  	*too_big = true;
> @@ -881,6 +881,11 @@ 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, asume max */
> +	if (cmd == NULL)
> +		return 0xE;
> +
> +	data = cmd->data;
>  	/* Unspecified timeout, assume max */
>  	if (!data && !cmd->busy_timeout)
>  		return 0xE;
> @@ -3319,7 +3324,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;
>  
>
Ulf Hansson Jan. 14, 2019, 11:45 a.m. UTC | #2
On Mon, 7 Jan 2019 at 11:11, BOUGH CHEN <haibo.chen@nxp.com> wrote:
>
> Change to use sdhci_set_timeout() to set the maximum timeout, so that
> the host can use it's own set_timeout() callback to set the maximum
> timeout if the host has.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3c188a7a9b66..d481f6aa36ec 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -867,7 +867,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>                              bool *too_big)
>  {
>         u8 count;
> -       struct mmc_data *data = cmd->data;
> +       struct mmc_data *data;
>         unsigned target_timeout, current_timeout;
>
>         *too_big = true;
> @@ -881,6 +881,11 @@ 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, asume max */
> +       if (cmd == NULL)
> +               return 0xE;
> +
> +       data = cmd->data;
>         /* Unspecified timeout, assume max */
>         if (!data && !cmd->busy_timeout)
>                 return 0xE;
> @@ -3319,7 +3324,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;
>
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3c188a7a9b66..d481f6aa36ec 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -867,7 +867,7 @@  static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
 			     bool *too_big)
 {
 	u8 count;
-	struct mmc_data *data = cmd->data;
+	struct mmc_data *data;
 	unsigned target_timeout, current_timeout;
 
 	*too_big = true;
@@ -881,6 +881,11 @@  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, asume max */
+	if (cmd == NULL)
+		return 0xE;
+
+	data = cmd->data;
 	/* Unspecified timeout, assume max */
 	if (!data && !cmd->busy_timeout)
 		return 0xE;
@@ -3319,7 +3324,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;