diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-06-18 08:34:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-07 08:18:40 -0400 |
commit | 385e3227d4d83ab13d7767c4bb3593b0256bf246 (patch) | |
tree | 91f532e07753c44a905116f5a7d0e3bdcfca7f0a /drivers/mmc/mmc.c | |
parent | f57b225e432d80ee46f48536cc55ea6cf62c5570 (diff) |
[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 33525bdf2ab6..c0c7ef2a8b28 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -912,6 +912,7 @@ static void mmc_read_scrs(struct mmc_host *host) | |||
912 | struct mmc_request mrq; | 912 | struct mmc_request mrq; |
913 | struct mmc_command cmd; | 913 | struct mmc_command cmd; |
914 | struct mmc_data data; | 914 | struct mmc_data data; |
915 | unsigned int timeout_us; | ||
915 | 916 | ||
916 | struct scatterlist sg; | 917 | struct scatterlist sg; |
917 | 918 | ||
@@ -947,8 +948,18 @@ static void mmc_read_scrs(struct mmc_host *host) | |||
947 | 948 | ||
948 | memset(&data, 0, sizeof(struct mmc_data)); | 949 | memset(&data, 0, sizeof(struct mmc_data)); |
949 | 950 | ||
950 | data.timeout_ns = card->csd.tacc_ns * 10; | 951 | data.timeout_ns = card->csd.tacc_ns * 100; |
951 | data.timeout_clks = card->csd.tacc_clks * 10; | 952 | data.timeout_clks = card->csd.tacc_clks * 100; |
953 | |||
954 | timeout_us = data.timeout_ns / 1000; | ||
955 | timeout_us += data.timeout_clks * 1000 / | ||
956 | (host->ios.clock / 1000); | ||
957 | |||
958 | if (timeout_us > 100000) { | ||
959 | data.timeout_ns = 100000000; | ||
960 | data.timeout_clks = 0; | ||
961 | } | ||
962 | |||
952 | data.blksz_bits = 3; | 963 | data.blksz_bits = 3; |
953 | data.blksz = 1 << 3; | 964 | data.blksz = 1 << 3; |
954 | data.blocks = 1; | 965 | data.blocks = 1; |