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>
This commit is contained in:
committed by
Chris Ball
parent
853c6cac0d
commit
eaa02f751f
@@ -1187,9 +1187,8 @@ void mmc_init_erase(struct mmc_card *card)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mmc_set_mmc_erase_timeout(struct mmc_card *card,
|
static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
|
||||||
struct mmc_command *cmd,
|
unsigned int arg, unsigned int qty)
|
||||||
unsigned int arg, unsigned int qty)
|
|
||||||
{
|
{
|
||||||
unsigned int erase_timeout;
|
unsigned int erase_timeout;
|
||||||
|
|
||||||
@@ -1246,38 +1245,42 @@ static void mmc_set_mmc_erase_timeout(struct mmc_card *card,
|
|||||||
if (mmc_host_is_spi(card->host) && erase_timeout < 1000)
|
if (mmc_host_is_spi(card->host) && erase_timeout < 1000)
|
||||||
erase_timeout = 1000;
|
erase_timeout = 1000;
|
||||||
|
|
||||||
cmd->erase_timeout = erase_timeout;
|
return erase_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mmc_set_sd_erase_timeout(struct mmc_card *card,
|
static unsigned int mmc_sd_erase_timeout(struct mmc_card *card,
|
||||||
struct mmc_command *cmd, unsigned int arg,
|
unsigned int arg,
|
||||||
unsigned int qty)
|
unsigned int qty)
|
||||||
{
|
{
|
||||||
|
unsigned int erase_timeout;
|
||||||
|
|
||||||
if (card->ssr.erase_timeout) {
|
if (card->ssr.erase_timeout) {
|
||||||
/* Erase timeout specified in SD Status Register (SSR) */
|
/* Erase timeout specified in SD Status Register (SSR) */
|
||||||
cmd->erase_timeout = card->ssr.erase_timeout * qty +
|
erase_timeout = card->ssr.erase_timeout * qty +
|
||||||
card->ssr.erase_offset;
|
card->ssr.erase_offset;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Erase timeout not specified in SD Status Register (SSR) so
|
* Erase timeout not specified in SD Status Register (SSR) so
|
||||||
* use 250ms per write block.
|
* use 250ms per write block.
|
||||||
*/
|
*/
|
||||||
cmd->erase_timeout = 250 * qty;
|
erase_timeout = 250 * qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must not be less than 1 second */
|
/* Must not be less than 1 second */
|
||||||
if (cmd->erase_timeout < 1000)
|
if (erase_timeout < 1000)
|
||||||
cmd->erase_timeout = 1000;
|
erase_timeout = 1000;
|
||||||
|
|
||||||
|
return erase_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mmc_set_erase_timeout(struct mmc_card *card,
|
static unsigned int mmc_erase_timeout(struct mmc_card *card,
|
||||||
struct mmc_command *cmd, unsigned int arg,
|
unsigned int arg,
|
||||||
unsigned int qty)
|
unsigned int qty)
|
||||||
{
|
{
|
||||||
if (mmc_card_sd(card))
|
if (mmc_card_sd(card))
|
||||||
mmc_set_sd_erase_timeout(card, cmd, arg, qty);
|
return mmc_sd_erase_timeout(card, arg, qty);
|
||||||
else
|
else
|
||||||
mmc_set_mmc_erase_timeout(card, cmd, arg, qty);
|
return mmc_mmc_erase_timeout(card, arg, qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmc_do_erase(struct mmc_card *card, unsigned int from,
|
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,
|
|||||||
cmd.opcode = MMC_ERASE;
|
cmd.opcode = MMC_ERASE;
|
||||||
cmd.arg = arg;
|
cmd.arg = arg;
|
||||||
cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
|
cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
|
||||||
mmc_set_erase_timeout(card, &cmd, arg, qty);
|
cmd.cmd_timeout_ms = mmc_erase_timeout(card, arg, qty);
|
||||||
err = mmc_wait_for_cmd(card->host, &cmd, 0);
|
err = mmc_wait_for_cmd(card->host, &cmd, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n",
|
printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n",
|
||||||
|
@@ -92,7 +92,7 @@ struct mmc_command {
|
|||||||
* actively failing requests
|
* actively failing requests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned int erase_timeout; /* in milliseconds */
|
unsigned int cmd_timeout_ms; /* in milliseconds */
|
||||||
|
|
||||||
struct mmc_data *data; /* data segment associated with cmd */
|
struct mmc_data *data; /* data segment associated with cmd */
|
||||||
struct mmc_request *mrq; /* associated request */
|
struct mmc_request *mrq; /* associated request */
|
||||||
|
Reference in New Issue
Block a user