Commit b146d26a authored by Pierre Ossman's avatar Pierre Ossman

mmc: mmc_set_data_timeout() parameter write is redundant

The write parameter in mmc_set_data_timeout() is redundant as the
data structure contains information about the direction of the
transfer.
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent d7604d76
...@@ -229,8 +229,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) ...@@ -229,8 +229,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
if (brq.data.blocks > card->host->max_blk_count) if (brq.data.blocks > card->host->max_blk_count)
brq.data.blocks = card->host->max_blk_count; brq.data.blocks = card->host->max_blk_count;
mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);
/* /*
* If the host doesn't support multiple block writes, force * If the host doesn't support multiple block writes, force
* block writes to single block. SD cards are excepted from * block writes to single block. SD cards are excepted from
...@@ -261,6 +259,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) ...@@ -261,6 +259,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
brq.data.flags |= MMC_DATA_WRITE; brq.data.flags |= MMC_DATA_WRITE;
} }
mmc_set_data_timeout(&brq.data, card);
brq.data.sg = mq->sg; brq.data.sg = mq->sg;
brq.data.sg_len = mmc_queue_map_sg(mq); brq.data.sg_len = mmc_queue_map_sg(mq);
......
...@@ -220,13 +220,11 @@ EXPORT_SYMBOL(mmc_wait_for_cmd); ...@@ -220,13 +220,11 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
* mmc_set_data_timeout - set the timeout for a data command * mmc_set_data_timeout - set the timeout for a data command
* @data: data phase for command * @data: data phase for command
* @card: the MMC card associated with the data transfer * @card: the MMC card associated with the data transfer
* @write: flag to differentiate reads from writes
* *
* Computes the data timeout parameters according to the * Computes the data timeout parameters according to the
* correct algorithm given the card type. * correct algorithm given the card type.
*/ */
void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card, void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
int write)
{ {
unsigned int mult; unsigned int mult;
...@@ -239,7 +237,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card, ...@@ -239,7 +237,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
* Scale up the multiplier (and therefore the timeout) by * Scale up the multiplier (and therefore the timeout) by
* the r2w factor for writes. * the r2w factor for writes.
*/ */
if (write) if (data->flags & MMC_DATA_WRITE)
mult <<= card->csd.r2w_factor; mult <<= card->csd.r2w_factor;
data->timeout_ns = card->csd.tacc_ns * mult; data->timeout_ns = card->csd.tacc_ns * mult;
...@@ -255,7 +253,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card, ...@@ -255,7 +253,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
timeout_us += data->timeout_clks * 1000 / timeout_us += data->timeout_clks * 1000 /
(card->host->ios.clock / 1000); (card->host->ios.clock / 1000);
if (write) if (data->flags & MMC_DATA_WRITE)
limit_us = 250000; limit_us = 250000;
else else
limit_us = 100000; limit_us = 100000;
......
...@@ -214,7 +214,7 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) ...@@ -214,7 +214,7 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd)
sg_init_one(&sg, ext_csd, 512); sg_init_one(&sg, ext_csd, 512);
mmc_set_data_timeout(&data, card, 0); mmc_set_data_timeout(&data, card);
mmc_wait_for_req(card->host, &mrq); mmc_wait_for_req(card->host, &mrq);
......
...@@ -252,7 +252,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr) ...@@ -252,7 +252,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
sg_init_one(&sg, scr, 8); sg_init_one(&sg, scr, 8);
mmc_set_data_timeout(&data, card, 0); mmc_set_data_timeout(&data, card);
mmc_wait_for_req(card->host, &mrq); mmc_wait_for_req(card->host, &mrq);
...@@ -302,7 +302,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group, ...@@ -302,7 +302,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
sg_init_one(&sg, resp, 64); sg_init_one(&sg, resp, 64);
mmc_set_data_timeout(&data, card, 0); mmc_set_data_timeout(&data, card);
mmc_wait_for_req(card->host, &mrq); mmc_wait_for_req(card->host, &mrq);
......
...@@ -111,7 +111,7 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); ...@@ -111,7 +111,7 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
struct mmc_command *, int); struct mmc_command *, int);
extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int); extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
extern void mmc_claim_host(struct mmc_host *host); extern void mmc_claim_host(struct mmc_host *host);
extern void mmc_release_host(struct mmc_host *host); extern void mmc_release_host(struct mmc_host *host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment