changeset 505:7bf0d909c87e

fc-loadtool flash ID check: change of reset after the check logic This change only affects those flash configurations that have ID checks enabled. The logic for resetting the flash after the ID check has been changed as follows: 1) If the check fails, we return without attempting to reset the flash. 2) If the check is successful, we reset the flash using the configured method (could be AMD or Intel or Intel W30) instead of always doing an AMD flash reset as the original code did.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 27 May 2019 19:58:01 +0000
parents d3d22dbe223f
children 0dd2c87c1b63
files loadtools/flutil.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/flutil.c	Mon May 27 02:25:15 2019 +0000
+++ b/loadtools/flutil.c	Mon May 27 19:58:01 2019 +0000
@@ -158,7 +158,7 @@
 	}
 	if (size_check != geom->total_size) {
 		fprintf(stderr,
-"CFI error: added size of erase regions (%lx) != reported devive size (%lx)\n",
+"CFI error: added size of erase regions (%lx) != reported device size (%lx)\n",
 			(u_long) size_check, (u_long) geom->total_size);
 		free(geom);
 		return(-1);
@@ -336,15 +336,12 @@
 		}
 		id++;
 	}
-	/* reset flash to read mode */
-	stat = do_w16(bi->base_addr + 0xAAA, 0xF0);
-	if (stat) {
-		fprintf(stderr,
-	"unexpected response to w16 when resetting flash to read mode!\n");
+	if (fail)
+		return(-1);
+	if (bi->ops->reset_cmd(bi) < 0) {
+		/* error msg already printed */
 		return(-1);
 	}
-	if (fail)
-		return(-1);
 	bi->idcheck_done = 1;
 	return(0);
 }