All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc:sdio:retry CMD52/53 when error happens
@ 2012-05-14  8:39 yongd
  2012-05-14 11:57 ` S, Venkatraman
  2012-05-14 12:57 ` Ulf Hansson
  0 siblings, 2 replies; 5+ messages in thread
From: yongd @ 2012-05-14  8:39 UTC (permalink / raw)
  To: cjb, linux-mmc
  Cc: stefan.xk.nilsson, linus.walleij, ulf.hansson, svenkatr,
	linux-kernel, yongd

  Set sdio CMD52/53's retry time as MMC_CMD_RETRIES. As a result,
sdio might benefit from core-internal CMD retry mechanism when
some errors happen(CRC, etc).

Signed-off-by: yongd <yongd@marvell.com>
---
 drivers/mmc/core/sdio_ops.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index d29e206..884c27e 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -86,7 +86,7 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
 	cmd.arg |= in;
 	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
 
-	err = mmc_wait_for_cmd(host, &cmd, 0);
+	err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
 	if (err)
 		return err;
 
@@ -147,6 +147,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	else
 		cmd.arg |= 0x08000000 | blocks;		/* block mode */
 	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
+	cmd.retries = MMC_CMD_RETRIES;
 
 	data.blksz = blksz;
 	/* Code in host drivers/fwk assumes that "blocks" always is >=1 */
-- 
1.7.9.5


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

* Re: [PATCH] mmc:sdio:retry CMD52/53 when error happens
  2012-05-14  8:39 [PATCH] mmc:sdio:retry CMD52/53 when error happens yongd
@ 2012-05-14 11:57 ` S, Venkatraman
  2012-05-14 12:57 ` Ulf Hansson
  1 sibling, 0 replies; 5+ messages in thread
From: S, Venkatraman @ 2012-05-14 11:57 UTC (permalink / raw)
  To: yongd
  Cc: cjb, linux-mmc, stefan.xk.nilsson, linus.walleij, ulf.hansson,
	linux-kernel

On Mon, May 14, 2012 at 2:09 PM, yongd <yongd@marvell.com> wrote:
>  Set sdio CMD52/53's retry time as MMC_CMD_RETRIES. As a result,
> sdio might benefit from core-internal CMD retry mechanism when
> some errors happen(CRC, etc).
>
> Signed-off-by: yongd <yongd@marvell.com>
> ---
>  drivers/mmc/core/sdio_ops.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index d29e206..884c27e 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -86,7 +86,7 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
>        cmd.arg |= in;
>        cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
>
> -       err = mmc_wait_for_cmd(host, &cmd, 0);
> +       err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
>        if (err)
>                return err;
>
> @@ -147,6 +147,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>        else
>                cmd.arg |= 0x08000000 | blocks;         /* block mode */
>        cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
> +       cmd.retries = MMC_CMD_RETRIES;
>
>        data.blksz = blksz;
>        /* Code in host drivers/fwk assumes that "blocks" always is >=1 */
> --

Looks right to me.
Reviewed-by: Venkatraman S <svenkatr@ti.com>

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

* Re: [PATCH] mmc:sdio:retry CMD52/53 when error happens
  2012-05-14  8:39 [PATCH] mmc:sdio:retry CMD52/53 when error happens yongd
  2012-05-14 11:57 ` S, Venkatraman
@ 2012-05-14 12:57 ` Ulf Hansson
  2012-05-15  3:14   ` Yong Ding
  1 sibling, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2012-05-14 12:57 UTC (permalink / raw)
  To: yongd
  Cc: cjb, linux-mmc, stefan.xk.nilsson, linus.walleij, svenkatr, linux-kernel

Hi Yongd,

 From my perspective I don't think this patch is wanted.

A retry mechanism is likely very much hw-SDIO device dependent. Upper 
layers (SDIO func driver) is thus the only software that is able to 
handle retries correctly.

Kind regards
Ulf Hansson


On 05/14/2012 10:39 AM, yongd wrote:
>    Set sdio CMD52/53's retry time as MMC_CMD_RETRIES. As a result,
> sdio might benefit from core-internal CMD retry mechanism when
> some errors happen(CRC, etc).
>
> Signed-off-by: yongd<yongd@marvell.com>
> ---
>   drivers/mmc/core/sdio_ops.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index d29e206..884c27e 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -86,7 +86,7 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
>   	cmd.arg |= in;
>   	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
>
> -	err = mmc_wait_for_cmd(host,&cmd, 0);
> +	err = mmc_wait_for_cmd(host,&cmd, MMC_CMD_RETRIES);
>   	if (err)
>   		return err;
>
> @@ -147,6 +147,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>   	else
>   		cmd.arg |= 0x08000000 | blocks;		/* block mode */
>   	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
> +	cmd.retries = MMC_CMD_RETRIES;
>
>   	data.blksz = blksz;
>   	/* Code in host drivers/fwk assumes that "blocks" always is>=1 */


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

* RE: [PATCH] mmc:sdio:retry CMD52/53 when error happens
  2012-05-14 12:57 ` Ulf Hansson
@ 2012-05-15  3:14   ` Yong Ding
  2012-05-15  7:15     ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Yong Ding @ 2012-05-15  3:14 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: cjb, linux-mmc, stefan.xk.nilsson, linus.walleij, svenkatr, linux-kernel

Hi Ulf Hansson,
Thanks for your comments.

Such retry mechanism is a simple CMD-level or sdio-core-level retry which takes advantage of the mmc core internal retry. There is not any side effect, but with it, even those SDIO function driver's without its own retrying mechanism can benefit in some conditions.

Besides, for CMD52, it can be used during SDIO card initialization/detection phase. At that time, SDIO function driver hasn't started to work. Of course we can probably encounter CMD52 error due to some reasons(eg, board-level schematic bad behavior), and such retry can be a potential workaround. Actually, we've encountered exactly such case in our development.


Best Wishes,

Yong Ding
Operating Systems Engineering,
Application Processor Systems Engineering

-----Original Message-----
From: Ulf Hansson [mailto:ulf.hansson@stericsson.com] 
Sent: Monday, May 14, 2012 8:58 PM
To: Yong Ding
Cc: cjb@laptop.org; linux-mmc@vger.kernel.org; stefan.xk.nilsson@stericsson.com; linus.walleij@linaro.org; svenkatr@ti.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc:sdio:retry CMD52/53 when error happens

Hi Yongd,

 From my perspective I don't think this patch is wanted.

A retry mechanism is likely very much hw-SDIO device dependent. Upper 
layers (SDIO func driver) is thus the only software that is able to 
handle retries correctly.

Kind regards
Ulf Hansson


On 05/14/2012 10:39 AM, yongd wrote:
>    Set sdio CMD52/53's retry time as MMC_CMD_RETRIES. As a result,
> sdio might benefit from core-internal CMD retry mechanism when
> some errors happen(CRC, etc).
>
> Signed-off-by: yongd<yongd@marvell.com>
> ---
>   drivers/mmc/core/sdio_ops.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index d29e206..884c27e 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -86,7 +86,7 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
>   	cmd.arg |= in;
>   	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
>
> -	err = mmc_wait_for_cmd(host,&cmd, 0);
> +	err = mmc_wait_for_cmd(host,&cmd, MMC_CMD_RETRIES);
>   	if (err)
>   		return err;
>
> @@ -147,6 +147,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>   	else
>   		cmd.arg |= 0x08000000 | blocks;		/* block mode */
>   	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
> +	cmd.retries = MMC_CMD_RETRIES;
>
>   	data.blksz = blksz;
>   	/* Code in host drivers/fwk assumes that "blocks" always is>=1 */


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

* Re: [PATCH] mmc:sdio:retry CMD52/53 when error happens
  2012-05-15  3:14   ` Yong Ding
@ 2012-05-15  7:15     ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2012-05-15  7:15 UTC (permalink / raw)
  To: Yong Ding
  Cc: cjb, linux-mmc, stefan.xk.nilsson, linus.walleij, svenkatr, linux-kernel

Hi Yong Ding,

On 05/15/2012 05:14 AM, Yong Ding wrote:
> Hi Ulf Hansson, Thanks for your comments.
>
> Such retry mechanism is a simple CMD-level or sdio-core-level retry
> which takes advantage of the mmc core internal retry. There is not
> any side effect, but with it, even those SDIO function driver's
> without its own retrying mechanism can benefit in some conditions.

I am not sure about that. It all depends on what kind of protocol the 
SDIO func driver is handling and as well what SDIO hw that is connected.

For a WLAN interface you might end up in reading/writing the next 
buffer, maybe messing up even more data. Have you considered this?

>
> Besides, for CMD52, it can be used during SDIO card
> initialization/detection phase. At that time, SDIO function driver
> hasn't started to work. Of course we can probably encounter CMD52
> error due to some reasons(eg, board-level schematic bad behavior),
> and such retry can be a potential workaround. Actually, we've
> encountered exactly such case in our development.

I realize that there is a need for this, but I am not sure we always 
would like to have "retries" for every CMD52/53 request.

During SDIO initialization before SDIO func driver is started, retries 
should be safe since there is no upper protocol to consider yet. Maybe 
we should try to create a patch which only enables retries during SDIO 
init sequence instead!?

Kind regards
Ulf Hansson

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

end of thread, other threads:[~2012-05-15  7:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14  8:39 [PATCH] mmc:sdio:retry CMD52/53 when error happens yongd
2012-05-14 11:57 ` S, Venkatraman
2012-05-14 12:57 ` Ulf Hansson
2012-05-15  3:14   ` Yong Ding
2012-05-15  7:15     ` Ulf Hansson

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.