diff mbox

mmc: dw_mmc: update clock after ctrl reset in runtime resume

Message ID 5e789711-b5de-5564-4538-a89d9ed9ca05@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin Jan. 3, 2017, 6:59 a.m. UTC
Hi Ziyuan,

On 2017/1/3 14:46, Ziyuan Xu wrote:
> Immediately after reset, issue the command which sets
> update_clock_register_only bit, the card clock will restart.
>
> MMC_PM_KEEP_POWER is disabled for SD card and eMMC slots, so that they
> have no chance to invoke dw_mci_setup_bus for update clock behaviour.
> Let's consummate it.
>
> Fixes: e9ed883 ("mmc: dw_mmc: add runtime PM callback")
> Reported-by: Randy Li <randy.li@rock-chips.com>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> ---
>  drivers/mmc/host/dw_mmc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index b44306b..71715b4 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3357,6 +3357,8 @@ int dw_mci_runtime_resume(struct device *dev)
>  		if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
>  			dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
>  			dw_mci_setup_bus(slot, true);
> +		} else {
> +			mci_send_cmd(slot, SDMMC_CMD_UPD_CLK, 0);
>  		}
>  	}

Thanks for sending this, but I think the better fix we talked about
offlist may be...



otherwise there still some unhandled cases once the reset is failure.

>
>

Comments

Jaehoon Chung Jan. 4, 2017, 8:28 a.m. UTC | #1
On 01/03/2017 03:59 PM, Shawn Lin wrote:
> Hi Ziyuan,
> 
> On 2017/1/3 14:46, Ziyuan Xu wrote:
>> Immediately after reset, issue the command which sets
>> update_clock_register_only bit, the card clock will restart.
>>
>> MMC_PM_KEEP_POWER is disabled for SD card and eMMC slots, so that they
>> have no chance to invoke dw_mci_setup_bus for update clock behaviour.
>> Let's consummate it.
>>
>> Fixes: e9ed883 ("mmc: dw_mmc: add runtime PM callback")
>> Reported-by: Randy Li <randy.li@rock-chips.com>
>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>> ---
>>  drivers/mmc/host/dw_mmc.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index b44306b..71715b4 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -3357,6 +3357,8 @@ int dw_mci_runtime_resume(struct device *dev)
>>          if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
>>              dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
>>              dw_mci_setup_bus(slot, true);
>> +        } else {
>> +            mci_send_cmd(slot, SDMMC_CMD_UPD_CLK, 0);
>>          }
>>      }
> 
> Thanks for sending this, but I think the better fix we talked about
> offlist may be...
> 
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3324,7 +3324,7 @@ int dw_mci_runtime_resume(struct device *dev)
>         if (ret)
>                 goto err;
> 
> -       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
> +       if (!dw_mci_reset(host)) {
>                 clk_disable_unprepare(host->ciu_clk);
>                 ret = -ENODEV;
>                 goto err;
> 
> 
> otherwise there still some unhandled cases once the reset is failure.

I  think Shawn's suggestion is more better..After applied Shawn's suggestion, Is the problem  disappeared?
If then, could you resend the patch as Shawn's?
I  don't test yet with exynos..after testing, i will also share.

Best Regards,
Jaehoon Chung

> 
>>
>>
> 
> 

--
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
ziyuan Jan. 4, 2017, 8:39 a.m. UTC | #2
On 01/04/2017 04:28 PM, Jaehoon Chung wrote:
> On 01/03/2017 03:59 PM, Shawn Lin wrote:
>> Hi Ziyuan,
>>
>> On 2017/1/3 14:46, Ziyuan Xu wrote:
>>> Immediately after reset, issue the command which sets
>>> update_clock_register_only bit, the card clock will restart.
>>>
>>> MMC_PM_KEEP_POWER is disabled for SD card and eMMC slots, so that they
>>> have no chance to invoke dw_mci_setup_bus for update clock behaviour.
>>> Let's consummate it.
>>>
>>> Fixes: e9ed883 ("mmc: dw_mmc: add runtime PM callback")
>>> Reported-by: Randy Li <randy.li@rock-chips.com>
>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>> ---
>>>   drivers/mmc/host/dw_mmc.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>>> index b44306b..71715b4 100644
>>> --- a/drivers/mmc/host/dw_mmc.c
>>> +++ b/drivers/mmc/host/dw_mmc.c
>>> @@ -3357,6 +3357,8 @@ int dw_mci_runtime_resume(struct device *dev)
>>>           if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
>>>               dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
>>>               dw_mci_setup_bus(slot, true);
>>> +        } else {
>>> +            mci_send_cmd(slot, SDMMC_CMD_UPD_CLK, 0);
>>>           }
>>>       }
>> Thanks for sending this, but I think the better fix we talked about
>> offlist may be...
>>
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -3324,7 +3324,7 @@ int dw_mci_runtime_resume(struct device *dev)
>>          if (ret)
>>                  goto err;
>>
>> -       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
>> +       if (!dw_mci_reset(host)) {
>>                  clk_disable_unprepare(host->ciu_clk);
>>                  ret = -ENODEV;
>>                  goto err;
>>
>>
>> otherwise there still some unhandled cases once the reset is failure.
> I  think Shawn's suggestion is more better..After applied Shawn's suggestion, Is the problem  disappeared?
> If then, could you resend the patch as Shawn's?
> I  don't test yet with exynos..after testing, i will also share.

Fine. It a better approach. I will test it and share result ASAP.:-)

BR
Ziyuan Xu

>
> Best Regards,
> Jaehoon Chung
>
>>>
>>
> --
> 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
>
>
>


--
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

--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3324,7 +3324,7 @@  int dw_mci_runtime_resume(struct device *dev)
         if (ret)
                 goto err;

-       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
+       if (!dw_mci_reset(host)) {
                 clk_disable_unprepare(host->ciu_clk);
                 ret = -ENODEV;
                 goto err;