[PATCH 4/7 revised II] mmc_spi: do not check CID and CSD blocks with CRC16

From: Wolfgang Mües
Date: Tue Apr 07 2009 - 09:49:11 EST


From: Wolfgang Muees <wolfgang.mues@xxxxxxxxxxxx>

o 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 <drzeus@xxxxxxxxx>.

Signed-off-by: Wolfgang Muees <wolfgang.mues@xxxxxxxxxxxx>

---

diff -uprN 2_6_29_rc7_patch1253/drivers/mmc/core/sd.c 2_6_29_rc7_patch12534/drivers/mmc/core/sd.c
--- 2_6_29_rc7_patch1253/drivers/mmc/core/sd.c 2009-03-04 02:05:22.000000000 +0100
+++ 2_6_29_rc7_patch12534/drivers/mmc/core/sd.c 2009-04-07 15:39:22.000000000 +0200
@@ -363,15 +363,6 @@ static int mmc_sd_init_card(struct mmc_h
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_h
}

/*
+ * 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);
---
regards

i. A. Wolfgang Mües
--
Auerswald GmbH & Co. KG
Hardware Development
Telefon: +49 (0)5306 9219 0
Telefax: +49 (0)5306 9219 94
E-Mail: Wolfgang.Mues@xxxxxxxxxxxx
Web: http://www.auerswald.de
 
--------------------------------------------------------------
Auerswald GmbH & Co. KG, Vor den Grashöfen 1, 38162 Cremlingen
Registriert beim AG Braunschweig HRA 13289
p.h.G Auerswald Geschäftsführungsges. mbH
Registriert beim AG Braunschweig HRB 7463
Geschäftsführer: Dipl-Ing. Gerhard Auerswald
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/