diff mbox

[U-Boot,v2] mmc: add host_caps checking avoid switch card improperly

Message ID 1322470563-18993-1-git-send-email-macpaul@andestech.com
State Superseded
Delegated to: Macpaul Lin
Headers show

Commit Message

Macpaul Lin Nov. 28, 2011, 8:56 a.m. UTC
Add a host capability checking to avoid the mmc stack
switch the card to HIGHSPEED mode when the card supports
HIGHSPEED while the host doesn't.

This patch avoid furthur transaction problem when the
mmc/sd card runs different mode to the host.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
---
Changes for v2:
  - Replace OR logic by AND logic; switch to high speed if controller
    support one of the high speed mode.

 drivers/mmc/mmc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Macpaul Lin Nov. 28, 2011, 9:13 a.m. UTC | #1
Hi Andy

2011/11/28 Macpaul Lin <macpaul@andestech.com>

> Add a host capability checking to avoid the mmc stack
> switch the card to HIGHSPEED mode when the card supports
> HIGHSPEED while the host doesn't.
>
> This patch avoid furthur transaction problem when the
> mmc/sd card runs different mode to the host.
>
> Signed-off-by: Macpaul Lin <macpaul@andestech.com>
>
>
Sorry for sending these multiple mails.
The IT department of my company has set the mail server with incorrect
routing parameters.

Please drop these multiple mails which are the same.
I'll delete them in patchworks and left the only one patch v2 of this patch
which should be correct.
Wolfgang Denk Nov. 28, 2011, 3:21 p.m. UTC | #2
Dear Macpaul Lin,

In message <CACCg+XOTFWB8jrXsg4Z+o4eAV3b9iaEr64_=+OMZNs+MaJ+LAg@mail.gmail.com> you wrote:
> 
> Please drop these multiple mails which are the same.
> I'll delete them in patchworks and left the only one patch v2 of this patch
> which should be correct.

But you've sent a V3, too ???

Best regards,

Wolfgang Denk
Macpaul Lin Nov. 29, 2011, 1:27 a.m. UTC | #3
Hi Andy and Wolfgang,

2011/11/28 Wolfgang Denk <wd@denx.de>

> Dear Macpaul Lin,
>
> In message <CACCg+XOTFWB8jrXsg4Z+o4eAV3b9iaEr64_=+
> OMZNs+MaJ+LAg@mail.gmail.com> you wrote:
> >
> > Please drop these multiple mails which are the same.
> > I'll delete them in patchworks and left the only one patch v2 of this
> patch
> > which should be correct.
>
> But you've sent a V3, too ???
>
> Best regards,
>
> Wolfgang Denk
>
>
I've send the several patches at that time I didn't know the mail server
has problem.
At that time I've send both correct and wrong patch v2 when I'm retrying
hence I send v3 later.
For the clarify, I'll send a new v4 while the contents remain the same.
Sorry for making problems.
Thanks!
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 21665ec..98abf1c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -785,6 +785,16 @@  retry_scr:
 	if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
 		return 0;

+	/*
+	 * If the host doesn't support SD_HIGHSPEED, do not switch card to
+	 * HIGHSPEED mode even if the card support SD_HIGHSPPED.
+	 * This can avoid furthur problem when the card runs in different
+	 * mode between the host.
+	 */
+	if (!((mmc->host_caps & MMC_MODE_HS_52MHz) &&
+		(mmc->host_caps & MMC_MODE_HS)))
+		return 0;
+
 	err = sd_switch(mmc, SD_SWITCH_SWITCH, 0, 1, (u8 *)switch_status);

 	if (err)