@@ -2518,6 +2518,22 @@ static int erase(int dev_fd, __u32 argin, __u32 start, __u32 end)
{
int ret = 0;
struct mmc_ioc_multi_cmd *multi_cmd;
+ __u8 ext_csd[512];
+
+
+ ret = read_extcsd(dev_fd, ext_csd);
+ if (ret) {
+ fprintf(stderr, "Could not read EXT_CSD\n");
+ exit(1);
+ }
+ if (ext_csd[EXT_CSD_ERASE_GROUP_DEF] & 0x01) {
+ fprintf(stderr, "High Capacity Erase Unit Size=%d bytes\n" \
+ "High Capacity Erase Timeout=%d ms\n" \
+ "High Capacity Write Protect Group Size=%d bytes\n",
+ ext_csd[224]*0x80000,
+ ext_csd[223]*300,
+ ext_csd[221]*ext_csd[224]*0x80000);
+ }
multi_cmd = calloc(1, sizeof(struct mmc_ioc_multi_cmd) +
3 * sizeof(struct mmc_ioc_cmd));
@@ -2559,7 +2575,6 @@ int do_erase(int nargs, char **argv)
{
int dev_fd, ret;
char *print_str;
- char **eptr = NULL;
__u8 ext_csd[512], checkup_mask = 0;
__u32 arg, start, end;
@@ -2569,14 +2584,14 @@ int do_erase(int nargs, char **argv)
}
if (strstr(argv[2], "0x") || strstr(argv[2], "0X"))
- start = strtol(argv[2], eptr, 16);
+ start = strtol(argv[2], NULL, 16);
else
- start = strtol(argv[2], eptr, 10);
+ start = strtol(argv[2], NULL, 10);
if (strstr(argv[3], "0x") || strstr(argv[3], "0X"))
- end = strtol(argv[3], eptr, 16);
+ end = strtol(argv[3], NULL, 16);
else
- end = strtol(argv[3], eptr, 10);
+ end = strtol(argv[3], NULL, 10);
if (end < start) {
fprintf(stderr, "erase start [0x%08x] > erase end [0x%08x]\n",