Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-14 Thread Paul Walmsley
Hi Chris,

On Thu, 12 Apr 2012, Chris Ball wrote:

 If I understand correctly, the only problem here is the presence of the
 warning, so I'm leaning towards just removing it (which we've already
 had another request for) or making it pr_debug() instead.  Sound okay?

Sounds okay to me.

We'll probably also need to take a look at the drivers that don't 
range-check their timeouts.


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-12 Thread Tushar Behera
On 04/06/2012 05:24 AM, Chris Ball wrote:
 Hi Paul,
 
 On Thu, Apr 05 2012, Paul Walmsley wrote:
 I'm really sorry for the long delay!

 On Thu, 5 Apr 2012, Chris Ball wrote:

 Thanks.  Paul, just waiting for your Signed-off-by.

 Signed-off-by: Paul Walmsley p...@pwsan.com
 
 Thanks, no problem!  Pushed to mmc-next for 3.4.
 
 - Chris.
With this patch, I continuously get following message on my console.
(Tested on Origen board, based on EXYNOS4210).

mmc0: Too large timeout requested for CMD25!

So, with this change, should we update sdhci_calc_timeout() also?

-- 
Tushar Behera
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-12 Thread Paul Walmsley
Hello Tushar,

On Thu, 12 Apr 2012, Tushar Behera wrote:

 With this patch, I continuously get following message on my console.
 (Tested on Origen board, based on EXYNOS4210).
 
 mmc0: Too large timeout requested for CMD25!
 
 So, with this change, should we update sdhci_calc_timeout() also?

Looks like most of the host drivers that range-check the timeout value 
silently clamp it at the hardware-supported maximum value:

drivers/mmc/host/atmel-mci.c
drivers/mmc/host/davinci_mmc.c
drivers/mmc/host/mvsdio.c
drivers/mmc/host/omap_hsmmc.c
drivers/mmc/host/wbsd.c
drivers/mmc/host/tifm_sd.c

So maybe try the same thing for your driver?

Of course it seems that some drivers don't range-check the timeout value 
at all :-(

drivers/mmc/host/bfin_sdh.c
drivers/mmc/host/mmci.c
drivers/mmc/host/msm_sdcc.c
drivers/mmc/host/pxamci.c
drivers/mmc/host/mxs-mmc.c
drivers/mmc/host/omap.c



- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-12 Thread Chris Ball
Hi,

On Thu, Apr 12 2012, Paul Walmsley wrote:
 With this patch, I continuously get following message on my console.
 (Tested on Origen board, based on EXYNOS4210).
 
 mmc0: Too large timeout requested for CMD25!
 
 So, with this change, should we update sdhci_calc_timeout() also?

 Looks like most of the host drivers that range-check the timeout value 
 silently clamp it at the hardware-supported maximum value:

If I understand correctly, the only problem here is the presence of the
warning, so I'm leaning towards just removing it (which we've already
had another request for) or making it pr_debug() instead.  Sound okay?

Thanks,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-05 Thread Tony Lindgren
* Chris Ball c...@laptop.org [120315 20:26]:
 Hi Paul,
 
 On Mon, Mar 12 2012, Paul Walmsley wrote:
  I don't think this is the right fix.  Steve Sakoman and I discussed this a 
  few months ago -- we did some debugging and Steve observed the timeouts on 
  multiple block writes (0x19):
  [...]
  So perhaps something like the following patch instead?  Unfortunately, I 
  don't have one of these crappy SD cards as far as I know, so I can't 
  really test it.
 
 
  - Paul
 
  From: Paul Walmsley p...@pwsan.com
  Date: Mon, 12 Mar 2012 04:46:29 -0600
  Subject: [PATCH] mmc: use really long write timeout to deal with crappy 
  cards
 
  Several people have noticed that crappy SD cards take much longer to
  complete multiple block writes than the 300ms that Linux specifies.
  Try to work around this by using a three second write timeout instead.
 
  insert Chase's patch description here
 
  Not-yet-signed-off-by: Paul Walmsley p...@pwsan.com
 
 Sounds like a good idea -- want to send a signed-off patch for this?

This seems like the right fix to me too. Works on my pandaboard es and
some random card that produces I/O errors without this.

Tested-by: Tony Lindgren t...@atomide.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-05 Thread Chris Ball
Hi,

On Thu, Apr 05 2012, Tony Lindgren wrote:
 * Chris Ball c...@laptop.org [120315 20:26]:
 Hi Paul,
 
 On Mon, Mar 12 2012, Paul Walmsley wrote:
  I don't think this is the right fix.  Steve Sakoman and I discussed this a 
  few months ago -- we did some debugging and Steve observed the timeouts on 
  multiple block writes (0x19):
  [...]
  So perhaps something like the following patch instead?  Unfortunately, I 
  don't have one of these crappy SD cards as far as I know, so I can't 
  really test it.
 
 
  - Paul
 
  From: Paul Walmsley p...@pwsan.com
  Date: Mon, 12 Mar 2012 04:46:29 -0600
  Subject: [PATCH] mmc: use really long write timeout to deal with crappy 
  cards
 
  Several people have noticed that crappy SD cards take much longer to
  complete multiple block writes than the 300ms that Linux specifies.
  Try to work around this by using a three second write timeout instead.
 
  insert Chase's patch description here
 
  Not-yet-signed-off-by: Paul Walmsley p...@pwsan.com
 
 Sounds like a good idea -- want to send a signed-off patch for this?

 This seems like the right fix to me too. Works on my pandaboard es and
 some random card that produces I/O errors without this.

 Tested-by: Tony Lindgren t...@atomide.com

Thanks.  Paul, just waiting for your Signed-off-by.

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-05 Thread Paul Walmsley
Hi Chris,

I'm really sorry for the long delay!

On Thu, 5 Apr 2012, Chris Ball wrote:

 Thanks.  Paul, just waiting for your Signed-off-by.

Signed-off-by: Paul Walmsley p...@pwsan.com


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-04-05 Thread Chris Ball
Hi Paul,

On Thu, Apr 05 2012, Paul Walmsley wrote:
 I'm really sorry for the long delay!

 On Thu, 5 Apr 2012, Chris Ball wrote:

 Thanks.  Paul, just waiting for your Signed-off-by.

 Signed-off-by: Paul Walmsley p...@pwsan.com

Thanks, no problem!  Pushed to mmc-next for 3.4.

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-15 Thread Chris Ball
Hi Paul,

On Mon, Mar 12 2012, Paul Walmsley wrote:
 I don't think this is the right fix.  Steve Sakoman and I discussed this a 
 few months ago -- we did some debugging and Steve observed the timeouts on 
 multiple block writes (0x19):
 [...]
 So perhaps something like the following patch instead?  Unfortunately, I 
 don't have one of these crappy SD cards as far as I know, so I can't 
 really test it.


 - Paul

 From: Paul Walmsley p...@pwsan.com
 Date: Mon, 12 Mar 2012 04:46:29 -0600
 Subject: [PATCH] mmc: use really long write timeout to deal with crappy cards

 Several people have noticed that crappy SD cards take much longer to
 complete multiple block writes than the 300ms that Linux specifies.
 Try to work around this by using a three second write timeout instead.

 insert Chase's patch description here

 Not-yet-signed-off-by: Paul Walmsley p...@pwsan.com

Sounds like a good idea -- want to send a signed-off patch for this?

Thanks,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-12 Thread Paul Walmsley
+ Steve Sakoman

Hi Chris, Chase,

Sorry for the late comment on this; I just noticed this thread.

On Thu, 8 Mar 2012, Chris Ball wrote:

 On Thu, Mar 01 2012, Chase Maupin wrote:
  * With certain SD cards timeouts like the following have been seen
due to an improper calculation of the dto value:
  mmcblk0: error -110 transferring data, sector 4126233, nr 8,
  card status 0xc00
  * By removing the dto calculation and setting the timeout value
to the maximum specified by the SD card specification part A2
section 2.2.15 these timeouts can be avoided.
  * This change has been used by beagleboard users as well as the
Texas Instruments SDK without a negative impact.
  * There are multiple discussion threads about this but the most
relevant ones are:
  * http://talk.maemo.org/showthread.php?p=1000707#post1000707
  * http://www.mail-archive.com/linux-omap@vger.kernel.org/msg42213.html
  * Original proposal for this fix was done by Sukumar Ghoral of
Texas Instruments
 
  * Tested using a Texas Instruments AM335x EVM
 
  Signed-off-by: Chase Maupin chase.mau...@ti.com
 
 Thanks, I've pushed this to mmc-next for 3.4.  (With a trivial
 indentation fix, below.)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 82b400793..9d4ce1c 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -1360,7 +1360,7 @@ static void set_data_timeout(struct omap_hsmmc_host 
 *host)
   if (clkd == 0)
   clkd = 1;
  
 -/* Use the maximum timeout value allowed in the standard of 14 or 0xE */
 + /* Use the maximum timeout value allowed in the standard of 14 or 0xE */
   dto = 14;
  
   reg = ~DTO_MASK;

I don't think this is the right fix.  Steve Sakoman and I discussed this a 
few months ago -- we did some debugging and Steve observed the timeouts on 
multiple block writes (0x19):

hsmmc: command 0019
hsmmc: orig_rate = 9600, div = 2, dto = 11
hsmmc: using 3 ns DTO
hsmmc: command 000d
mmcblk0: error -110 transferring data, sector 15257840, nr 96, card status 0xc00

So dto = 11 @ 48MHz is a 350ms timeout ((2^(11+13)) / 4800).

I don't have an SD bus analyzer, but it looks to me think there are some 
SD cards that are not completing the write within the allotted time 
window.  It should be 250ms according to this SD spec:

https://www.sdcard.org/developers/tech/pls/simplified_specs/Part_1_Physical_Layer_Simplified_Specification_Ver_3.01_Final_100518.pdf

The spec also says It is strongly recommended for hosts to implement more 
than 500ms timeout value even if the card indicates the 250ms maximum busy 
length.

So to me, this should probably be solved in the generic Linux MMC layer.  
mmc_set_data_timeout() should presumably be using a huge timeout on 
writes.  Don't know what it should be but the current 300ms goal is 
arbitrary anyway - see commit 493890e75d98810a3470b4aae23be628ee5e9667 
(mmc: increase SD write timeout for crappy cards).

Otherwise, if we just change the OMAP host controller driver, we could run 
into the same problem on other controllers.  While this issue could be an 
OMAP specific problem, at the moment I don't see any obvious evidence of 
that.

So perhaps something like the following patch instead?  Unfortunately, I 
don't have one of these crappy SD cards as far as I know, so I can't 
really test it.


- Paul

From: Paul Walmsley p...@pwsan.com
Date: Mon, 12 Mar 2012 04:46:29 -0600
Subject: [PATCH] mmc: use really long write timeout to deal with crappy cards

Several people have noticed that crappy SD cards take much longer to
complete multiple block writes than the 300ms that Linux specifies.
Try to work around this by using a three second write timeout instead.

insert Chase's patch description here

Not-yet-signed-off-by: Paul Walmsley p...@pwsan.com
---
 drivers/mmc/core/core.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 690255c..0f2caca 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -526,10 +526,14 @@ void mmc_set_data_timeout(struct mmc_data *data, const 
struct mmc_card *card)
 
if (data-flags  MMC_DATA_WRITE)
/*
-* The limit is really 250 ms, but that is
-* insufficient for some crappy cards.
+* The MMC spec It is strongly recommended
+* for hosts to implement more than 500ms
+* timeout value even if the card indicates
+* the 250ms maximum busy length.  Even the
+* previous value of 300ms is known to be
+* insufficient for some cards.
 */
-   limit_us = 30;
+   limit_us = 300;
else
limit_us = 

Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-12 Thread Paul Walmsley
On Mon, 12 Mar 2012, Paul Walmsley wrote:

 I don't have an SD bus analyzer, but it looks to me think there are some 
 SD cards that are not completing the write within the allotted time 
 window.

Heh, sorry.  This should, of course, read looks to me _that_.  Sigh...


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-12 Thread Maupin, Chase
 -Original Message-
 From: Paul Walmsley [mailto:p...@pwsan.com]
 Sent: Monday, March 12, 2012 5:58 AM
 To: Chris Ball
 Cc: Maupin, Chase; linux-omap@vger.kernel.org; linux-
 m...@vger.kernel.org; sako...@gmail.com
 Subject: Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices
 
 + Steve Sakoman
 
 Hi Chris, Chase,
 
 Sorry for the late comment on this; I just noticed this thread.
 
 On Thu, 8 Mar 2012, Chris Ball wrote:
 
  On Thu, Mar 01 2012, Chase Maupin wrote:
   * With certain SD cards timeouts like the following have been
 seen
 due to an improper calculation of the dto value:
   mmcblk0: error -110 transferring data, sector 4126233, nr
 8,
   card status 0xc00
   * By removing the dto calculation and setting the timeout value
 to the maximum specified by the SD card specification part A2
 section 2.2.15 these timeouts can be avoided.
   * This change has been used by beagleboard users as well as the
 Texas Instruments SDK without a negative impact.
   * There are multiple discussion threads about this but the most
 relevant ones are:
   *
 http://talk.maemo.org/showthread.php?p=1000707#post1000707
   * http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg42213.html
   * Original proposal for this fix was done by Sukumar Ghoral of
 Texas Instruments
  
   * Tested using a Texas Instruments AM335x EVM
  
   Signed-off-by: Chase Maupin chase.mau...@ti.com
 
  Thanks, I've pushed this to mmc-next for 3.4.  (With a trivial
  indentation fix, below.)
 
  diff --git a/drivers/mmc/host/omap_hsmmc.c
 b/drivers/mmc/host/omap_hsmmc.c
  index 82b400793..9d4ce1c 100644
  --- a/drivers/mmc/host/omap_hsmmc.c
  +++ b/drivers/mmc/host/omap_hsmmc.c
  @@ -1360,7 +1360,7 @@ static void set_data_timeout(struct
 omap_hsmmc_host *host)
  if (clkd == 0)
  clkd = 1;
 
  -/* Use the maximum timeout value allowed in the standard of
 14 or 0xE */
  +   /* Use the maximum timeout value allowed in the standard of
 14 or 0xE */
  dto = 14;
 
  reg = ~DTO_MASK;
 
 I don't think this is the right fix.  Steve Sakoman and I discussed
 this a
 few months ago -- we did some debugging and Steve observed the
 timeouts on
 multiple block writes (0x19):
 
 hsmmc: command 0019
 hsmmc: orig_rate = 9600, div = 2, dto = 11
 hsmmc: using 3 ns DTO
 hsmmc: command 000d
 mmcblk0: error -110 transferring data, sector 15257840, nr 96, card
 status 0xc00
 
 So dto = 11 @ 48MHz is a 350ms timeout ((2^(11+13)) / 4800).
 
 I don't have an SD bus analyzer, but it looks to me think there are
 some
 SD cards that are not completing the write within the allotted time
 window.  It should be 250ms according to this SD spec:
 
 https://www.sdcard.org/developers/tech/pls/simplified_specs/Part_1_
 Physical_Layer_Simplified_Specification_Ver_3.01_Final_100518.pdf
 
 The spec also says It is strongly recommended for hosts to
 implement more
 than 500ms timeout value even if the card indicates the 250ms
 maximum busy
 length.
 
 So to me, this should probably be solved in the generic Linux MMC
 layer.
 mmc_set_data_timeout() should presumably be using a huge timeout on
 writes.  Don't know what it should be but the current 300ms goal is
 arbitrary anyway - see commit
 493890e75d98810a3470b4aae23be628ee5e9667
 (mmc: increase SD write timeout for crappy cards).
 
 Otherwise, if we just change the OMAP host controller driver, we
 could run
 into the same problem on other controllers.  While this issue could
 be an
 OMAP specific problem, at the moment I don't see any obvious
 evidence of
 that.
 
 So perhaps something like the following patch instead?
 Unfortunately, I
 don't have one of these crappy SD cards as far as I know, so I
 can't
 really test it.

I would be OK with that.  I picked the dto=14 because it has worked for us as 
well as that being the max value I saw defined in section 2 of the spec 
(section 2.2.15 to be exact).  If you want to pull this up to be more generic I 
think that makes sense.

 
 
 - Paul
 
 From: Paul Walmsley p...@pwsan.com
 Date: Mon, 12 Mar 2012 04:46:29 -0600
 Subject: [PATCH] mmc: use really long write timeout to deal with
 crappy cards
 
 Several people have noticed that crappy SD cards take much longer
 to
 complete multiple block writes than the 300ms that Linux specifies.
 Try to work around this by using a three second write timeout
 instead.
 
 insert Chase's patch description here
 
 Not-yet-signed-off-by: Paul Walmsley p...@pwsan.com
 ---
  drivers/mmc/core/core.c |   10 +++---
  1 files changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
 index 690255c..0f2caca 100644
 --- a/drivers/mmc/core/core.c
 +++ b/drivers/mmc/core/core.c
 @@ -526,10 +526,14 @@ void mmc_set_data_timeout(struct mmc_data
 *data, const struct mmc_card *card)
 
   if (data-flags  MMC_DATA_WRITE)
   /*
 -  * The limit is really

RE: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-09 Thread Maupin, Chase
 -Original Message-
 From: Chris Ball [mailto:c...@laptop.org]
 Sent: Thursday, March 08, 2012 10:39 PM
 To: Maupin, Chase
 Cc: linux-omap@vger.kernel.org; linux-...@vger.kernel.org
 Subject: Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices
 
 Hi Chase,
 
 On Thu, Mar 01 2012, Chase Maupin wrote:
  * With certain SD cards timeouts like the following have been
 seen
due to an improper calculation of the dto value:
  mmcblk0: error -110 transferring data, sector 4126233, nr 8,
  card status 0xc00
  * By removing the dto calculation and setting the timeout value
to the maximum specified by the SD card specification part A2
section 2.2.15 these timeouts can be avoided.
  * This change has been used by beagleboard users as well as the
Texas Instruments SDK without a negative impact.
  * There are multiple discussion threads about this but the most
relevant ones are:
  * http://talk.maemo.org/showthread.php?p=1000707#post1000707
  * http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg42213.html
  * Original proposal for this fix was done by Sukumar Ghoral of
Texas Instruments
 
  * Tested using a Texas Instruments AM335x EVM
 
  Signed-off-by: Chase Maupin chase.mau...@ti.com
 
 Thanks, I've pushed this to mmc-next for 3.4.  (With a trivial
 indentation fix, below.)

Thank you Chris.

 
 diff --git a/drivers/mmc/host/omap_hsmmc.c
 b/drivers/mmc/host/omap_hsmmc.c
 index 82b400793..9d4ce1c 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -1360,7 +1360,7 @@ static void set_data_timeout(struct
 omap_hsmmc_host *host)
   if (clkd == 0)
   clkd = 1;
 
 -/* Use the maximum timeout value allowed in the standard of 14
 or 0xE */
 + /* Use the maximum timeout value allowed in the standard of
 14 or 0xE */
   dto = 14;
 
   reg = ~DTO_MASK;
 
 
 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-08 Thread Chris Ball
Hi Chase,

On Thu, Mar 01 2012, Chase Maupin wrote:
 * With certain SD cards timeouts like the following have been seen
   due to an improper calculation of the dto value:
 mmcblk0: error -110 transferring data, sector 4126233, nr 8,
 card status 0xc00
 * By removing the dto calculation and setting the timeout value
   to the maximum specified by the SD card specification part A2
   section 2.2.15 these timeouts can be avoided.
 * This change has been used by beagleboard users as well as the
   Texas Instruments SDK without a negative impact.
 * There are multiple discussion threads about this but the most
   relevant ones are:
 * http://talk.maemo.org/showthread.php?p=1000707#post1000707
 * http://www.mail-archive.com/linux-omap@vger.kernel.org/msg42213.html
 * Original proposal for this fix was done by Sukumar Ghoral of
   Texas Instruments

 * Tested using a Texas Instruments AM335x EVM

 Signed-off-by: Chase Maupin chase.mau...@ti.com

Thanks, I've pushed this to mmc-next for 3.4.  (With a trivial
indentation fix, below.)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 82b400793..9d4ce1c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1360,7 +1360,7 @@ static void set_data_timeout(struct omap_hsmmc_host *host)
if (clkd == 0)
clkd = 1;
 
-/* Use the maximum timeout value allowed in the standard of 14 or 0xE */
+   /* Use the maximum timeout value allowed in the standard of 14 or 0xE */
dto = 14;
 
reg = ~DTO_MASK;


- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices

2012-03-06 Thread Maupin, Chase
Ping on this patch.  I have not seen any response on the list but if I have 
missed something please let me know.

 -Original Message-
 From: Maupin, Chase
 Sent: Thursday, March 01, 2012 11:26 AM
 To: linux-omap@vger.kernel.org; linux-...@vger.kernel.org
 Cc: Maupin, Chase
 Subject: [PATCH] mmc: omap_hsmmc: set dto to 14 for all devices
 
 * With certain SD cards timeouts like the following have been seen
   due to an improper calculation of the dto value:
 mmcblk0: error -110 transferring data, sector 4126233, nr 8,
 card status 0xc00
 * By removing the dto calculation and setting the timeout value
   to the maximum specified by the SD card specification part A2
   section 2.2.15 these timeouts can be avoided.
 * This change has been used by beagleboard users as well as the
   Texas Instruments SDK without a negative impact.
 * There are multiple discussion threads about this but the most
   relevant ones are:
 * http://talk.maemo.org/showthread.php?p=1000707#post1000707
 * http://www.mail-archive.com/linux-
 o...@vger.kernel.org/msg42213.html
 * Original proposal for this fix was done by Sukumar Ghoral of
   Texas Instruments
 
 * Tested using a Texas Instruments AM335x EVM
 
 Signed-off-by: Chase Maupin chase.mau...@ti.com
 ---
  drivers/mmc/host/omap_hsmmc.c |   30 +
 -
  1 files changed, 5 insertions(+), 25 deletions(-)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c
 b/drivers/mmc/host/omap_hsmmc.c
 index fd0c661..afd7292 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -1481,11 +1481,8 @@ static int
 omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host,
   return 0;
  }
 
 -static void set_data_timeout(struct omap_hsmmc_host *host,
 -  unsigned int timeout_ns,
 -  unsigned int timeout_clks)
 +static void set_data_timeout(struct omap_hsmmc_host *host)
  {
 - unsigned int timeout, cycle_ns;
   uint32_t reg, clkd, dto = 0;
 
   reg = OMAP_HSMMC_READ(host-base, SYSCTL);
 @@ -1493,25 +1490,8 @@ static void set_data_timeout(struct
 omap_hsmmc_host *host,
   if (clkd == 0)
   clkd = 1;
 
 - cycle_ns = 10 / (clk_get_rate(host-fclk) / clkd);
 - timeout = timeout_ns / cycle_ns;
 - timeout += timeout_clks;
 - if (timeout) {
 - while ((timeout  0x8000) == 0) {
 - dto += 1;
 - timeout = 1;
 - }
 - dto = 31 - dto;
 - timeout = 1;
 - if (timeout  dto)
 - dto += 1;
 - if (dto = 13)
 - dto -= 13;
 - else
 - dto = 0;
 - if (dto  14)
 - dto = 14;
 - }
 +/* Use the maximum timeout value allowed in the standard of 14
 or 0xE */
 + dto = 14;
 
   reg = ~DTO_MASK;
   reg |= dto  DTO_SHIFT;
 @@ -1534,13 +1514,13 @@ omap_hsmmc_prepare_data(struct
 omap_hsmmc_host *host, struct mmc_request *req)
* busy signal.
*/
   if (req-cmd-flags  MMC_RSP_BUSY)
 - set_data_timeout(host, 1U, 0);
 + set_data_timeout(host);
   return 0;
   }
 
   OMAP_HSMMC_WRITE(host-base, BLK, (req-data-blksz)
   | (req-data-blocks  16));
 - set_data_timeout(host, req-data-timeout_ns, req-data-
 timeout_clks);
 + set_data_timeout(host);
 
   if (host-use_dma) {
   ret = omap_hsmmc_start_dma_transfer(host, req);
 --
 1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html