From: Youngjin Jang <yj84.jang@samsung.com>
To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: demon.lee@samsung.com, js07.lee@samsung.com
Subject: [PATCH] Move the judgement of timeout into mmc_switch_status_error()
Date: Mon, 28 Dec 2015 02:07:26 +0000 (GMT) [thread overview]
Message-ID: <1921572.349701451268445456.JavaMail.weblogic@ep2mlwas03b> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1865 bytes --]
__mmc_switch() is possible to misjudge error.
Although jiffies was overed timeout,
the chance about "R1_CURRENT_STATE(status) != R1_STATE_PRG" is exists.
In other words, Successful completion of CMD6 with timeout error.
Kernel expects failure of __mmc_switch,
but card is completed CMD6 in this case.
It makes mismatch status between mmc subsystem and mmc card.
Especially, in case of partition switch,
If timeout occurs with normal status of CMD13 response unfortunatley,
"main_md->curr" will not be set, even card switched successfully.
Checking state of mmc card is needed when judging an timeout error,
if it is just timeout or timeout with error.
Reviewed-by: Jungseung Lee <js07.lee@samsung.com>
Signed-off-by: Youngjin Jang <yj84.jang@samsung.com>
---
drivers/mmc/core/mmc_ops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 1f44426..033f475 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -456,6 +456,8 @@ int mmc_switch_status_error(struct mmc_host *host, u32 status)
if (status & R1_SPI_ILLEGAL_COMMAND)
return -EBADMSG;
} else {
+ if (R1_CURRENT_STATE(status) == R1_STATE_PRG)
+ return -ETIMEDOUT;
if (status & 0xFDFFA000)
pr_warn("%s: unexpected status %#x after switch\n",
mmc_hostname(host), status);
@@ -568,8 +570,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
if (time_after(jiffies, timeout)) {
pr_err("%s: Card stuck in programming state! %s\n",
mmc_hostname(host), __func__);
- err = -ETIMEDOUT;
- goto out;
+ break;
}
} while (R1_CURRENT_STATE(status) == R1_STATE_PRG);
--
1.7.9.5
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2015-12-28 2:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-28 2:07 Youngjin Jang [this message]
2015-12-28 2:30 ` [PATCH] Move the judgement of timeout into mmc_switch_status_error() Jaehoon Chung
-- strict thread matches above, loose matches on Subject: below --
2015-12-24 9:13 장영진
2015-12-24 9:24 ` Jaehoon Chung
2015-12-24 10:15 ` Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1921572.349701451268445456.JavaMail.weblogic@ep2mlwas03b \
--to=yj84.jang@samsung.com \
--cc=demon.lee@samsung.com \
--cc=js07.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox