diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-06-18 14:34:37 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-07 13:18:40 +0100 |
commit | 385e3227d4d83ab13d7767c4bb3593b0256bf246 (patch) | |
tree | 91f532e07753c44a905116f5a7d0e3bdcfca7f0a /drivers/mmc/mmc.c | |
parent | f57b225e432d80ee46f48536cc55ea6cf62c5570 (diff) | |
download | op-kernel-dev-385e3227d4d83ab13d7767c4bb3593b0256bf246.zip op-kernel-dev-385e3227d4d83ab13d7767c4bb3593b0256bf246.tar.gz |
[MMC] Fix SD timeout calculation
Secure Digital cards use a different algorithm to calculate the timeout
for data transfers. Using the MMC one works often, but not always.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 33525bd..c0c7ef2 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -912,6 +912,7 @@ static void mmc_read_scrs(struct mmc_host *host) struct mmc_request mrq; struct mmc_command cmd; struct mmc_data data; + unsigned int timeout_us; struct scatterlist sg; @@ -947,8 +948,18 @@ static void mmc_read_scrs(struct mmc_host *host) memset(&data, 0, sizeof(struct mmc_data)); - data.timeout_ns = card->csd.tacc_ns * 10; - data.timeout_clks = card->csd.tacc_clks * 10; + data.timeout_ns = card->csd.tacc_ns * 100; + data.timeout_clks = card->csd.tacc_clks * 100; + + timeout_us = data.timeout_ns / 1000; + timeout_us += data.timeout_clks * 1000 / + (host->ios.clock / 1000); + + if (timeout_us > 100000) { + data.timeout_ns = 100000000; + data.timeout_clks = 0; + } + data.blksz_bits = 3; data.blksz = 1 << 3; data.blocks = 1; |