aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/core/core.c39
-rw-r--r--include/linux/mmc/core.h2
2 files changed, 22 insertions, 19 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
1190static void mmc_set_mmc_erase_timeout(struct mmc_card *card, 1190static 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
1252static void mmc_set_sd_erase_timeout(struct mmc_card *card, 1251static 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
1273static void mmc_set_erase_timeout(struct mmc_card *card, 1276static 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
1283static int mmc_do_erase(struct mmc_card *card, unsigned int from, 1286static 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",
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 07f27af4dba5..811e96e8d1fe 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -92,7 +92,7 @@ struct mmc_command {
92 * actively failing requests 92 * actively failing requests
93 */ 93 */
94 94
95 unsigned int erase_timeout; /* in milliseconds */ 95 unsigned int cmd_timeout_ms; /* in milliseconds */
96 96
97 struct mmc_data *data; /* data segment associated with cmd */ 97 struct mmc_data *data; /* data segment associated with cmd */
98 struct mmc_request *mrq; /* associated request */ 98 struct mmc_request *mrq; /* associated request */