mmc: sdhci: add the quirk for broken r1b response
[oweals/u-boot.git] / drivers / mmc / mmc.c
index 74e5fea6671e98081f24594e65646735b7773ee9..aebe578ff6f2e0228baa3e5d010f6808ea269760 100644 (file)
@@ -129,7 +129,7 @@ static void mmc_bounce_buffer_stop(struct mmc_data *backup,
 }
 #else
 static inline int mmc_bounce_buffer_start(struct mmc_data *backup,
-                                       struct mmc_data *orig) { }
+                                       struct mmc_data *orig) { return 0; }
 static inline void mmc_bounce_buffer_stop(struct mmc_data *backup,
                                        struct mmc_data *orig) { }
 #endif
@@ -179,7 +179,7 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                        for (i = 0; i < 4; i++) {
                                int j;
                                printf("\t\t\t\t\t%03d - ", i*4);
-                               ptr = &cmd->response[i];
+                               ptr = (u8 *)&cmd->response[i];
                                ptr += 3;
                                for (j = 0; j < 4; j++)
                                        printf("%02X ", *ptr--);
@@ -1199,7 +1199,9 @@ int mmc_startup(struct mmc *mmc)
                else
                        mmc_set_clock(mmc, 25000000);
        } else {
-               for (width = EXT_CSD_BUS_WIDTH_8; width >= 0; width--) {
+               width = ((mmc->host_caps & MMC_MODE_MASK_WIDTH_BITS) >>
+                        MMC_MODE_WIDTH_BITS_SHIFT);
+               for (; width >= 0; width--) {
                        /* Set the card to use 4 bit*/
                        err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
                                        EXT_CSD_BUS_WIDTH, width);