diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-09-07 10:57:12 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-07 10:57:12 -0400 |
commit | d773d7255199a6c8934e197756f54a1115dd127b (patch) | |
tree | 940cb1f15be1d27508927ad40d0262fbec462437 /drivers/mmc/mmc_block.c | |
parent | 148f93d59cc9bb5e0f9a04d36a6f91d435e1a3f7 (diff) |
[MMC] Cleanup 385e3227d4d83ab13d7767c4bb3593b0256bf246
Rather than having two places which independently calculate the
timeout for data transfers, make it a library function instead.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/mmc_block.c')
-rw-r--r-- | drivers/mmc/mmc_block.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 515fb227eba7..d6fcc467b503 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -179,40 +179,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
179 | brq.stop.arg = 0; | 179 | brq.stop.arg = 0; |
180 | brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC; | 180 | brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC; |
181 | 181 | ||
182 | brq.data.timeout_ns = card->csd.tacc_ns * 10; | 182 | mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ); |
183 | brq.data.timeout_clks = card->csd.tacc_clks * 10; | ||
184 | |||
185 | /* | ||
186 | * Scale up the timeout by the r2w factor | ||
187 | */ | ||
188 | if (rq_data_dir(req) == WRITE) { | ||
189 | brq.data.timeout_ns <<= card->csd.r2w_factor; | ||
190 | brq.data.timeout_clks <<= card->csd.r2w_factor; | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * SD cards use a 100 multiplier and has a upper limit | ||
195 | */ | ||
196 | if (mmc_card_sd(card)) { | ||
197 | unsigned int limit_us, timeout_us; | ||
198 | |||
199 | brq.data.timeout_ns *= 10; | ||
200 | brq.data.timeout_clks *= 10; | ||
201 | |||
202 | if (rq_data_dir(req) == READ) | ||
203 | limit_us = 100000; | ||
204 | else | ||
205 | limit_us = 250000; | ||
206 | |||
207 | timeout_us = brq.data.timeout_ns / 1000; | ||
208 | timeout_us += brq.data.timeout_clks * 1000 / | ||
209 | (card->host->ios.clock / 1000); | ||
210 | |||
211 | if (timeout_us > limit_us) { | ||
212 | brq.data.timeout_ns = limit_us * 1000; | ||
213 | brq.data.timeout_clks = 0; | ||
214 | } | ||
215 | } | ||
216 | 183 | ||
217 | if (rq_data_dir(req) == READ) { | 184 | if (rq_data_dir(req) == READ) { |
218 | brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK; | 185 | brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK; |