linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h.
@ 2013-05-24  0:11 Oleg Matcovschi
  2013-05-24  0:11 ` [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE Oleg Matcovschi
  2013-06-27 14:41 ` [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Chris Ball
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Matcovschi @ 2013-05-24  0:11 UTC (permalink / raw)
  To: linux-mmc, cjb; +Cc: Oleg Matcovschi

We require only MMC_BLOCK_MAJOR which is constant.

Signed-off-by: Oleg Matcovschi <olegm@lab126.com>
---
 mmc.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/mmc.h b/mmc.h
index c863751..48a221c 100644
--- a/mmc.h
+++ b/mmc.h
@@ -16,11 +16,13 @@
 
 #include <asm-generic/int-ll64.h>
 #include <linux/mmc/ioctl.h>
-#include <linux/major.h>
 #include <stdio.h>
 
 #define CHECK(expr, msg, err_stmt) { if (expr) { fprintf(stderr, msg); err_stmt; } }
 
+/* From kernel linux/major.h */
+#define MMC_BLOCK_MAJOR			179
+
 /* From kernel linux/mmc/mmc.h */
 #define MMC_SWITCH		6	/* ac	[31:0] See below	R1b */
 #define MMC_SEND_EXT_CSD	8	/* adtc				R1  */
-- 
1.7.4.1


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

* [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE.
  2013-05-24  0:11 [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Oleg Matcovschi
@ 2013-05-24  0:11 ` Oleg Matcovschi
  2013-06-27 14:42   ` Chris Ball
  2013-06-27 14:41 ` [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Chris Ball
  1 sibling, 1 reply; 4+ messages in thread
From: Oleg Matcovschi @ 2013-05-24  0:11 UTC (permalink / raw)
  To: linux-mmc, cjb; +Cc: Oleg Matcovschi

Analysis was based on value of EXT_CSD_BOOT_INFO, not CARD_TYPE.
CARD_TYPE should be handled using bitmask, not values.


Signed-off-by: Oleg Matcovschi <olegm@lab126.com>
---
 mmc_cmds.c |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/mmc_cmds.c b/mmc_cmds.c
index b407f65..7aad812 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -578,29 +578,16 @@ int do_read_extcsd(int nargs, char **argv)
 		printf("I/O Driver Strength [DRIVER_STRENGTH: 0x%02x]\n",
 			ext_csd[197]);
 
-	printf("Card Type [CARD_TYPE: 0x%02x]\n", ext_csd[196]);
-	/* DEVICE_TYPE in A45 */
-	switch (reg) {
-	case 5:
-		printf("HS200 Single Data Rate eMMC @200MHz 1.2VI/O\n");
-		break;
-	case 4:
-		printf("HS200 Single Data Rate eMMC @200MHz 1.8VI/O\n");
-		break;
-	case 3:
-		printf("HS Dual Data Rate eMMC @52MHz 1.2VI/O\n");
+	/* DEVICE_TYPE in A45, CARD_TYPE in A441 */
+	reg = ext_csd[196];
+	printf("Card Type [CARD_TYPE: 0x%02x]\n", reg);
+	if (reg & 0x20) printf(" HS200 Single Data Rate eMMC @200MHz 1.2VI/O\n");
+	if (reg & 0x10) printf(" HS200 Single Data Rate eMMC @200MHz 1.8VI/O\n");
+	if (reg & 0x08) printf(" HS Dual Data Rate eMMC @52MHz 1.2VI/O\n");
+	if (reg & 0x04)	printf(" HS Dual Data Rate eMMC @52MHz 1.8V or 3VI/O\n");
+	if (reg & 0x02)	printf(" HS eMMC @52MHz - at rated device voltage(s)\n");
+	if (reg & 0x01) printf(" HS eMMC @26MHz - at rated device voltage(s)\n");
 
-		break;
-	case 2:
-		printf("HS Dual Data Rate eMMC @52MHz 1.8V or 3VI/O\n");
-		break;
-	case 1:
-		printf("HS eMMC @52MHz - at rated device voltage(s)\n");
-		break;
-	case 0:
-		printf("HS eMMC @26MHz - at rated device voltage(s)\n");
-		break;
-	}
 	printf("CSD structure version [CSD_STRUCTURE: 0x%02x]\n", ext_csd[194]);
 	/* ext_csd_rev = ext_csd[192] (already done!!!) */
 	printf("Command set [CMD_SET: 0x%02x]\n", ext_csd[191]);
@@ -759,7 +746,8 @@ int do_read_extcsd(int nargs, char **argv)
 			" [PACKED_FAILURE_INDEX]: 0x%02x\n", ext_csd[35]);
 		printf("Power Off Notification"
 			" [POWER_OFF_NOTIFICATION]: 0x%02x\n", ext_csd[34]);
-		printf("Control to turn the Cache ON/OFF"			" [CACHE_CTRL]: 0x%02x\n", ext_csd[33]);
+		printf("Control to turn the Cache ON/OFF"
+			" [CACHE_CTRL]: 0x%02x\n", ext_csd[33]);
 		/* flush_cache ext_csd[32] not readable */
 		/*Reserved [31:0] */
 	}
-- 
1.7.4.1


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

* Re: [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h.
  2013-05-24  0:11 [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Oleg Matcovschi
  2013-05-24  0:11 ` [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE Oleg Matcovschi
@ 2013-06-27 14:41 ` Chris Ball
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-06-27 14:41 UTC (permalink / raw)
  To: Oleg Matcovschi; +Cc: linux-mmc

Hi,

On Thu, May 23 2013, Oleg Matcovschi wrote:
> We require only MMC_BLOCK_MAJOR which is constant.
>
> Signed-off-by: Oleg Matcovschi <olegm@lab126.com>

Thanks, pushed to mmc-utils.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE.
  2013-05-24  0:11 ` [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE Oleg Matcovschi
@ 2013-06-27 14:42   ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-06-27 14:42 UTC (permalink / raw)
  To: Oleg Matcovschi; +Cc: linux-mmc

Hi,

On Thu, May 23 2013, Oleg Matcovschi wrote:
> Analysis was based on value of EXT_CSD_BOOT_INFO, not CARD_TYPE.
> CARD_TYPE should be handled using bitmask, not values.
>
> Signed-off-by: Oleg Matcovschi <olegm@lab126.com>

Thanks, pushed to mmc-utils.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2013-06-27 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24  0:11 [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Oleg Matcovschi
2013-05-24  0:11 ` [PATCH 2/2] mmc-utils: Correctly handle CARD_TYPE Oleg Matcovschi
2013-06-27 14:42   ` Chris Ball
2013-06-27 14:41 ` [PATCH 1/2] mmc-utils: Remove dependency on linux/major.h Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).