public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* RE: RE: Bug in mmc.c == stops eMMC toshiba from working - sector check not good (PATCH)
@ 2010-03-12  5:17 Philip Rakity
  2010-03-13  5:09 ` Patch: eMMC boot partition needs to be deactivated for linux to find user partitions Philip Rakity
  2010-03-16 20:25 ` Bug in mmc.c == stops eMMC toshiba from working - sector check not good (REPOST) (PATCH) Philip Rakity
  0 siblings, 2 replies; 30+ messages in thread
From: Philip Rakity @ 2010-03-12  5:17 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org
  Cc: Nicolas Pitre, Lennert Buijtenhek, Philip Rakity

[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]

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@marvell.com>

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 #2: eMMCHighCapacity.patch --]
[-- Type: application/octet-stream, Size: 1933 bytes --]

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@marvell.com>

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)

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

end of thread, other threads:[~2010-10-07 23:58 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12  5:17 RE: Bug in mmc.c == stops eMMC toshiba from working - sector check not good (PATCH) Philip Rakity
2010-03-13  5:09 ` Patch: eMMC boot partition needs to be deactivated for linux to find user partitions Philip Rakity
2010-03-15  8:08   ` Adrian Hunter
2010-03-15 18:32     ` Features vs versions (Was: Patch: eMMC boot partition needs to be deactivated for linux to find user partitions) Edward Falk
2010-03-15 18:54       ` Johnson, Charles F
2010-03-16  1:44     ` Patch: eMMC boot partition needs to be deactivated for linux to find user partitions Philip Rakity
2010-03-20  5:12     ` Philip Rakity
2010-03-22  8:25       ` Adrian Hunter
     [not found]         ` <639D1595-D908-473C-9A41-71B493DCD0C0@marvell.com>
2010-03-29  7:12           ` Adrian Hunter
2010-09-19 21:46             ` [PATCH] sdhci: add quirk for controllers that don't support write only detect Philip Rakity
2010-09-20  6:14               ` Wolfram Sang
2010-09-20 16:00                 ` Philip Rakity
2010-09-21  5:43                   ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Philip Rakity
2010-09-21  6:04                     ` Adrian Hunter
2010-09-21 15:06                       ` Philip Rakity
2010-09-21 16:58                         ` Wolfram Sang
     [not found]                           ` <15EE115E-4B8A-4314-BD7A-3FB24A1F1BB6@marvell.com>
2010-09-22  8:56                             ` Wolfram Sang
2010-09-22  7:57                         ` Adrian Hunter
2010-09-22 22:25                         ` [PATCH] sdhci: print out controller name for register debug Philip Rakity
2010-09-22 23:08                           ` Chris Ball
2010-09-23  8:39                             ` Wolfram Sang
2010-09-23 16:12                               ` Chris Ball
2010-09-23 17:11                                 ` Wolfram Sang
2010-09-21  6:48                     ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Wolfram Sang
2010-09-23 15:24                     ` Philip Rakity
2010-09-23 15:49                       ` Subject: [PATCH] sdhci: Show SD Command when doing debug printks Philip Rakity
2010-10-07 23:58                       ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Chris Ball
     [not found]                 ` <763CD352-8557-46F1-89D6-5596C40C435E@marvell.com>
2010-09-24  4:49                   ` [PATCH] sdhci: add quirk for controllers that don't support write only detect Wolfram Sang
2010-09-24  9:34                     ` Philip Rakity
2010-03-16 20:25 ` Bug in mmc.c == stops eMMC toshiba from working - sector check not good (REPOST) (PATCH) Philip Rakity

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