2009-04-07 13:49:10

by Wolfgang Mües

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

From: Wolfgang Muees <[email protected]>

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 <[email protected]>.

Signed-off-by: Wolfgang Muees <[email protected]>

---

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: [email protected]
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


2009-04-08 18:39:41

by Pierre Ossman

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

On Tue, 7 Apr 2009 14:48:16 +0100
Wolfgang Mües <[email protected]> wrote:

> From: Wolfgang Muees <[email protected]>
>
> 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 <[email protected]>.
>
> Signed-off-by: Wolfgang Muees <[email protected]>
>

Queued.

Thanks
--
-- Pierre Ossman

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (198.00 B)