RFC: PCI SD host controller driver & mmc/mmcsd modules improvements

M. Warner Losh imp at bsdimp.com
Mon Oct 13 17:04:01 UTC 2008


In message: <20081012171201.da4da754.webmaster at kibab.com>
            Ilya Bakulin <webmaster at kibab.com> writes:
: On Wed, 8 Oct 2008 11:38:48 +0400
: Ilya Bakulin <webmaster at kibab.com> wrote:
: 
: > I have another SD card, 2 Gb size, in my camera. It's from Kingston. It doesn't work:
: > 
: > sdhci0-slot0: Card inserted
: > mmc0: <MMC/SD bus> on sdhci0
: > sdhci0-slot0: Command error 1 (opcode 2 arg 0 flags 103 dlen 0 dflags 0)
: > mmc0: setting transfer rate to 50.000MHz
: > 
: > ... and no new storage devices appear.
: 
: Problem was solved by increasing the number of answer read attempts in mmc_send_app_op_cond(). With attached patch (against latest driver version) card is recognized properly on ~ 190th attempt (while in original driver there are only 100 attempts).
: 
: Output from dmesg now:
: sdhci0-slot0: Card inserted
: mmc0: <MMC/SD bus> on sdhci0
: sdhci0-slot0: Command error 1 (opcode 8 arg 426 flags 101 dlen 0 dflags 0)
: mmc_send_app_ocond(): cmd completed in 0 iter
: sdhci0-slot0: Command error 1 (opcode 8 arg 426 flags 101 dlen 0 dflags 0)
: mmc_send_app_ocond(): cmd completed in 195 iter
: mmcsd0: 1964MB <SD Memory Card> at mmc0 50MHz/4bit
: GEOM_LABEL: Label for provider mmcsd0s1 is msdosfs/KODAK.
: 
: Furthermore, non-mine SDHC card is now also recognized in this cardreader (it doesn't even under Windows). In this case, it takes about 400 attempts to read answer.

I think I bumped the number of iterations to 100 when I found that 10
wasn't enough.  25 different cards worked just fine, but I got use of
a 16MB SD card at BSDcan that needed like 65.  Bumping it from 100 to
1000, however, makes the timeout go from 1s to 10s.  That opens up
window for insertion races, but that's the only downside I see...  Of
course, we want to fix those races, but this may expose them a little
more..

I can't believe that you had a card that took 4s to become active!

Can you confirm the elapsed time is really 4s for that card?
Otherwise, this may be pointing out a bug in another area of the
code...

Warner


More information about the freebsd-mobile mailing list