Skip to contentSkip to conversation

mmc: fix SD card SCR register decoding on little endian systems

PATCH New Herrmann Ulrich 3 participants 3 messages Jun 2, 2009 – Jun 5, 2009 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: fix SD card SCR register decoding on little endian systems

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.

include/mmc.h +1 -1
Index: 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)
 
drivers/mmc/mmc.c +2 -2
Index: 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.

#1 lore raw

PATCH 1/1 mmc: fix SD card SCR register decoding on little endian systems

Quoted 8 lines · Herrmann Ulrich

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.

I ended up applying another patch which solved the same problem, mostly because it was further back in the queue. Changes should show up in my tree soon, and the pull request will follow soon after.

Andy

#2 lore raw

PATCH 1/1 mmc: fix SD card SCR register decoding on little endian systems

In reply to Herrmann Ulrich
Quoted 9 lines · Herrmann Ulrich

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.

Thanks for this. Due to unrelated reasons the usage of the SEND_SCR command had to be disabled for my controller, so I missed this.

Rabin