All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: fsl_esdhc: remove 1ms sleep in esdhc_send_cmd_common()
@ 2021-09-10  9:20 ` Michael Walle
  2021-09-13 22:00   ` Jaehoon Chung
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2021-09-10  9:20 UTC (permalink / raw)
  To: u-boot; +Cc: Peng Fan, Jaehoon Chung, Michael Walle

Since the beginning of this driver which was initially for the MPC8379
and MPC8536 SoCs, there is this spurious 1ms delay. According to the
comment it should actually be only 8 clock cycles. Esp. during EFI block
transfers, this 1ms add up to a significant delay and slows down EFI
boot.

I couldn't find any mention in the MPC8536 that there should be a delay
of 8 clock cycles between commands. The SD card specification mentions that
the clock has to be left enabled for 8 cycles after a command or
response. But I don't see how this delay will help with this.

Go ahead and just remove it. If there will ever be any regression we can
introduce a compile time flag, but for now I'd like to keep it simple.

In the split off imx driver this delay was also removed in commit
9098682200e6 ("mmc: fsl_esdhc_imx: remove the 1ms delay before sending
command").

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/mmc/fsl_esdhc.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 1d98fa65c4..ebb307e950 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -361,13 +361,6 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
 	while (esdhc_read32(&regs->prsstat) & PRSSTAT_DLA)
 		;
 
-	/* Wait at least 8 SD clock cycles before the next command */
-	/*
-	 * Note: This is way more than 8 cycles, but 1ms seems to
-	 * resolve timing issues with some cards
-	 */
-	udelay(1000);
-
 	/* Set up for a data transfer if we have one */
 	if (data) {
 		err = esdhc_setup_data(priv, mmc, data);
-- 
2.30.2


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

* Re: [PATCH] mmc: fsl_esdhc: remove 1ms sleep in esdhc_send_cmd_common()
  2021-09-10  9:20 ` [PATCH] mmc: fsl_esdhc: remove 1ms sleep in esdhc_send_cmd_common() Michael Walle
@ 2021-09-13 22:00   ` Jaehoon Chung
  0 siblings, 0 replies; 2+ messages in thread
From: Jaehoon Chung @ 2021-09-13 22:00 UTC (permalink / raw)
  To: Michael Walle, u-boot; +Cc: Peng Fan

Hi,

On 9/10/21 6:20 PM, Michael Walle wrote:
> Since the beginning of this driver which was initially for the MPC8379
> and MPC8536 SoCs, there is this spurious 1ms delay. According to the
> comment it should actually be only 8 clock cycles. Esp. during EFI block
> transfers, this 1ms add up to a significant delay and slows down EFI
> boot.
> 
> I couldn't find any mention in the MPC8536 that there should be a delay
> of 8 clock cycles between commands. The SD card specification mentions that
> the clock has to be left enabled for 8 cycles after a command or
> response. But I don't see how this delay will help with this.
> 
> Go ahead and just remove it. If there will ever be any regression we can
> introduce a compile time flag, but for now I'd like to keep it simple.
> 
> In the split off imx driver this delay was also removed in commit
> 9098682200e6 ("mmc: fsl_esdhc_imx: remove the 1ms delay before sending
> command").
> 
> Signed-off-by: Michael Walle <michael@walle.cc>


If someone can test with this patch, I think that it's more better.
But i don't have any objection to apply this patch.

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/fsl_esdhc.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 1d98fa65c4..ebb307e950 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -361,13 +361,6 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
>  	while (esdhc_read32(&regs->prsstat) & PRSSTAT_DLA)
>  		;
>  
> -	/* Wait at least 8 SD clock cycles before the next command */
> -	/*
> -	 * Note: This is way more than 8 cycles, but 1ms seems to
> -	 * resolve timing issues with some cards
> -	 */
> -	udelay(1000);
> -
>  	/* Set up for a data transfer if we have one */
>  	if (data) {
>  		err = esdhc_setup_data(priv, mmc, data);
> 


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

end of thread, other threads:[~2021-09-13 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210910092109epcas1p487290afe3a8239620d054672220069a8@epcas1p4.samsung.com>
2021-09-10  9:20 ` [PATCH] mmc: fsl_esdhc: remove 1ms sleep in esdhc_send_cmd_common() Michael Walle
2021-09-13 22:00   ` Jaehoon Chung

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.