Skip to contentSkip to conversation

PXAMMC: Drop different delays for PXA27X

PATCH New Marek Vasut 2 participants 6 messages Apr 5, 2010 – Apr 24, 2010 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

---
 drivers/mmc/pxa_mmc.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/mmc/pxa_mmc.c +0 -8
index 8225235..b155541 100644
@@ -584,11 +584,7 @@ mmc_legacy_init(int verbose)
 			debug("Detected SD card\n");
 			break;
 		}
-#ifdef CONFIG_PXA27X
-		udelay(10000);
-#else
 		udelay(200000);
-#endif
 	}
 
 	if (retries <= 0 || !(IF_TYPE_SD == mmc_dev.if_type)) {
@@ -598,11 +594,7 @@ mmc_legacy_init(int verbose)
 
 		retries = 10;
 		while (retries-- && resp && !(resp[0] & 0x80000000)) {
-#ifdef CONFIG_PXA27X
-			udelay(10000);
-#else
 			udelay(200000);
-#endif
 			resp =
 			    mmc_cmd(MMC_CMD_SEND_OP_COND, 0x00ff, 0x8000,
 				    MMC_CMDAT_R3);
Signature · 1 line
1.7.0
#1 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

Dne Po 5. dubna 2010 02:32:50 Marek Vasut napsal(a):

Quoted 27 lines

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

---
 drivers/mmc/pxa_mmc.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/mmc/pxa_mmc.c +0 -4
index 8225235..b155541 100644
@@ -584,11 +584,7 @@ mmc_legacy_init(int verbose)
 			debug("Detected SD card\n");
 			break;
 		}
-#ifdef CONFIG_PXA27X
-		udelay(10000);
-#else
 		udelay(200000);
-#endif
 	}
 
 	if (retries <= 0 || !(IF_TYPE_SD == mmc_dev.if_type)) {
@@ -598,11 +594,7 @@ mmc_legacy_init(int verbose)
 

drivers/mmc/pxa_mmc.c mmc_legacy_init(int verbose) · line 600

Quoted 10 lines
drivers/mmc/pxa_mmc.c +0 -4
 		retries = 10;
 		while (retries-- && resp && !(resp[0] & 0x80000000)) {
-#ifdef CONFIG_PXA27X
-			udelay(10000);
-#else
 			udelay(200000);
-#endif
 			resp =
 			    mmc_cmd(MMC_CMD_SEND_OP_COND, 0x00ff, 0x8000,
 				    MMC_CMDAT_R3);

CCed Andy Fleming. Please review. Thanks.

#2 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

In reply to Marek Vasut
Quoted 3 lines · Marek Vasut

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

In general, I object to board-specific #ifdefs in drivers. At the very least, change this so that the value
is specified like so:

#ifndef PXA_TIMEOUT_DELAY
#define PXA_TIMEOUT_DELAY 10000
#endif

And then override the value in the PXA27X config file.

That way, when the next board comes along, and someone objects to waiting a fifth of a second between each try, but they need more than 10,000us, they can override it to a different value without doing cascading #ifdefs.

Andy

#3 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

Dne So 24. dubna 2010 03:13:07 Andy Fleming napsal(a):

Quoted 7 lines · Marek Vasut
Quoted 4 lines

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

In general, I object to board-specific #ifdefs in drivers.

This is not a board specific ifdef.

Quoted 9 lines

At the
very least, change this so that the value
is specified like so:

#ifndef PXA_TIMEOUT_DELAY
#define PXA_TIMEOUT_DELAY 10000
#endif

And then override the value in the PXA27X config file.

No need to override anything.

Quoted 5 lines

That way, when the next board comes along, and someone objects to waiting a fifth of a second between each try, but they need more than 10,000us, they can override it to a different value without doing cascading #ifdefs.

There won't be any ifdefs or board specific goo.

Quoted 2 lines

Andy

#4 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

Quoted 10 lines · Marek Vasut

Dne So 24. dubna 2010 03:13:07 Andy Fleming napsal(a):

Quoted 7 lines · Marek Vasut
Quoted 4 lines

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

In general, I object to board-specific #ifdefs in drivers.

This is not a board specific ifdef.

I'm sorry, I misread the patch completely. I assumed you were adding the #ifdefs, instead of removing them, as that is the usual pattern, and I had misunderstood your patch description. 200000us is a long time. Are you sure it's necessary (would 100000 work)? Let me know, and I'll apply this patch.

Andy

#5 lore raw

PATCH 1/1 PXAMMC: Drop different delays for PXA27X

Dne So 24. dubna 2010 03:39:24 Andy Fleming napsal(a):

Quoted 10 lines · Marek Vasut
Quoted 9 lines

Dne So 24. dubna 2010 03:13:07 Andy Fleming napsal(a):

Quoted 7 lines · Marek Vasut
Quoted 4 lines

In case the delays were set to 10000, the MMC card on PXA27X boards (and PXA3xx boards) didn't initialize on first try. Increasing the delays and leaving just those for PXA25x and 26x (that is 200000) fixes this problem.

In general, I object to board-specific #ifdefs in drivers.

Quoted 7 lines
Quoted 1 line

This is not a board specific ifdef.

I'm sorry, I misread the patch completely. I assumed you were adding the #ifdefs, instead of removing them, as that is the usual pattern, and I had misunderstood your patch description. 200000us is a long time. Are you sure it's necessary (would 100000 work)? Let me know, and I'll apply this patch.

Good. I haven't tested with shorter delays, but how would that matter? If the card times out, it's bad none the less. If it doesn't, the whole delay isn't used anyway.

We can adjust this timing in another patch though. As it is now, it works fine for both PXA27x and PXA3xx and also doesn't break PXA25x -- that's why I'd better avoid mixing it into one patch.

Quoted 2 lines

Andy