diff options
author | Andrei Warkentin <andreiw@motorola.com> | 2011-04-11 17:13:41 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 21:01:05 -0400 |
commit | eaa02f751ff4f8abfc2e55a15c20a5a274244418 (patch) | |
tree | c521e84176e140acdc03926683b525250ceee777 /drivers/mmc | |
parent | 853c6cac0dc0d9d330deb5b48c19eebafaed1841 (diff) |
mmc: core: Rename erase_timeout to cmd_timeout_ms.
Renames erase_timeout to cmd_timeout_ms inside struct mmc_command.
First step to making host honor timeouts for non-data-transfer
commands. Cleans up erase timeout code.
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/core.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c2350e474159..5178d5daa5f4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1187,9 +1187,8 @@ void mmc_init_erase(struct mmc_card *card) | |||
1187 | } | 1187 | } |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | static void mmc_set_mmc_erase_timeout(struct mmc_card *card, | 1190 | static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, |
1191 | struct mmc_command *cmd, | 1191 | unsigned int arg, unsigned int qty) |
1192 | unsigned int arg, unsigned int qty) | ||
1193 | { | 1192 | { |
1194 | unsigned int erase_timeout; | 1193 | unsigned int erase_timeout; |
1195 | 1194 | ||
@@ -1246,38 +1245,42 @@ static void mmc_set_mmc_erase_timeout(struct mmc_card *card, | |||
1246 | if (mmc_host_is_spi(card->host) && erase_timeout < 1000) | 1245 | if (mmc_host_is_spi(card->host) && erase_timeout < 1000) |
1247 | erase_timeout = 1000; | 1246 | erase_timeout = 1000; |
1248 | 1247 | ||
1249 | cmd->erase_timeout = erase_timeout; | 1248 | return erase_timeout; |
1250 | } | 1249 | } |
1251 | 1250 | ||
1252 | static void mmc_set_sd_erase_timeout(struct mmc_card *card, | 1251 | static unsigned int mmc_sd_erase_timeout(struct mmc_card *card, |
1253 | struct mmc_command *cmd, unsigned int arg, | 1252 | unsigned int arg, |
1254 | unsigned int qty) | 1253 | unsigned int qty) |
1255 | { | 1254 | { |
1255 | unsigned int erase_timeout; | ||
1256 | |||
1256 | if (card->ssr.erase_timeout) { | 1257 | if (card->ssr.erase_timeout) { |
1257 | /* Erase timeout specified in SD Status Register (SSR) */ | 1258 | /* Erase timeout specified in SD Status Register (SSR) */ |
1258 | cmd->erase_timeout = card->ssr.erase_timeout * qty + | 1259 | erase_timeout = card->ssr.erase_timeout * qty + |
1259 | card->ssr.erase_offset; | 1260 | card->ssr.erase_offset; |
1260 | } else { | 1261 | } else { |
1261 | /* | 1262 | /* |
1262 | * Erase timeout not specified in SD Status Register (SSR) so | 1263 | * Erase timeout not specified in SD Status Register (SSR) so |
1263 | * use 250ms per write block. | 1264 | * use 250ms per write block. |
1264 | */ | 1265 | */ |
1265 | cmd->erase_timeout = 250 * qty; | 1266 | erase_timeout = 250 * qty; |
1266 | } | 1267 | } |
1267 | 1268 | ||
1268 | /* Must not be less than 1 second */ | 1269 | /* Must not be less than 1 second */ |
1269 | if (cmd->erase_timeout < 1000) | 1270 | if (erase_timeout < 1000) |
1270 | cmd->erase_timeout = 1000; | 1271 | erase_timeout = 1000; |
1272 | |||
1273 | return erase_timeout; | ||
1271 | } | 1274 | } |
1272 | 1275 | ||
1273 | static void mmc_set_erase_timeout(struct mmc_card *card, | 1276 | static unsigned int mmc_erase_timeout(struct mmc_card *card, |
1274 | struct mmc_command *cmd, unsigned int arg, | 1277 | unsigned int arg, |
1275 | unsigned int qty) | 1278 | unsigned int qty) |
1276 | { | 1279 | { |
1277 | if (mmc_card_sd(card)) | 1280 | if (mmc_card_sd(card)) |
1278 | mmc_set_sd_erase_timeout(card, cmd, arg, qty); | 1281 | return mmc_sd_erase_timeout(card, arg, qty); |
1279 | else | 1282 | else |
1280 | mmc_set_mmc_erase_timeout(card, cmd, arg, qty); | 1283 | return mmc_mmc_erase_timeout(card, arg, qty); |
1281 | } | 1284 | } |
1282 | 1285 | ||
1283 | static int mmc_do_erase(struct mmc_card *card, unsigned int from, | 1286 | static int mmc_do_erase(struct mmc_card *card, unsigned int from, |
@@ -1351,7 +1354,7 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, | |||
1351 | cmd.opcode = MMC_ERASE; | 1354 | cmd.opcode = MMC_ERASE; |
1352 | cmd.arg = arg; | 1355 | cmd.arg = arg; |
1353 | cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; | 1356 | cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; |
1354 | mmc_set_erase_timeout(card, &cmd, arg, qty); | 1357 | cmd.cmd_timeout_ms = mmc_erase_timeout(card, arg, qty); |
1355 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | 1358 | err = mmc_wait_for_cmd(card->host, &cmd, 0); |
1356 | if (err) { | 1359 | if (err) { |
1357 | printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n", | 1360 | printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n", |