mmc: add host_caps checking avoid switch card improperly
PATCH 1/1 mmc: add host_caps checking avoid switch card improperly
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.
--- drivers/mmc/mmc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 1 line
1.7.3.5
PATCH 1/1 mmc: add host_caps checking avoid switch card improperly
Quoted 20 lines · Macpaul Lin
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 <[email protected]>---
?drivers/mmc/mmc.c | ? 10 ++++++++++
?1 files changed, 10 insertions(+), 0 deletions(-)drivers/mmc/mmc.c +0
-0@@ -785,6 +785,16 @@ retry_scr: ? ? ? ?if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED)) ? ? ? ? ? ? ? ?return 0;
drivers/mmc/mmc.c retry_scr: · line 797
Quoted 10 lines
drivers/mmc/mmc.c +10
-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; +
Isn't this the wrong logic? It seems like you don't want to switch unless both support high speed. But this logic says to switch if either one does.
Shouldn't it be:
if (!((mmc->host_caps & MMC_MODE_HS_52MHz) &&
(mmc->host_caps & MMC_MODE_HS)))
return 0;?
Andy
Quoted 7 lines
drivers/mmc/mmc.c +0
-1? ? ? ?err = sd_switch(mmc, SD_SWITCH_SWITCH, 0, 1, (u8 *)switch_status); ? ? ? ?if (err) --1.7.3.5
PATCH 1/1 mmc: add host_caps checking avoid switch card improperly
Hi Andy,
2011/11/26 Andy Fleming <[email protected]>
Quoted 10 lines
drivers/mmc/mmc.c retry_scr: · line 797
Quoted 7 lines · Macpaul Lin
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.
drivers/mmc/mmc.c +4
-0+if (!((mmc->host_caps & MMC_MODE_HS_52MHz) || + (mmc->host_caps &MMC_MODE_HS ))) +return 0 ; +
I wrote this is because I've thought that SD cards usually work at 50MHz when they under
high speed mode (MMC_MODE_HS), and MMC cards usually work at 52MHz when they are under high speed mode.
I'm not sure if one controller support HS_52MHz for MMC cards will definitely
support SD cards under 50MHz.
If I'm wrong for the above please correct me.
Hence I wrote this to force them working under low speed to avoid problem occur.
But I think you're correct, we should use "&&" logic here until there is really a problem for
the unbelievable situation I mentioned above that happened. :-p
Quoted 4 lines
Isn't this the wrong logic? It seems like you don't want to switch
unless both support high speed. But this logic says to switch if either one does.
Quoted 9 lines
Shouldn't it be:
if (!((mmc->host_caps &
MMC_MODE_HS_52MHz) &&(mmc->host_caps & MMC_MODE_HS)))return 0;
?
I'll send patch v2 by using your logic later.
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
In reply to Andy FlemingAdd 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.
---
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(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 16 lines
1.7.3.5 CONFIDENTIALITY NOTICE: This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation. Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
PATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
In reply to Andy FlemingAdd 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.
---
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(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 16 lines
1.7.3.5 CONFIDENTIALITY NOTICE: This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation. Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
PATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
Hi Andy
2011/11/28 Macpaul Lin <[email protected]>
Quoted 10 lines
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 <[email protected]>
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.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
Dear Macpaul Lin,
Quoted 4 lines · In message <CACCg+XOTFWB8jrXsg4Z+o4eAV3b9iaEr64_=+OMZNs+MaJ+LAg@mail.gmail.com>…
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
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How many seconds are there in a year? If I tell you there are 3.155 x
10^7, you won't even try to remember it. On the other hand, who could
forget that, to within half a percent, pi seconds is a nanocentury.
- Tom Duff, Bell LabsPATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
Hi Andy and Wolfgang,
2011/11/28 Wolfgang Denk <[email protected]>
Quoted 7 lines
Dear Macpaul Lin,
In message <CACCg+XOTFWB8jrXsg4Z+o4eAV3b9iaEr64_=+
Quoted 3 lines · OMZNs+MaJ+LAg at 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
Quoted 10 lines
patch
Quoted 1 line
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!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v4 1/1 mmc: add host_caps checking avoid switch card improperly
In reply to Wolfgang DenkAdd 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.
---
Changes for v2:
- Replace OR logic by AND logic; switch to high speed if controller support one of the high speed mode.
Changes for v3:
- Correct the incorrect patch format.
Changes for v4:
- Update patch version number due to inappropiate message flooding by Andes's SMTP server.
drivers/mmc/mmc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 1 line
1.7.3.5
Andy Fleming
AppliedPATCH v4 1/1 mmc: add host_caps checking avoid switch card improperly
Quoted 8 lines · Macpaul Lin
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 <[email protected]>
Applied, thanks!
Andy
PATCH v2 1/1 mmc: add host_caps checking avoid switch card improperly
In reply to Macpaul LinAdd 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.
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(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 16 lines
1.7.3.5 CONFIDENTIALITY NOTICE: This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation. Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
PATCH v3 1/1 mmc: add host_caps checking avoid switch card improperly
In reply to Macpaul LinAdd 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.
---
Changes for v2:
- Replace OR logic by AND logic; switch to high speed if controller support one of the high speed mode.
Changes for v3:
- Correct the incorrect patch format.
drivers/mmc/mmc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/mmc/mmc.c +10 -0
@@ -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)
Signature · 16 lines
1.7.3.5 CONFIDENTIALITY NOTICE: This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation. Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.