Add new "bootpart enable" command to enable boot partitions
This adds a new option to enable the boot from eMMC
by writing to the 179 ext_csd register.
The example below shows as to enable the mmcblk0boot0
partition and also set/reset the ACK bit).
$ ./mmc bootpart enable 1 1 /dev/mmcblk0boot0
$ ./mmc extcsd read /dev/mmcblk0boot0 | grep PARTITION_CON
Boot configuration bytes [PARTITION_CONFIG: 0x49]
Reported-by: Youssef TRIKI <youssef.triki@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
diff --git a/mmc.h b/mmc.h
index 3af36f1..cedfae1 100644
--- a/mmc.h
+++ b/mmc.h
@@ -35,6 +35,7 @@
#define EXT_CSD_PART_SWITCH_TIME 199
#define EXT_CSD_BOOT_CFG 179
#define EXT_CSD_BOOT_WP 173
+#define EXT_CSD_PART_CONFIG 179
/*
* EXT_CSD field definitions
@@ -52,6 +53,11 @@
#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_PART_CONFIG_ACC_MASK (0x7)
+#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
+#define EXT_CSD_PART_CONFIG_ACC_BOOT1 (0x2)
+#define EXT_CSD_PART_CONFIG_ACC_USER_AREA (0x7)
+#define EXT_CSD_PART_CONFIG_ACC_ACK (0x40)
/* From kernel linux/mmc/core.h */
#define MMC_RSP_PRESENT (1 << 0)