[U-Boot] [PATCH] mmc: fix SD card SCR register decoding on little endian systems

Herrmann Ulrich Ulrich.Herrmann at austriamicrosystems.com
Tue Jun 2 17:47:09 CEST 2009


Rabin Vincent's fix for little endian systems fixes only the issues 
regarding responses received on the command line. 
However the SD card's SCR register is received on the DAT0 line 
- therefore it must be handled in an endian independent way.

This is an addendum to "[PATCH 4/5] mmc: fix response decoding on little
endian" from rabin at rab.in.

Signed-off-by: Ulrich Herrmann <ulrich.herrmann at austriamicrosystems.com>
Index: include/mmc.h
===================================================================
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -45,7 +45,7 @@
 #define MMC_MODE_4BIT          0x100
 #define MMC_MODE_8BIT          0x200

-#define SD_DATA_4BIT   0x00040000
+#define SD_DATA_4BIT   0x04

 #define IS_SD(x) (mmc->version & SD_VERSION_SD)

Index: drivers/mmc/mmc.c
===================================================================
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -490,7 +490,7 @@
        mmc->scr[0] = scr[0];
        mmc->scr[1] = scr[1];

-       switch ((mmc->scr[0] >> 24) & 0xf) {
+       switch ((((char*)mmc->scr)[0]) & 0xf) {
                case 0:
                        mmc->version = SD_VERSION_1_0;
                        break;
@@ -522,7 +522,7 @@
                        break;
        }

-       if (mmc->scr[0] & SD_DATA_4BIT)
+       if (((char*)mmc->scr)[1] & SD_DATA_4BIT)
                mmc->card_caps |= MMC_MODE_4BIT;

        /* If high-speed isn't supported, we return */
--------------------------------------------------------------------------------

This message may contain confidential and/or privileged information intended 
only for the addressee.

If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this 
message in error, please advise the sender immediately by reply e-mail and 
delete this message. Any views expressed in this message are those of the 
individual sender and may not necessarily reflect the 
opinions of austriamicrosystems AG.

--------------------------------------------------------------------------------

Diese E-Mail enthaelt moeglicherweise vertrauliche und/oder rechtlich 
geschuetzte Informationen.

Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich 
erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie 
diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser 
Mail ist nicht gestattet. Etwaige in dieser E-mail geaeusserte Ansichten und
Meinungen stammen vom Versender dieser Nachricht und muessen nicht 
notwendigerweise mit den Meinungen und Ansichten von austriamicrosystems AG 
uebereinstimmen.



More information about the U-Boot mailing list