mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/7 revised II] mmc_spi: do not check CID and CSD blocks with CRC16
@ 2009-04-07 13:48 Wolfgang Mües
  2009-04-08 18:39 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Mües @ 2009-04-07 13:48 UTC (permalink / raw)
  To: Pierre Ossman
  Cc: Andrew Morton, Matt Fleming, David Brownell, Mike Frysinger,
	linux-kernel

From: Wolfgang Muees <wolfgang.mues@auerswald.de>

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@drzeus.cx>.

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

---

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@Auerswald.de
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-08 18:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07 13:48 [PATCH 4/7 revised II] mmc_spi: do not check CID and CSD blocks with CRC16 Wolfgang Mües
2009-04-08 18:39 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®