Bug 148474 - MMC timeout too short durring enumeration of cards.
Summary: MMC timeout too short durring enumeration of cards.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 18:00 UTC by Greg Ansley
Modified: 2010-08-16 17:30 UTC (History)
0 users

See Also:


Attachments
file.diff (322 bytes, patch)
2010-07-09 18:00 UTC, Greg Ansley
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Ansley 2010-07-09 18:00:14 UTC
Large SD cards take much longer to come out of the power-up state than earlier smaller cards.

Current command loop terminates after 100 attempts waiting for a card to become ready.  A 1G card currently takes 241 iterations to become ready on a 400Mhz AT91SAM9G20. A 8G card was took 721.

SD card spec does not specify a maximum wait time.

The patch bumps the loop count to for 100 to 5000. Note that this does not affect the no-card or error condition timings.

Fix: Patch attached with submission follows:
How-To-Repeat: Boot system with SD card present. Large cards will not be found. Small cards work fine.
Comment 1 M. Warner Losh 2010-07-09 21:19:24 UTC
In message: <201007091654.o69GsF1n032013@www.freebsd.org>
            Greg Ansley <gja@ansley.com> writes:
: Large SD cards take much longer to come out of the power-up state than earlier smaller cards.

This happens to be exactly opposite what I've observed...  Cards up to
4GB in my AT91RM9200 are ready right away.  Older, 16MB and 32MB cards
have taken up to 10 iterations to become ready.

: Current command loop terminates after 100 attempts waiting for a
: card to become ready.  A 1G card currently takes 241 iterations to
: become ready on a 400Mhz AT91SAM9G20. A 8G card was took 721. 

It really took 2.4s for the 1G card and 7.21s for the 8G card to
become ready?  Are you sure?  Are you sure there's not some other
timing bug going on that causes mms_delay_ms(10) to return much more
quickly than 10ms?

Also, which tree are you booting that has AT91SAM9G20 support, that's
not in main yet :)  I'll let that slide.

Your patch causes us to wait for up to 50s for this to happen.  That
seems excessively long to me, and doesn't match my experience with
these devices, even the ultra-uber-crappy consumer cards.

Warner


: SD card spec does not specify a maximum wait time.
: 
: The patch bumps the loop count to for 100 to 5000. Note that this does not affect the no-card or error condition timings.
: >How-To-Repeat:
: Boot system with SD card present. Large cards will not be found. Small cards work fine.
: >Fix:
: 
: 
: : 
: Index: mmc.c
: ===================================================================
: RCS file: /usr/home/ncvs/src/sys/dev/mmc/mmc.c,v
: retrieving revision 1.38
: diff -r1.38 mmc.c
: 451c451
: < 	for (i = 0; i < 100; i++) {
: ---
: > 	for (i = 0; i < 5000; i++) {
: 478c478
: < 	for (i = 0; i < 100; i++) {
: ---
: > 	for (i = 0; i < 5000; i++) {
: 
: 
: >Release-Note:
: >Audit-Trail:
: >Unformatted:
: _______________________________________________
: freebsd-arm@freebsd.org mailing list
: http://lists.freebsd.org/mailman/listinfo/freebsd-arm
: To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
: 
:
Comment 2 Greg Ansley 2010-07-10 12:46:12 UTC
PR is bogus and can be closed.  Problem went away with refresh of source 
tree. Sorry.

Greg Ansley
Comment 3 Warner Losh freebsd_committer freebsd_triage 2010-08-16 17:29:49 UTC
State Changed
From-To: open->closed

Turns out this was caused by a timing bug (or other heisenbug).  Closing.