All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Quirk for long data read time
@ 2011-11-03  8:44 Stefan Nilsson XK
  2011-11-03 11:32 ` Linus Walleij
  2011-11-12  2:40 ` Chris Ball
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Nilsson XK @ 2011-11-03  8:44 UTC (permalink / raw)
  To: linux-mmc, Chris Ball; +Cc: Per Forlin, Ulf Hansson, Stefan Nilsson XK

Adds a quirk that sets the data read timeout to a fixed value instead
of relying on the information in the CSD. The timeout value choosen
is 300ms since that has proven enough for the problematic cards found,
but could be increased if other cards require this.

This patch also enables this quirk for certain Micron cards known to
have this problem.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
---
 drivers/mmc/card/block.c |    7 +++++++
 drivers/mmc/core/core.c  |   12 ++++++++++++
 include/linux/mmc/card.h |    6 ++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 4fd5723..04af5e5 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1603,6 +1603,13 @@ static const struct mmc_fixup blk_fixups[] =
 		  MMC_QUIRK_BLK_NO_CMD23),
 	MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc,
 		  MMC_QUIRK_BLK_NO_CMD23),
+
+	/*
+	 * Some Micron MMC cards needs longer data read timeout than
+	 * indicated in CSD.
+	 */
+	MMC_FIXUP("", 0x13, 0x200, add_quirk_mmc, MMC_QUIRK_LONG_READ_TIME),
+
 	END_FIXUP
 };
 
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5278ffb..74a012a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -529,6 +529,18 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
 			data->timeout_clks = 0;
 		}
 	}
+
+	/*
+	 * Some cards require longer data read timeout than indicated in CSD.
+	 * Address this by setting the read timeout to a "reasonably high"
+	 * value. For the cards tested, 300ms has proven enough. If necessary,
+	 * this value can be increased if other problematic cards require this.
+	 */
+	if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) {
+		data->timeout_ns = 300000000;
+		data->timeout_clks = 0;
+	}
+
 	/*
 	 * Some cards need very high timeouts if driven in SPI mode.
 	 * The worst observed timeout was 900ms after writing a
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6e04e10..7ecd79d 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -218,6 +218,7 @@ struct mmc_card {
 #define MMC_QUIRK_INAND_CMD38	(1<<6)		/* iNAND devices have broken CMD38 */
 #define MMC_QUIRK_BLK_NO_CMD23	(1<<7)		/* Avoid CMD23 for regular multiblock */
 #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8)	/* Avoid sending 512 bytes in */
+#define MMC_QUIRK_LONG_READ_TIME (1<<9)		/* Data read time > CSD says */
 						/* byte mode */
 	unsigned int    poweroff_notify_state;	/* eMMC4.5 notify feature */
 #define MMC_NO_POWER_NOTIFICATION	0
@@ -433,6 +434,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
 	return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
 }
 
+static inline int mmc_card_long_read_time(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_LONG_READ_TIME;
+}
+
 #define mmc_card_name(c)	((c)->cid.prod_name)
 #define mmc_card_id(c)		(dev_name(&(c)->dev))
 
-- 
1.7.7


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

* Re: [PATCH] mmc: core: Quirk for long data read time
  2011-11-03  8:44 [PATCH] mmc: core: Quirk for long data read time Stefan Nilsson XK
@ 2011-11-03 11:32 ` Linus Walleij
  2011-11-12  2:37   ` Chris Ball
  2011-11-12  2:40 ` Chris Ball
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2011-11-03 11:32 UTC (permalink / raw)
  To: Stefan Nilsson XK; +Cc: linux-mmc, Chris Ball, Per Forlin, Ulf Hansson, stable

2011/11/3 Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>:

> Adds a quirk that sets the data read timeout to a fixed value instead
> of relying on the information in the CSD. The timeout value choosen
> is 300ms since that has proven enough for the problematic cards found,
> but could be increased if other cards require this.
>
> This patch also enables this quirk for certain Micron cards known to
> have this problem.
>
> Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>

And I thought it was enough with *people* who didn't deliver stuff
they promised in due time, now even *memory cards* miss their
own promised deadlines.... :-)

Acked-by: Linus Walleij <linus.walleij@linaro.org>

This should go into stable as well right?

Thanks,
Linus Walleij

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

* Re: [PATCH] mmc: core: Quirk for long data read time
  2011-11-03 11:32 ` Linus Walleij
@ 2011-11-12  2:37   ` Chris Ball
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2011-11-12  2:37 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Stefan Nilsson XK, linux-mmc, Per Forlin, Ulf Hansson

Hi,

On Thu, Nov 03 2011, Linus Walleij wrote:
> 2011/11/3 Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>:
>
>> Adds a quirk that sets the data read timeout to a fixed value instead
>> of relying on the information in the CSD. The timeout value choosen
>> is 300ms since that has proven enough for the problematic cards found,
>> but could be increased if other cards require this.
>>
>> This patch also enables this quirk for certain Micron cards known to
>> have this problem.
>>
>> Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
>> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
>
> And I thought it was enough with *people* who didn't deliver stuff
> they promised in due time, now even *memory cards* miss their
> own promised deadlines.... :-)
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> This should go into stable as well right?

Thanks, pushed to mmc-next for 3.2 with Linus W's ACK and a stable@ tag.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH] mmc: core: Quirk for long data read time
  2011-11-03  8:44 [PATCH] mmc: core: Quirk for long data read time Stefan Nilsson XK
  2011-11-03 11:32 ` Linus Walleij
@ 2011-11-12  2:40 ` Chris Ball
  2011-11-14  9:05   ` Ulf Hansson
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Ball @ 2011-11-12  2:40 UTC (permalink / raw)
  To: Stefan Nilsson XK; +Cc: linux-mmc, Per Forlin, Ulf Hansson

Hi,

On Thu, Nov 03 2011, Stefan Nilsson XK wrote:
> Adds a quirk that sets the data read timeout to a fixed value instead
> of relying on the information in the CSD. The timeout value choosen
> is 300ms since that has proven enough for the problematic cards found,
> but could be increased if other cards require this.
>
> This patch also enables this quirk for certain Micron cards known to
> have this problem.
>
> Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
> ---
>  drivers/mmc/card/block.c |    7 +++++++
>  drivers/mmc/core/core.c  |   12 ++++++++++++
>  include/linux/mmc/card.h |    6 ++++++
>  3 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 4fd5723..04af5e5 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1603,6 +1603,13 @@ static const struct mmc_fixup blk_fixups[] =
>  		  MMC_QUIRK_BLK_NO_CMD23),
>  	MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc,
>  		  MMC_QUIRK_BLK_NO_CMD23),
> +
> +	/*
> +	 * Some Micron MMC cards needs longer data read timeout than
> +	 * indicated in CSD.
> +	 */
> +	MMC_FIXUP("", 0x13, 0x200, add_quirk_mmc, MMC_QUIRK_LONG_READ_TIME),

I think we should use CID_NAME_ANY instead of "", so I'll push that
change unless you object.  Thanks!

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH] mmc: core: Quirk for long data read time
  2011-11-12  2:40 ` Chris Ball
@ 2011-11-14  9:05   ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2011-11-14  9:05 UTC (permalink / raw)
  To: Chris Ball; +Cc: Stefan NILSSON9, linux-mmc, Per FORLIN

Chris Ball wrote:
> Hi,
> 
> On Thu, Nov 03 2011, Stefan Nilsson XK wrote:
>> Adds a quirk that sets the data read timeout to a fixed value instead
>> of relying on the information in the CSD. The timeout value choosen
>> is 300ms since that has proven enough for the problematic cards found,
>> but could be increased if other cards require this.
>>
>> This patch also enables this quirk for certain Micron cards known to
>> have this problem.
>>
>> Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
>> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
>> ---
>>  drivers/mmc/card/block.c |    7 +++++++
>>  drivers/mmc/core/core.c  |   12 ++++++++++++
>>  include/linux/mmc/card.h |    6 ++++++
>>  3 files changed, 25 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 4fd5723..04af5e5 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -1603,6 +1603,13 @@ static const struct mmc_fixup blk_fixups[] =
>>  		  MMC_QUIRK_BLK_NO_CMD23),
>>  	MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc,
>>  		  MMC_QUIRK_BLK_NO_CMD23),
>> +
>> +	/*
>> +	 * Some Micron MMC cards needs longer data read timeout than
>> +	 * indicated in CSD.
>> +	 */
>> +	MMC_FIXUP("", 0x13, 0x200, add_quirk_mmc, MMC_QUIRK_LONG_READ_TIME),
> 
> I think we should use CID_NAME_ANY instead of "", so I'll push that
> change unless you object.  Thanks!

No objections, that will work as well!


BR
Ulf Hansson

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

end of thread, other threads:[~2011-11-14  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03  8:44 [PATCH] mmc: core: Quirk for long data read time Stefan Nilsson XK
2011-11-03 11:32 ` Linus Walleij
2011-11-12  2:37   ` Chris Ball
2011-11-12  2:40 ` Chris Ball
2011-11-14  9:05   ` 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.