All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method
@ 2020-08-06 11:48 haibo.chen
  2020-08-06 12:11 ` Adrian Hunter
  0 siblings, 1 reply; 5+ messages in thread
From: haibo.chen @ 2020-08-06 11:48 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson, linux-mmc
  Cc: linux-imx, haibo.chen, shawnguo, s.hauer, kernel, festevam

From: Haibo Chen <haibo.chen@nxp.com>

According to IC suggestion, everytime before sending the tuning command,
need to reset the usdhc, so to reset the tuning circuit, to let every
tuning command work well for the manual tuning method. For standard
tuning method, IC already add the reset operation in the logic.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a76b4513fbec..e4694eb1b914 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
 
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);
 
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
-- 
2.17.1


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

* Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method
  2020-08-06 11:48 [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method haibo.chen
@ 2020-08-06 12:11 ` Adrian Hunter
  2020-08-07  1:50   ` Bough Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2020-08-06 12:11 UTC (permalink / raw)
  To: haibo.chen, ulf.hansson, linux-mmc
  Cc: linux-imx, shawnguo, s.hauer, kernel, festevam

On 6/08/20 2:48 pm, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> According to IC suggestion, everytime before sending the tuning command,
> need to reset the usdhc, so to reset the tuning circuit, to let every
> tuning command work well for the manual tuning method. For standard
> tuning method, IC already add the reset operation in the logic.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index a76b4513fbec..e4694eb1b914 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
>  
>  	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
>  	mdelay(1);
> +	sdhci_reset(host, SDHCI_RESET_ALL);

Doesn't that reset all registers i.e. the entire ios state?

>  
>  	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
>  	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
> 


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

* RE: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method
  2020-08-06 12:11 ` Adrian Hunter
@ 2020-08-07  1:50   ` Bough Chen
  2020-08-10 11:25     ` Adrian Hunter
  0 siblings, 1 reply; 5+ messages in thread
From: Bough Chen @ 2020-08-07  1:50 UTC (permalink / raw)
  To: Adrian Hunter, ulf.hansson, linux-mmc
  Cc: dl-linux-imx, shawnguo, s.hauer, kernel, festevam


> -----Original Message-----
> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> Sent: 2020年8月6日 20:11
> To: Bough Chen <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
> linux-mmc@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
> Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending
> tuning command for manual tuning method
> 
> On 6/08/20 2:48 pm, haibo.chen@nxp.com wrote:
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > According to IC suggestion, everytime before sending the tuning
> > command, need to reset the usdhc, so to reset the tuning circuit, to
> > let every tuning command work well for the manual tuning method. For
> > standard tuning method, IC already add the reset operation in the logic.
> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> > b/drivers/mmc/host/sdhci-esdhc-imx.c
> > index a76b4513fbec..e4694eb1b914 100644
> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > @@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host
> > *host, u32 val)
> >
> >  	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
> >  	mdelay(1);
> > +	sdhci_reset(host, SDHCI_RESET_ALL);
> 
> Doesn't that reset all registers i.e. the entire ios state?
> 

Hi Adrian,
For i.MX usdhc, RESET_ALL operation do not impact any register value, it just reset the internal logic setting. I already verified that.
Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good enough to use this API directly. Any suggestion? At least, current patch can fix the manual tuning issue on imx7d/imx8qxp.

> >
> >  	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
> >  	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
> >


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

* Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method
  2020-08-07  1:50   ` Bough Chen
@ 2020-08-10 11:25     ` Adrian Hunter
  2020-08-11  2:33       ` Bough Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2020-08-10 11:25 UTC (permalink / raw)
  To: Bough Chen, ulf.hansson, linux-mmc
  Cc: dl-linux-imx, shawnguo, s.hauer, kernel, festevam

On 7/08/20 4:50 am, Bough Chen wrote:
> 
>> -----Original Message-----
>> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
>> Sent: 2020年8月6日 20:11
>> To: Bough Chen <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
>> linux-mmc@vger.kernel.org
>> Cc: dl-linux-imx <linux-imx@nxp.com>; shawnguo@kernel.org;
>> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
>> Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending
>> tuning command for manual tuning method
>>
>> On 6/08/20 2:48 pm, haibo.chen@nxp.com wrote:
>>> From: Haibo Chen <haibo.chen@nxp.com>
>>>
>>> According to IC suggestion, everytime before sending the tuning
>>> command, need to reset the usdhc, so to reset the tuning circuit, to
>>> let every tuning command work well for the manual tuning method. For
>>> standard tuning method, IC already add the reset operation in the logic.
>>>
>>> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
>>> ---
>>>  drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
>>> b/drivers/mmc/host/sdhci-esdhc-imx.c
>>> index a76b4513fbec..e4694eb1b914 100644
>>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>>> @@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host
>>> *host, u32 val)
>>>
>>>  	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
>>>  	mdelay(1);
>>> +	sdhci_reset(host, SDHCI_RESET_ALL);
>>
>> Doesn't that reset all registers i.e. the entire ios state?
>>
> 
> Hi Adrian,
> For i.MX usdhc, RESET_ALL operation do not impact any register value, it just reset the internal logic setting. I already verified that.
> Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good enough to use this API directly. Any suggestion? At least, current patch can fix the manual tuning issue on imx7d/imx8qxp.

It might be safer to write SDHCI_RESET_ALL directly because, for your case,
it does not have exactly the same semantics as sdhci_reset().

It is up to you, but either way, it would be worth adding a comment.

> 
>>>
>>>  	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
>>>  	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
>>>
> 


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

* RE: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method
  2020-08-10 11:25     ` Adrian Hunter
@ 2020-08-11  2:33       ` Bough Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Bough Chen @ 2020-08-11  2:33 UTC (permalink / raw)
  To: Adrian Hunter, ulf.hansson, linux-mmc
  Cc: dl-linux-imx, shawnguo, s.hauer, kernel, festevam


> -----Original Message-----
> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> Sent: 2020年8月10日 19:26
> To: Bough Chen <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
> linux-mmc@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
> Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending
> tuning command for manual tuning method
> 
> On 7/08/20 4:50 am, Bough Chen wrote:
> >
> >> -----Original Message-----
> >> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> >> Sent: 2020年8月6日 20:11
> >> To: Bough Chen <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
> >> linux-mmc@vger.kernel.org
> >> Cc: dl-linux-imx <linux-imx@nxp.com>; shawnguo@kernel.org;
> >> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
> >> Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before
> >> sending tuning command for manual tuning method
> >>
> >> On 6/08/20 2:48 pm, haibo.chen@nxp.com wrote:
> >>> From: Haibo Chen <haibo.chen@nxp.com>
> >>>
> >>> According to IC suggestion, everytime before sending the tuning
> >>> command, need to reset the usdhc, so to reset the tuning circuit, to
> >>> let every tuning command work well for the manual tuning method. For
> >>> standard tuning method, IC already add the reset operation in the logic.
> >>>
> >>> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> >>> ---
> >>>  drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
> >>>  1 file changed, 1 insertion(+)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> >>> b/drivers/mmc/host/sdhci-esdhc-imx.c
> >>> index a76b4513fbec..e4694eb1b914 100644
> >>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> >>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> >>> @@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct
> >>> sdhci_host *host, u32 val)
> >>>
> >>>  	/* FIXME: delay a bit for card to be ready for next tuning due to errors
> */
> >>>  	mdelay(1);
> >>> +	sdhci_reset(host, SDHCI_RESET_ALL);
> >>
> >> Doesn't that reset all registers i.e. the entire ios state?
> >>
> >
> > Hi Adrian,
> > For i.MX usdhc, RESET_ALL operation do not impact any register value, it just
> reset the internal logic setting. I already verified that.
> > Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API
> sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good
> enough to use this API directly. Any suggestion? At least, current patch can fix
> the manual tuning issue on imx7d/imx8qxp.
> 
> It might be safer to write SDHCI_RESET_ALL directly because, for your case, it
> does not have exactly the same semantics as sdhci_reset().
> 
> It is up to you, but either way, it would be worth adding a comment.
> 

Thanks Adrian, I will write this bit directly and add a comment in the next V2 patch.

Best Regards
Haibo Chen
> >
> >>>
> >>>  	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
> >>>  	reg |= ESDHC_MIX_CTRL_EXE_TUNE |
> ESDHC_MIX_CTRL_SMPCLK_SEL |
> >>>
> >


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

end of thread, other threads:[~2020-08-11  2:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 11:48 [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method haibo.chen
2020-08-06 12:11 ` Adrian Hunter
2020-08-07  1:50   ` Bough Chen
2020-08-10 11:25     ` Adrian Hunter
2020-08-11  2:33       ` Bough Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.