Use eMMC hardware write-protect in Jetson TX2i

I would like to use the eMMC function of mmc writeprotect user set to lock the user area of the eMMC.
This does not work on the Jetson, and when I checked the source code of mmc-utils I saw that they require:
if ((ext_csd_rev < 5) || (ext_csd[EXT_CSD_ERASE_GROUP_DEF] == 0)) return 1;
The problem is that ext_csd[EXT_CSD_ERASE_GROUP_DEF] is 0 (this can also be verified by running mmc extcsd read /dev/mmcblk0.
Does that mean the the eMMC does not suppor such operation or this could be done?

hello linus.s.gates,

it seems to me that using mmc-utils tools to enable write-protect did not support by TX2.
however, you may refer to L4T documentation to enable Security features for an alternative approach.
thanks

Is there a particular reason why the EXT_CSD_ERASE_GROUP_DEF is 0? It should be a feature of the eMMC and not specific to the Jetson TX2i (I use TX2i).

hello linus.s.gates,

EXT_CSD_ERASE_GROUP_DEF is set only if the device supports enhanced data partition.
this does not mean that the device not support HW write protect feature.

HW write protect feature can be implemented by IOCTLs exposed by the MMC driver.
thanks

If I understand correctly, enhanced partition means switching form MSLC to pSLC.
Again, in mmc-utils, if EXT_CSD_ERASE_GROUP_DEF is 0 write protection cannot be set. Why is this done, if, but what you say, those two features are unrelated?

hello linus.s.gates,

the MMC core driver does not have function defined for write protect feature, the MMC driver exposes IOCTL calls for the user to send the required read/write commands to the device for implementing the write protect feature.
hence, eMMC driver provides an interface for the user space application to access the HW.
you may check mmc_utils source code to use these IOCTLs.
thanks