Add prepare/finish_access() hooks for chip drivers

Some of the arrangements we perform in prepare_flash_access()
are actually specific to the flash chip. Allow to clean that
up by adding respective hooks into `struct flashchip`.

Change-Id: Iff79ba3d190dba04ecf58c5c53faa428bf592bdf
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72516
diff --git a/flashprog.c b/flashprog.c
index 8babb86..6a4ce12 100644
--- a/flashprog.c
+++ b/flashprog.c
@@ -1626,6 +1626,9 @@
 		return 1;
 	}
 
+	if (flash->chip->prepare_access && flash->chip->prepare_access(flash, PREPARE_FULL))
+		return 1;
+
 	if (map_flash(flash) != 0)
 		return 1;
 
@@ -1670,6 +1673,8 @@
 {
 	deregister_chip_restore(flash);
 	unmap_flash(flash);
+	if (flash->chip->finish_access)
+		flash->chip->finish_access(flash);
 }
 
 /**