linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume
@ 2017-01-03  6:46 Ziyuan Xu
  2017-01-03  6:59 ` Shawn Lin
  0 siblings, 1 reply; 4+ messages in thread
From: Ziyuan Xu @ 2017-01-03  6:46 UTC (permalink / raw)
  To: ulf.hansson, jh80.chung, shawn.lin
  Cc: linux-mmc, randy.li, linux-rockchip, Ziyuan Xu

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);
 		}
 	}
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume
  2017-01-03  6:46 [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume Ziyuan Xu
@ 2017-01-03  6:59 ` Shawn Lin
  2017-01-04  8:28   ` Jaehoon Chung
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn Lin @ 2017-01-03  6:59 UTC (permalink / raw)
  To: Ziyuan Xu, ulf.hansson, jh80.chung
  Cc: shawn.lin, linux-mmc, randy.li, linux-rockchip

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.

>
>


-- 
Best Regards
Shawn Lin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume
  2017-01-03  6:59 ` Shawn Lin
@ 2017-01-04  8:28   ` Jaehoon Chung
       [not found]     ` <3b5329de-6aa9-4365-771b-11947989e910-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jaehoon Chung @ 2017-01-04  8:28 UTC (permalink / raw)
  To: Shawn Lin, Ziyuan Xu, ulf.hansson; +Cc: linux-mmc, randy.li, linux-rockchip

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

> 
>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume
       [not found]     ` <3b5329de-6aa9-4365-771b-11947989e910-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2017-01-04  8:39       ` Ziyuan
  0 siblings, 0 replies; 4+ messages in thread
From: Ziyuan @ 2017-01-04  8:39 UTC (permalink / raw)
  To: Jaehoon Chung, Shawn Lin, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A
  Cc: randy.li-TNX95d0MmH7DzftRWevZcw, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r



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-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>> Signed-off-by: Ziyuan Xu <xzy.xu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>> ---
>>>   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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-04  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-03  6:46 [PATCH] mmc: dw_mmc: update clock after ctrl reset in runtime resume Ziyuan Xu
2017-01-03  6:59 ` Shawn Lin
2017-01-04  8:28   ` Jaehoon Chung
     [not found]     ` <3b5329de-6aa9-4365-771b-11947989e910-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-01-04  8:39       ` Ziyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).