RE: RE: Bug in mmc.c == stops eMMC toshiba from working - sector check not good (PATCH)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MMC 4.4 Spec JEDEC Standard No. 84-A44 says CMD1 response from card
has bit 30 set if card is high capacity.  (page 111 - Section 8.1)

Toshiba flash <= 2GB has EXT_CSD sectors but does not support
High Capacity but because of bad test -- card was put into sector mode
causing failure.

Signed-off-by: Philip Rakity <prakity@xxxxxxxxxxx>

diff -ru linux-2.6.32.8/drivers/mmc/core/mmc.c linux-2.6.32.8 copy/drivers/mmc/core/mmc.c
--- linux-2.6.32.8/drivers/mmc/core/mmc.c	2010-02-09 04:57:19.000000000 -0800
+++ linux-2.6.32.8 copy/drivers/mmc/core/mmc.c	2010-03-11 14:15:03.000000000 -0800
@@ -221,8 +221,6 @@
 			ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
 			ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
 			ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
-		if (card->ext_csd.sectors)
-			mmc_card_set_blockaddr(card);
 	}
 
 	switch (ext_csd[EXT_CSD_CARD_TYPE]) {
@@ -306,6 +304,7 @@
 	int err;
 	u32 cid[4];
 	unsigned int max_dtr;
+	u32 rocr;
 
 	BUG_ON(!host);
 	WARN_ON(!host->claimed);
@@ -319,7 +318,7 @@
 	mmc_go_idle(host);
 
 	/* The extra bit indicates that we support high capacity */
-	err = mmc_send_op_cond(host, ocr | (1 << 30), NULL);
+	err = mmc_send_op_cond(host, ocr | MMC_CARD_SECTOR_ADDR, &rocr);
 	if (err)
 		goto err;
 
@@ -407,6 +406,9 @@
 		err = mmc_read_ext_csd(card);
 		if (err)
 			goto free_card;
+
+		if(rocr & MMC_CARD_SECTOR_ADDR)
+		  mmc_card_set_blockaddr(card);
 	}
 
 	/*
diff -ru linux-2.6.32.8/include/linux/mmc/mmc.h linux-2.6.32.8 copy/include/linux/mmc/mmc.h
--- linux-2.6.32.8/include/linux/mmc/mmc.h	2010-02-09 04:57:19.000000000 -0800
+++ linux-2.6.32.8 copy/include/linux/mmc/mmc.h	2010-03-11 13:47:00.000000000 -0800
@@ -202,6 +202,7 @@
  * OCR bits are mostly in host.h
  */
 #define MMC_CARD_BUSY	0x80000000	/* Card Power up status bit */
+#define MMC_CARD_SECTOR_ADDR	0x40000000	/* Card supports sectors */
 
 /*
  * Card Command Classes (CCC)

Attachment: eMMCHighCapacity.patch
Description: eMMCHighCapacity.patch


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux