diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 26fc098d77cd..cd81c395e164 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -362,15 +362,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if (err) goto err; - /* - * For SPI, enable CRC as appropriate. - */ - if (mmc_host_is_spi(host)) { - err = mmc_spi_set_crc(host, use_spi_crc); - if (err) - goto err; - } - /* * Fetch CID from card. */ @@ -457,6 +448,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, goto free_card; } + /* + * For SPI, enable CRC as appropriate. + * This CRC enable is located AFTER the reading of the + * card registers because some SDHC cards are not able + * to provide valid CRCs for non-512-byte blocks. + */ + if (mmc_host_is_spi(host)) { + err = mmc_spi_set_crc(host, use_spi_crc); + if (err) + goto free_card; + } + /* * Attempt to change to high-speed (if supported) */