changeset 507:c942be3c7997

new flash support works for PL129N on the Pirelli
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 05:34:45 +0000
parents 0dd2c87c1b63
children 211be4dc6be2
files loadtools/flashid.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/flashid.c	Tue May 28 05:12:47 2019 +0000
+++ b/loadtools/flashid.c	Tue May 28 05:34:45 2019 +0000
@@ -69,10 +69,13 @@
 	int rc;
 
 	printf("Spansion PL129J or PL129N, looking at CFI\n");
-	if (do_w16(bi->base_addr + 0xAA, 0x98)) {
-		fprintf(stderr, "unexpected response to w16 - aborting\n");
+	/* need to go back to read array first, CFI cmd ignored otherwise */
+	if (do_w16(bi->base_addr + 0xAAA, 0xF0)) {
+bad_w16:	fprintf(stderr, "unexpected response to w16 - aborting\n");
 		return(-1);
 	}
+	if (do_w16(bi->base_addr + 0xAAA, 0x98))
+		goto bad_w16;
 	rc = run_cfi_check(bi, flashdev_PL129N.cfi_table);
 	if (rc < 0)
 		return(rc);
@@ -99,7 +102,7 @@
 {
 	uint16_t ext1, ext2;
 
-	printf("AMD-style extended ID device, reading\n");
+	printf("AMD-style extended ID device, reading extended ID\n");
 	if (do_r16(bi->base_addr + 0x1C, &ext1) < 0)
 		return(-1);
 	if (do_r16(bi->base_addr + 0x1E, &ext2) < 0)