提交 4509f847 编写于 作者: U Ulf Hansson 提交者: Chris Ball

mmc: core: Add ignore_crc flag to __mmc_switch

Instead of handle specific adaptations, releated to certain switch
operations, inside __mmc_switch, push this to be handled by the caller
instead.
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NChris Ball <chris@printf.net>
上级 1d4d7744
...@@ -285,7 +285,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) ...@@ -285,7 +285,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
} }
err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BKOPS_START, 1, timeout, use_busy_signal, true); EXT_CSD_BKOPS_START, 1, timeout,
use_busy_signal, true, false);
if (err) { if (err) {
pr_warn("%s: Error %d starting bkops\n", pr_warn("%s: Error %d starting bkops\n",
mmc_hostname(card->host), err); mmc_hostname(card->host), err);
......
...@@ -856,8 +856,8 @@ static int mmc_select_hs200(struct mmc_card *card) ...@@ -856,8 +856,8 @@ static int mmc_select_hs200(struct mmc_card *card)
/* switch to HS200 mode if bus width set successfully */ /* switch to HS200 mode if bus width set successfully */
if (!err) if (!err)
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_HS_TIMING, 2, 0); EXT_CSD_HS_TIMING, 2, 0, true, true, true);
err: err:
return err; return err;
} }
...@@ -1074,9 +1074,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -1074,9 +1074,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
host->caps2 & MMC_CAP2_HS200) host->caps2 & MMC_CAP2_HS200)
err = mmc_select_hs200(card); err = mmc_select_hs200(card);
else if (host->caps & MMC_CAP_MMC_HIGHSPEED) else if (host->caps & MMC_CAP_MMC_HIGHSPEED)
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_HS_TIMING, 1, EXT_CSD_HS_TIMING, 1,
card->ext_csd.generic_cmd6_time); card->ext_csd.generic_cmd6_time,
true, true, true);
if (err && err != -EBADMSG) if (err && err != -EBADMSG)
goto free_card; goto free_card;
...@@ -1400,7 +1401,7 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type) ...@@ -1400,7 +1401,7 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_POWER_OFF_NOTIFICATION, EXT_CSD_POWER_OFF_NOTIFICATION,
notify_type, timeout, true, false); notify_type, timeout, true, false, false);
if (err) if (err)
pr_err("%s: Power Off Notification timed out, %u\n", pr_err("%s: Power Off Notification timed out, %u\n",
mmc_hostname(card->host), timeout); mmc_hostname(card->host), timeout);
......
...@@ -405,17 +405,18 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc) ...@@ -405,17 +405,18 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc)
* timeout of zero implies maximum possible timeout * timeout of zero implies maximum possible timeout
* @use_busy_signal: use the busy signal as response type * @use_busy_signal: use the busy signal as response type
* @send_status: send status cmd to poll for busy * @send_status: send status cmd to poll for busy
* @ignore_crc: ignore CRC errors when sending status cmd to poll for busy
* *
* Modifies the EXT_CSD register for selected card. * Modifies the EXT_CSD register for selected card.
*/ */
int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
unsigned int timeout_ms, bool use_busy_signal, bool send_status) unsigned int timeout_ms, bool use_busy_signal, bool send_status,
bool ignore_crc)
{ {
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
unsigned long timeout; unsigned long timeout;
u32 status = 0; u32 status = 0;
bool ignore_crc = false;
BUG_ON(!card); BUG_ON(!card);
BUG_ON(!card->host); BUG_ON(!card->host);
...@@ -445,14 +446,13 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, ...@@ -445,14 +446,13 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
return 0; return 0;
/* /*
* Must check status to be sure of no errors * CRC errors shall only be ignored in cases were CMD13 is used to poll
* If CMD13 is to check the busy completion of the timing change, * to detect busy completion.
* disable the check of CRC error.
*/ */
if (index == EXT_CSD_HS_TIMING && if (card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
!(card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)) ignore_crc = false;
ignore_crc = true;
/* Must check status to be sure of no errors. */
timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS);
do { do {
if (send_status) { if (send_status) {
...@@ -501,7 +501,8 @@ EXPORT_SYMBOL_GPL(__mmc_switch); ...@@ -501,7 +501,8 @@ EXPORT_SYMBOL_GPL(__mmc_switch);
int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
unsigned int timeout_ms) unsigned int timeout_ms)
{ {
return __mmc_switch(card, set, index, value, timeout_ms, true, true); return __mmc_switch(card, set, index, value, timeout_ms, true, true,
false);
} }
EXPORT_SYMBOL_GPL(mmc_switch); EXPORT_SYMBOL_GPL(mmc_switch);
......
...@@ -152,7 +152,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, ...@@ -152,7 +152,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
struct mmc_command *, int); struct mmc_command *, int);
extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool,
bool); bool, bool);
extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册