Add new flash-chip preparation step after probing

Change-Id: I57fd63ddc4c8ccd07b0744df33d6a499bfeae9ff
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/321
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashprog.c b/flashprog.c
index 687d379..e4151da 100644
--- a/flashprog.c
+++ b/flashprog.c
@@ -661,6 +661,9 @@
 		if (flash->chip->probe(flash) != 1)
 			goto notfound;
 
+		if (flash->chip->prepare_access && flash->chip->prepare_access(flash, PREPARE_POST_PROBE))
+			goto notfound;
+
 		/* If this is the first chip found, accept it.
 		 * If this is not the first chip found, accept it only if it is
 		 * a non-generic match. SFDP and CFI are generic matches.