diff loadtools/flmisc.c @ 506:0dd2c87c1b63

fc-loadtool flash support overhaul
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 05:12:47 +0000
parents e7502631a0f9
children 4be92bcd1535
line wrap: on
line diff
--- a/loadtools/flmisc.c	Mon May 27 19:58:01 2019 +0000
+++ b/loadtools/flmisc.c	Tue May 28 05:12:47 2019 +0000
@@ -28,7 +28,7 @@
 	offset = strtoul(argv[2], &strtoul_endp, 16);
 	if (*strtoul_endp)
 		goto inv;
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	if (offset >= bi->geom->total_size) {
@@ -74,7 +74,7 @@
 			argv[0], argv[1]);
 		return(-1);
 	}
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	if (argc >= 4) {
@@ -138,7 +138,7 @@
 	offset = strtoul(argv[2], &strtoul_endp, 16);
 	if (*strtoul_endp)
 		goto inv;
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	if (offset >= bi->geom->total_size) {
@@ -165,9 +165,6 @@
 		return(-1);
 	if (get_flash_sector_range(bi, offset, len, &startsec, &endsec) < 0)
 		return(-1);
-	stat = flash_id_check(bank, 0);
-	if (stat)
-		return(stat);
 	printf("Erasing %d sector(s)\n", endsec - startsec);
 	for (sp = startsec; sp < endsec; sp++) {
 		stat = bi->ops->erase_sector(bi, sp);
@@ -192,7 +189,7 @@
 			argv[0], argv[1]);
 		return(-1);
 	}
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	sprintf(targ_base, "%lx", (u_long) bi->base_addr);
@@ -228,7 +225,7 @@
 		fprintf(stderr, "error: too many arguments\n");
 		return(-1);
 	}
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	return bi->ops->reset_cmd(bi);
@@ -243,7 +240,7 @@
 		fprintf(stderr, "error: too many arguments\n");
 		return(-1);
 	}
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	return bi->ops->status_cmd(bi);
@@ -258,12 +255,12 @@
 	struct sector_info *startsec, *endsec, *sp;
 	int stat;
 
-	if (flash_get_cfi(bank) < 0)
+	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
 	if (!bi->ops->needs_unlock) {
 		fprintf(stderr,
-	    "This operation is not applicable to the selected flash type\n");
+		      "This operation is not applicable to AMD-style flash\n");
 		return(-1);
 	}
 	if (argc != 4) {