diff --git a/flashprog.c b/flashprog.c
index e1049f3..a9bba8f 100644
--- a/flashprog.c
+++ b/flashprog.c
@@ -207,27 +207,6 @@
 	return ret;
 }
 
-void *programmer_map_flash_region(const char *descr, uintptr_t phys_addr, size_t len)
-{
-	void *ret;
-	if (programmer->map_flash_region)
-		ret = programmer->map_flash_region(descr, phys_addr, len);
-	else
-		ret = fallback_map(descr, phys_addr, len);
-	msg_gspew("%s: mapping %s from 0x%0*" PRIxPTR " to 0x%0*" PRIxPTR "\n",
-		  __func__, descr, PRIxPTR_WIDTH, phys_addr, PRIxPTR_WIDTH, (uintptr_t) ret);
-	return ret;
-}
-
-void programmer_unmap_flash_region(void *virt_addr, size_t len)
-{
-	if (programmer->unmap_flash_region)
-		programmer->unmap_flash_region(virt_addr, len);
-	else
-		fallback_unmap(virt_addr, len);
-	msg_gspew("%s: unmapped 0x%0*" PRIxPTR "\n", __func__, PRIxPTR_WIDTH, (uintptr_t)virt_addr);
-}
-
 void programmer_delay(unsigned int usecs)
 {
 	if (usecs > 0) {
@@ -546,61 +525,6 @@
 	return first_len;
 }
 
-void finish_memory_access(struct flashctx *flash)
-{
-	if (flash->virtual_registers != (chipaddr)ERROR_PTR) {
-		programmer_unmap_flash_region((void *)flash->virtual_registers, flash->chip->total_size * 1024);
-		flash->physical_registers = 0;
-		flash->virtual_registers = (chipaddr)ERROR_PTR;
-	}
-
-	if (flash->virtual_memory != (chipaddr)ERROR_PTR) {
-		programmer_unmap_flash_region((void *)flash->virtual_memory, flash->chip->total_size * 1024);
-		flash->physical_memory = 0;
-		flash->virtual_memory = (chipaddr)ERROR_PTR;
-	}
-}
-
-int prepare_memory_access(struct flashctx *flash, enum preparation_steps prep)
-{
-	/* Init pointers to the fail-safe state to distinguish them later from legit values. */
-	flash->virtual_memory = (chipaddr)ERROR_PTR;
-	flash->virtual_registers = (chipaddr)ERROR_PTR;
-
-	/* FIXME: This avoids mapping (and unmapping) of flash chip definitions with size 0.
-	 * These are used for various probing-related hacks that would not map successfully anyway and should be
-	 * removed ASAP. */
-	if (flash->chip->total_size == 0)
-		return 0;
-
-	const chipsize_t size = flash->chip->total_size * 1024;
-	uintptr_t base = flashbase ? flashbase : (0xffffffff - size + 1);
-	void *addr = programmer_map_flash_region(flash->chip->name, base, size);
-	if (addr == ERROR_PTR) {
-		msg_perr("Could not map flash chip %s at 0x%0*" PRIxPTR ".\n",
-			 flash->chip->name, PRIxPTR_WIDTH, base);
-		return 1;
-	}
-	flash->physical_memory = base;
-	flash->virtual_memory = (chipaddr)addr;
-
-	/* FIXME: Special function registers normally live 4 MByte below flash space, but it might be somewhere
-	 * completely different on some chips and programmers, or not mappable at all.
-	 * Ignore these problems for now and always report success. */
-	if (flash->chip->feature_bits & FEATURE_REGISTERMAP) {
-		base = 0xffffffff - size - 0x400000 + 1;
-		addr = programmer_map_flash_region("flash chip registers", base, size);
-		if (addr == ERROR_PTR) {
-			msg_pdbg2("Could not map flash chip registers %s at 0x%0*" PRIxPTR ".\n",
-				 flash->chip->name, PRIxPTR_WIDTH, base);
-			return 0;
-		}
-		flash->physical_registers = base;
-		flash->virtual_registers = (chipaddr)addr;
-	}
-	return 0;
-}
-
 /*
  * Return a string corresponding to the bustype parameter.
  * Memory is obtained with malloc() and must be freed with free() by the caller.
@@ -743,7 +667,7 @@
 		  flash->chip->vendor, flash->chip->name, flash->chip->total_size, tmp);
 	free(tmp);
 #if CONFIG_INTERNAL == 1
-	if (flash->physical_memory != 0 && programmer->map_flash_region == physmap)
+	if (flash->physical_memory != 0 && mst->par.map_flash == physmap)
 		msg_cinfo("mapped at physical address 0x%0*" PRIxPTR ".\n",
 			  PRIxPTR_WIDTH, flash->physical_memory);
 	else
