Skip to contentSkip to conversation

mmc-utils: Support enable/disable of eMMC H/W Reset function

PATCH In review Chris Ball 2 participants 2 messages Oct 19, 2012 – Oct 22, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Chris Ball

author
#0 lore raw

PATCH 1/1 mmc-utils: Support enable/disable of eMMC H/W Reset function

(Note: one-time programmable fuse.)

$ mmc hwreset enable /dev/mmcblk0
$ mmc hwreset disable /dev/mmcblk0
---
 mmc.c      | 10 ++++++++++
 mmc.h      |  4 ++++
 mmc_cmds.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mmc_cmds.h |  2 ++
 4 files changed, 75 insertions(+)
mmc.c +10 -0
index 56f621c..a2de863 100644
@@ -80,6 +80,16 @@ static struct Command commands[] = {
 		"Enable the eMMC BKOPS feature on <device>.\nNOTE!  This is a one-time programmable (unreversible) change.",
 	  NULL
 	},
+	{ do_hwreset_en, -1,
+	  "hwreset enable", "<device>\n"
+		"Permanently enable the eMMC H/W Reset feature on <device>.\nNOTE!  This is a one-time programmable (unreversible) change.",
+	  NULL
+	},
+	{ do_hwreset_dis, -1,
+	  "hwreset disable", "<device>\n"
+		"Permanently disable the eMMC H/W Reset feature on <device>.\nNOTE!  This is a one-time programmable (unreversible) change.",
+	  NULL
+	},
 	{ 0, 0, 0, 0 }
 };
 
mmc.h +4 -0
index 3d77b38..c863751 100644
@@ -39,6 +39,7 @@
 #define EXT_CSD_BOOT_WP			173
 #define EXT_CSD_WR_REL_PARAM		166
 #define EXT_CSD_BKOPS_EN		163	/* R/W */
+#define EXT_CSD_RST_N_FUNCTION		162	/* R/W */
 #define EXT_CSD_NATIVE_SECTOR_SIZE	63 /* R */
 #define EXT_CSD_USE_NATIVE_SECTOR	62 /* R/W */
 #define EXT_CSD_DATA_SECTOR_SIZE	61 /* R */
@@ -70,6 +71,9 @@
 #define EXT_CSD_BOOT_CFG_ACK		(1<<6)
 #define EXT_CSD_BOOT_CFG_EN		(0x38)
 #define EXT_CSD_BOOT_CFG_ACC		(0x03)
+#define EXT_CSD_RST_N_EN_MASK		(0x03)
+#define EXT_CSD_HW_RESET_EN		(0x01)
+#define EXT_CSD_HW_RESET_DIS		(0x02)
 #define EXT_CSD_PART_CONFIG_ACC_MASK	  (0x7)
 #define EXT_CSD_PART_CONFIG_ACC_BOOT0	  (0x1)
 #define EXT_CSD_PART_CONFIG_ACC_BOOT1	  (0x2)
mmc_cmds.c +59 -0

65 lines not on this page · raw message

mmc_cmds.h +2 -0
index 1dd4324..e52d622 100644
@@ -22,3 +22,5 @@ int do_writeprotect_set(int nargs, char **argv);
 int do_disable_512B_emulation(int nargs, char **argv);
 int do_write_boot_en(int nargs, char **argv);
 int do_write_bkops_en(int nargs, char **argv);
+int do_hwreset_en(int nargs, char **argv);
+int do_hwreset_dis(int nargs, char **argv);
Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
Acked-by on v1 1/1
#1 lore raw

Hi,

2012/10/19 Chris Ball <[email protected]>:

Quoted 10 lines

(Note: one-time programmable fuse.)

$ mmc hwreset enable /dev/mmcblk0
$ mmc hwreset disable /dev/mmcblk0
---
 mmc.c      | 10 ++++++++++
 mmc.h      |  4 ++++
 mmc_cmds.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mmc_cmds.h |  2 ++
 4 files changed, 75 insertions(+)

we've played around with this feature a bit, and if the reset pin is not connected to for instance a GPIO, enabling the reset can give really interesting results :) But if it's connected on the other hand, it works fine...

Kind regards, Johan