From: Wolfgang Muees Date: Tue, 7 Apr 2009 13:48:16 +0000 (+0100) Subject: mmc_spi: do not check CID and CSD blocks with CRC16 X-Git-Tag: v2.6.30-rc2~115^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d9f25c036dd584db175552a7d162403d3ab54b3;p=platform%2Fkernel%2Flinux-3.10.git mmc_spi: do not check CID and CSD blocks with CRC16 Some cards are not able to calculate a valid CRC16 value for CID and CSD reads (CRC for 512 byte data blocks is OK). By moving the CRC enable after the read of CID and CSD, these cards can be used. This patch was tested with a faulty 8 GByte takeMS Class 6 SDHC card. This patch was suggested by Pierre Ossman. Signed-off-by: Wolfgang Muees Signed-off-by: Pierre Ossman --- diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 26fc098..cd81c39 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -363,15 +363,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, 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. */ if (mmc_host_is_spi(host)) @@ -458,6 +449,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, } /* + * 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) */ err = mmc_switch_hs(card);