Re: RFC: PCI SD host controller driver & mmc/mmcsd modules improvements
Ilya Bakulin <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.arm,gmane.os.freebsd.devel.mobile,gmane.os.freebsd.current |
|---|---|
| Organization | HT-Systems |
| Message-ID | <[email protected]> |
On Wed, 8 Oct 2008 11:38:48 +0400 Ilya Bakulin <[email protected]> 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. -- Ilya Bakulin <[email protected]>
mmc_c_inc_attempts.diff
(text/x-diff, 572 B)
--- mmc.c~ 2008-10-11 21:30:40.000000000 +0400
+++ mmc.c 2008-10-12 13:34:32.000000000 +0400
@@ -428,7 +428,7 @@
cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
cmd.data = NULL;
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < 1000; i++) {
err = mmc_wait_for_app_cmd(sc, 0, &cmd, CMD_RETRIES);
if (err != MMC_ERR_NONE)
break;
@@ -438,8 +438,9 @@
err = MMC_ERR_TIMEOUT;
mmc_ms_delay(10);
}
+ printf("mmc_send_app_ocond(): cmd completed in %d iter\n", i);
if (rocr && err == MMC_ERR_NONE)
- *rocr = cmd.resp[0];
+ *rocr = cmd.resp[0];
return (err);
}
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjx96kACgkQo9vlj1oadwjF5gCgnVPkD6m95Cc+DsnlE934e7eL dSgAoNXvcx8U33ZXrTVrTlDqrqqynBUg =RaPu -----END PGP SIGNATURE-----