diff mbox

[V4,04/11] mmc: core: Turn off CQE before sending commands

Message ID 1500630584-22852-5-git-send-email-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adrian Hunter July 21, 2017, 9:49 a.m. UTC
Turn off the CQE before sending commands, and ensure it is off in any reset
or power management paths, or re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Ulf Hansson Aug. 7, 2017, 1:59 p.m. UTC | #1
On 21 July 2017 at 11:49, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Turn off the CQE before sending commands, and ensure it is off in any reset
> or power management paths, or re-tuning.

Please explain a bit why this is needed.

Also, it's not clear how it becomes re-enabled. Or it doesn't have to?

>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/mmc/core/core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 26431267a3e2..b0af9db18eef 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -260,6 +260,9 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
>
>         trace_mmc_request_start(host, mrq);
>
> +       if (host->cqe_on)
> +               host->cqe_ops->cqe_off(host);
> +

Why can't you use the ->cqe_disable() callback here instead?

I guess what puzzles me is that there is no corresponding ->cqe_on()
callback. When does cqe gets turned on again?

>         host->ops->request(host, mrq);
>  }
>
> @@ -982,6 +985,9 @@ int mmc_execute_tuning(struct mmc_card *card)
>         if (!host->ops->execute_tuning)
>                 return 0;
>
> +       if (host->cqe_on)
> +               host->cqe_ops->cqe_off(host);
> +
>         if (mmc_card_mmc(card))
>                 opcode = MMC_SEND_TUNING_BLOCK_HS200;
>         else
> @@ -1021,6 +1027,9 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
>   */
>  void mmc_set_initial_state(struct mmc_host *host)
>  {
> +       if (host->cqe_on)
> +               host->cqe_ops->cqe_off(host);
> +
>         mmc_retune_disable(host);
>
>         if (mmc_host_is_spi(host))
> --
> 1.9.1
>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Adrian Hunter Aug. 8, 2017, 12:04 p.m. UTC | #2
On 07/08/17 16:59, Ulf Hansson wrote:
> On 21 July 2017 at 11:49, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> Turn off the CQE before sending commands, and ensure it is off in any reset
>> or power management paths, or re-tuning.
> 
> Please explain a bit why this is needed.
> 
> Also, it's not clear how it becomes re-enabled. Or it doesn't have to?

OK, I answered that in the previous email.  I can add more explanation here.

> 
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>  drivers/mmc/core/core.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> index 26431267a3e2..b0af9db18eef 100644
>> --- a/drivers/mmc/core/core.c
>> +++ b/drivers/mmc/core/core.c
>> @@ -260,6 +260,9 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
>>
>>         trace_mmc_request_start(host, mrq);
>>
>> +       if (host->cqe_on)
>> +               host->cqe_ops->cqe_off(host);
>> +
> 
> Why can't you use the ->cqe_disable() callback here instead?
> 
> I guess what puzzles me is that there is no corresponding ->cqe_on()
> callback. When does cqe gets turned on again?

That was covered in the previous email too.

> 
>>         host->ops->request(host, mrq);
>>  }
>>
>> @@ -982,6 +985,9 @@ int mmc_execute_tuning(struct mmc_card *card)
>>         if (!host->ops->execute_tuning)
>>                 return 0;
>>
>> +       if (host->cqe_on)
>> +               host->cqe_ops->cqe_off(host);
>> +
>>         if (mmc_card_mmc(card))
>>                 opcode = MMC_SEND_TUNING_BLOCK_HS200;
>>         else
>> @@ -1021,6 +1027,9 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
>>   */
>>  void mmc_set_initial_state(struct mmc_host *host)
>>  {
>> +       if (host->cqe_on)
>> +               host->cqe_ops->cqe_off(host);
>> +
>>         mmc_retune_disable(host);
>>
>>         if (mmc_host_is_spi(host))
>> --
>> 1.9.1
>>
> 
> Kind regards
> Uffe
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 26431267a3e2..b0af9db18eef 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -260,6 +260,9 @@  static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 
 	trace_mmc_request_start(host, mrq);
 
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	host->ops->request(host, mrq);
 }
 
@@ -982,6 +985,9 @@  int mmc_execute_tuning(struct mmc_card *card)
 	if (!host->ops->execute_tuning)
 		return 0;
 
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	if (mmc_card_mmc(card))
 		opcode = MMC_SEND_TUNING_BLOCK_HS200;
 	else
@@ -1021,6 +1027,9 @@  void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
  */
 void mmc_set_initial_state(struct mmc_host *host)
 {
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	mmc_retune_disable(host);
 
 	if (mmc_host_is_spi(host))