Skip to contentSkip to conversation

mmc : export hw reset function info to user

PATCH In review Namjae Jeon 3 participants 4 messages Sep 18, 2011 – Sep 20, 2011 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc : export hw reset function info to user

user app should know whether hw reset function is enable to use it. so I try to add sysfs file of hw reset function like enhanced area.

---
 drivers/mmc/core/mmc.c   |    6 ++++++
 include/linux/mmc/card.h |    1 +
 include/linux/mmc/mmc.h  |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/core/mmc.c +6 -0
index 10f5a19..06c3ffc 100644
@@ -355,6 +355,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 	card->ext_csd.raw_trim_mult =
 		ext_csd[EXT_CSD_TRIM_MULT];
 	if (card->ext_csd.rev >= 4) {
+		/* HW reset function feature support.
+		/* user can know it is enable through sysfs interface.
+		card->ext_csd.raw_hw_reset_function =
+			ext_csd[EXT_CSD_RST_FUNCTION];
 		/*
 		 * Enhanced area feature support -- check whether the eMMC
 		 * card has the Enhanced area enabled.  If so, export enhanced
@@ -499,6 +503,7 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
 MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
 		card->ext_csd.enhanced_area_offset);
 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
+MMC_DEV_ATTR(raw_hw_reset_function, "0x%02x\n", card->ext_csd.raw_hw_reset_function);
 
 static struct attribute *mmc_std_attrs[] = {
 	&dev_attr_cid.attr,
@@ -514,6 +519,7 @@ static struct attribute *mmc_std_attrs[] = {
 	&dev_attr_serial.attr,
 	&dev_attr_enhanced_area_offset.attr,
 	&dev_attr_enhanced_area_size.attr,
+	&dev_attr_raw_hw_reset_function.attr,
 	NULL,
 };
 
include/linux/mmc/card.h +1 -0
index b460fc2..237bceb 100644
@@ -65,6 +65,7 @@ struct mmc_ext_csd {
 	unsigned int		enhanced_area_size;	/* Units: KB */
 	unsigned int		boot_size;		/* in bytes */
 	u8			raw_partition_support;	/* 160 */
+	u8                      raw_hw_reset_function;  /* 162 */
 	u8			raw_erased_mem_count;	/* 181 */
 	u8			raw_ext_csd_structure;	/* 194 */
 	u8			raw_card_type;		/* 196 */
include/linux/mmc/mmc.h +1 -0
index 5a794cb..233c932 100644
@@ -272,6 +272,7 @@ struct _mmc_csd {
 
 #define EXT_CSD_PARTITION_ATTRIBUTE	156	/* R/W */
 #define EXT_CSD_PARTITION_SUPPORT	160	/* RO */
+#define EXT_CSD_RST_FUNCTION           162     /* R/W */
 #define EXT_CSD_WR_REL_PARAM		166	/* RO */
 #define EXT_CSD_ERASE_GROUP_DEF		175	/* R/W */
 #define EXT_CSD_PART_CONFIG		179	/* R/W */
Signature · 1 line
1.7.4.4
#1 lore raw

Hi Namjae, others,

----- Original Message -----

Quoted 9 lines

From: "Namjae Jeon" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], "Namjae Jeon" <[email protected]>
Sent: Sunday, September 18, 2011 11:20:25 AM
Subject: [PATCH] mmc : export hw reset function info to user

user app should know whether hw reset function is enable to use it. so I try to add sysfs file of hw reset function like enhanced area.

If we're going to be adding a bunch of attributes from ext_csd, why not just allow dumping the entire ext_csd in a semi-readable form? Via something like hex_dump_to_buffer. This will allow easy human an machine parsing, and be more lightweight then adding a sysfs attr for each EXT_CSD byte (of which there are a lot).

I'm basing this on the thought that the only clients of these attrbutes would either be developers or engineers involved with MMC media, or very specialized software.

Thoughts?

A

#2 lore raw

2011/9/20 Andrei Warkentin <[email protected]>:

Quoted 18 lines

Hi Namjae, others,

----- Original Message -----

Quoted 9 lines

From: "Namjae Jeon" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], "Namjae Jeon" <[email protected]>
Sent: Sunday, September 18, 2011 11:20:25 AM
Subject: [PATCH] mmc : export hw reset function info to user

user app should know whether hw reset function is enable to use it. so I try to add sysfs file of hw reset function like enhanced area.

If we're going to be adding a bunch of attributes from ext_csd, why not just allow dumping the entire ext_csd in a semi-readable form? Via something like hex_dump_to_buffer. This will allow easy human an machine parsing, and be more lightweight then adding a sysfs attr for each EXT_CSD byte (of which there are a lot).

Quoted 8 lines

I'm basing this on the thought that the only clients of these attrbutes would either be developers or engineers involved with MMC media, or very specialized software.

Thoughts?

A

Hi. Andrei.

We can see all dump of ext_csd by using debugfs like this.

mount -t debugfs /dev/mmcblk0 /mnt/
cat /mnt/mmc0/mmc0\:0001/ext_csd

If user take care of it by showing all dump of ext_csd, we may be comfortable more without having to worry.
But most of them that they do not know a lot of information. If we provide some information they need them user friendly, I think that user can use more easily mmc.

Thanks.

#3 lore raw
In reply to Namjae Jeon
Quoted 2 lines · Namjae Jeon

user app should know whether hw reset function is enable to use it. so I try to add sysfs file of hw reset function like enhanced area.

This conflicts with my patches:

http://marc.info/?l=linux-mmc&m=131462534514277&w=2
http://marc.info/?l=linux-mmc&m=131462534614281&w=2
http://marc.info/?l=linux-mmc&m=131462534714284&w=2
http://marc.info/?l=linux-mmc&m=131462534814287&w=2
http://marc.info/?l=linux-mmc&m=131462535014290&w=2
http://marc.info/?l=linux-mmc&m=131462535214297&w=2

Quoted 63 lines
---
  drivers/mmc/core/mmc.c   |    6 ++++++
  include/linux/mmc/card.h |    1 +
  include/linux/mmc/mmc.h  |    1 +
  3 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/core/mmc.c +6 -0
index 10f5a19..06c3ffc 100644
@@ -355,6 +355,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
  	card->ext_csd.raw_trim_mult =
  		ext_csd[EXT_CSD_TRIM_MULT];
  	if (card->ext_csd.rev>= 4) {
+		/* HW reset function feature support.
+		/* user can know it is enable through sysfs interface.
+		card->ext_csd.raw_hw_reset_function =
+			ext_csd[EXT_CSD_RST_FUNCTION];
  		/*
  		 * Enhanced area feature support -- check whether the eMMC
  		 * card has the Enhanced area enabled.  If so, export enhanced
@@ -499,6 +503,7 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
  MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
  		card->ext_csd.enhanced_area_offset);
  MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
+MMC_DEV_ATTR(raw_hw_reset_function, "0x%02x\n", card->ext_csd.raw_hw_reset_function);
 
  static struct attribute *mmc_std_attrs[] = {
  	&dev_attr_cid.attr,
@@ -514,6 +519,7 @@ static struct attribute *mmc_std_attrs[] = {
  	&dev_attr_serial.attr,
  	&dev_attr_enhanced_area_offset.attr,
  	&dev_attr_enhanced_area_size.attr,
+	&dev_attr_raw_hw_reset_function.attr,
  	NULL,
  };
 
include/linux/mmc/card.h +1 -0
index b460fc2..237bceb 100644
@@ -65,6 +65,7 @@ struct mmc_ext_csd {
  	unsigned int		enhanced_area_size;	/* Units: KB */
  	unsigned int		boot_size;		/* in bytes */
  	u8			raw_partition_support;	/* 160 */
+	u8                      raw_hw_reset_function;  /* 162 */
  	u8			raw_erased_mem_count;	/* 181 */
  	u8			raw_ext_csd_structure;	/* 194 */
  	u8			raw_card_type;		/* 196 */
include/linux/mmc/mmc.h +1 -0
index 5a794cb..233c932 100644
@@ -272,6 +272,7 @@ struct _mmc_csd {
 
  #define EXT_CSD_PARTITION_ATTRIBUTE	156	/* R/W */
  #define EXT_CSD_PARTITION_SUPPORT	160	/* RO */
+#define EXT_CSD_RST_FUNCTION           162     /* R/W */
  #define EXT_CSD_WR_REL_PARAM		166	/* RO */
  #define EXT_CSD_ERASE_GROUP_DEF		175	/* R/W */
  #define EXT_CSD_PART_CONFIG		179	/* R/W */