Patchwork Explicitly store max write size

login
register
about
Submitter Carl-Daniel Hailfinger
Date 2012-08-29 07:19:51
Message ID <503DC297.40306@gmx.net>
Download mbox | patch
Permalink /patch/3730/
State Rejected
Headers show

Comments

Carl-Daniel Hailfinger - 2012-08-29 07:19:51
This patch is not ready for merge, a few programmers will not compile
because the conversion is unfinished.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Stefan Tauner - 2012-08-29 15:32:23
On Wed, 29 Aug 2012 09:19:51 +0200
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> wrote:

> This patch is not ready for merge, a few programmers will not compile
> because the conversion is unfinished.
> 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
> 
> Index: flashrom-max_write_size/flash.h
> ===================================================================
> --- flashrom-max_write_size/flash.h	(Revision 1587)
> +++ flashrom-max_write_size/flash.h	(Arbeitskopie)
> @@ -141,7 +141,10 @@
>  
>  	int (*printlock) (struct flashctx *flash);
>  	int (*unlock) (struct flashctx *flash);
> -	int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
> +	struct {
> +		int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
> +		int max_write_size;
> +	} writer;
>  	int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
>  	struct voltage {
>  		uint16_t min;

we could make this a writers array already like the erasers array, but
with a single entry only for now. while not required for this feature it
is clear that we will want to go that way in the future and imho it is
also clear that there wont be a single patch that adds all writers to
flashchips.c together with the implementation of the usage of this array
(i.e. the implementation patch will not touch flashchips.c at all, but
there will be one or more patches by steven for example that add those
entries ;)

Patch

Index: flashrom-max_write_size/flash.h
===================================================================
--- flashrom-max_write_size/flash.h	(Revision 1587)
+++ flashrom-max_write_size/flash.h	(Arbeitskopie)
@@ -141,7 +141,10 @@ 
 
 	int (*printlock) (struct flashctx *flash);
 	int (*unlock) (struct flashctx *flash);
-	int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
+	struct {
+		int (*write) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
+		int max_write_size;
+	} writer;
 	int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
 	struct voltage {
 		uint16_t min;
Index: flashrom-max_write_size/it87spi.c
===================================================================
--- flashrom-max_write_size/it87spi.c	(Revision 1587)
+++ flashrom-max_write_size/it87spi.c	(Arbeitskopie)
@@ -379,7 +379,7 @@ 
 	 * via a programmer parameter for the internal programmer.
 	 */
 	if ((chip->total_size * 1024 > 512 * 1024) || (chip->page_size > 256)) {
-		spi_chip_write_1(flash, buf, start, len);
+		spi_write_chunked(flash, buf, start, len, 1);
 	} else {
 		unsigned int lenhere;
 
@@ -388,7 +388,7 @@ 
 			 * whichever is smaller.
 			 */
 			lenhere = min(len, chip->page_size - start % chip->page_size);
-			spi_chip_write_1(flash, buf, start, lenhere);
+			spi_write_chunked(flash, buf, start, lenhere, 1);
 			start += lenhere;
 			len -= lenhere;
 			buf += lenhere;
@@ -401,7 +401,7 @@ 
 			buf += chip->page_size;
 		}
 		if (len)
-			spi_chip_write_1(flash, buf, start, len);
+			spi_write_chunked(flash, buf, start, len, 1);
 	}
 
 	return 0;
Index: flashrom-max_write_size/jedec.c
===================================================================
--- flashrom-max_write_size/jedec.c	(Revision 1587)
+++ flashrom-max_write_size/jedec.c	(Arbeitskopie)
@@ -329,58 +329,6 @@ 
 	return 0;
 }
 
-static int write_byte_program_jedec_common(struct flashctx *flash, uint8_t *src,
-					   chipaddr dst, unsigned int mask)
-{
-	int tried = 0, failed = 0;
-	chipaddr bios = flash->virtual_memory;
-
-	/* If the data is 0xFF, don't program it and don't complain. */
-	if (*src == 0xFF) {
-		return 0;
-	}
-
-retry:
-	/* Issue JEDEC Byte Program command */
-	start_program_jedec_common(flash, mask);
-
-	/* transfer data from source to destination */
-	chip_writeb(flash, *src, dst);
-	toggle_ready_jedec(flash, bios);
-
-	if (chip_readb(flash, dst) != *src && tried++ < MAX_REFLASH_TRIES) {
-		goto retry;
-	}
-
-	if (tried >= MAX_REFLASH_TRIES)
-		failed = 1;
-
-	return failed;
-}
-
-/* chunksize is 1 */
-int write_jedec_1(struct flashctx *flash, uint8_t *src, unsigned int start,
-		  unsigned int len)
-{
-	int i, failed = 0;
-	chipaddr dst = flash->virtual_memory + start;
-	chipaddr olddst;
-	unsigned int mask;
-
-	mask = getaddrmask(flash->chip);
-
-	olddst = dst;
-	for (i = 0; i < len; i++) {
-		if (write_byte_program_jedec_common(flash, src, dst, mask))
-			failed = 1;
-		dst++, src++;
-	}
-	if (failed)
-		msg_cerr(" writing sector at 0x%lx failed!\n", olddst);
-
-	return failed;
-}
-
 int write_page_write_jedec_common(struct flashctx *flash, uint8_t *src,
 				  unsigned int start, unsigned int page_size)
 {
@@ -434,12 +382,7 @@ 
 		int unsigned len)
 {
 	unsigned int i, starthere, lenhere;
-	/* FIXME: page_size is the wrong variable. We need max_writechunk_size
-	 * in struct flashctx to do this properly. All chips using
-	 * write_jedec have page_size set to max_writechunk_size, so
-	 * we're OK for now.
-	 */
-	unsigned int page_size = flash->chip->page_size;
+	unsigned int page_size = flash->chip->writer.max_write_size;
 
 	/* Warning: This loop has a very unusual condition and body.
 	 * The loop needs to go through each page with at least one affected
Index: flashrom-max_write_size/dediprog.c
===================================================================
--- flashrom-max_write_size/dediprog.c	(Revision 1587)
+++ flashrom-max_write_size/dediprog.c	(Arbeitskopie)
@@ -310,13 +310,15 @@ 
 	return 0;
 }
 
-/* Bulk write interface, will write multiple chunksize byte chunks aligned to chunksize bytes.
+/* Bulk write interface, will write multiple flash->writer.max_write_size byte
+ * chunks aligned to flash->writer.max_write_size bytes.
  * @chunksize       length of data chunks, only 256 supported by now
  * @start           start address
  * @len             length
  * @dedi_spi_cmd    dediprog specific write command for spi bus
  * @return          0 on success, 1 on failure
  */
+#error int chunksize must die as parameter
 static int dediprog_spi_bulk_write(struct flashctx *flash, uint8_t *buf, unsigned int chunksize,
 				   unsigned int start, unsigned int len, uint8_t dedi_spi_cmd)
 {
@@ -326,6 +328,7 @@ 
 	 * chunksize is the real data size per USB bulk transfer. The remaining
 	 * space in a USB bulk transfer must be filled with 0xff padding.
 	 */
+	const unsigned int chunksize = flash->writer.max_write_size;
 	const unsigned int count = len / chunksize;
 	const char count_and_cmd[] = {count & 0xff, (count >> 8) & 0xff, 0x00, dedi_spi_cmd};
 	char usbbuf[512];
@@ -381,7 +384,7 @@ 
 			      unsigned int start, unsigned int len, uint8_t dedi_spi_cmd)
 {
 	int ret;
-	const unsigned int chunksize = flash->chip->page_size;
+	const unsigned int chunksize = flash->chip->writer.max_write_size;
 	unsigned int residue = start % chunksize ? chunksize - start % chunksize : 0;
 	unsigned int bulklen;
 
Index: flashrom-max_write_size/spi25.c
===================================================================
--- flashrom-max_write_size/spi25.c	(Revision 1587)
+++ flashrom-max_write_size/spi25.c	(Arbeitskopie)
@@ -834,42 +834,6 @@ 
 	return ret;
 }
 
-int spi_byte_program(struct flashctx *flash, unsigned int addr,
-		     uint8_t databyte)
-{
-	int result;
-	struct spi_command cmds[] = {
-	{
-		.writecnt	= JEDEC_WREN_OUTSIZE,
-		.writearr	= (const unsigned char[]){ JEDEC_WREN },
-		.readcnt	= 0,
-		.readarr	= NULL,
-	}, {
-		.writecnt	= JEDEC_BYTE_PROGRAM_OUTSIZE,
-		.writearr	= (const unsigned char[]){
-					JEDEC_BYTE_PROGRAM,
-					(addr >> 16) & 0xff,
-					(addr >> 8) & 0xff,
-					(addr & 0xff),
-					databyte
-				},
-		.readcnt	= 0,
-		.readarr	= NULL,
-	}, {
-		.writecnt	= 0,
-		.writearr	= NULL,
-		.readcnt	= 0,
-		.readarr	= NULL,
-	}};
-
-	result = spi_send_multicommand(flash, cmds);
-	if (result) {
-		msg_cerr("%s failed during command execution at address 0x%x\n",
-			__func__, addr);
-	}
-	return result;
-}
-
 int spi_nbyte_program(struct flashctx *flash, unsigned int addr, uint8_t *bytes,
 		      unsigned int len)
 {
@@ -1016,7 +980,7 @@ 
 	 * spi_chip_write_256 have page_size set to max_writechunk_size, so
 	 * we're OK for now.
 	 */
-	unsigned int page_size = flash->chip->page_size;
+	unsigned int page_size = flash->chip->writer.max_write_size;
 
 	/* Warning: This loop has a very unusual condition and body.
 	 * The loop needs to go through each page with at least one affected
@@ -1058,18 +1022,7 @@ 
 int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start,
 		     unsigned int len)
 {
-	unsigned int i;
-	int result = 0;
-
-	for (i = start; i < start + len; i++) {
-		result = spi_byte_program(flash, i, buf[i - start]);
-		if (result)
-			return 1;
-		while (spi_read_status_register(flash) & SPI_SR_WIP)
-			programmer_delay(10);
-	}
-
-	return 0;
+	return spi_write_chunked(flash, buf, start, len, 1);
 }
 
 int default_spi_write_aai(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
Index: flashrom-max_write_size/flashchips.c
===================================================================
--- flashrom-max_write_size/flashchips.c	(Revision 1587)
+++ flashrom-max_write_size/flashchips.c	(Arbeitskopie)
@@ -52,7 +52,7 @@ 
 	 * }
 	 * .printlock		= Chip lock status function
 	 * .unlock		= Chip unlock function
-	 * .write		= Chip write function
+	 * .writer		= Chip write function
 	 * .read		= Chip read function
 	 * .voltage		= Voltage range in millivolt
 	 */
@@ -79,7 +79,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -111,7 +111,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -55, others 4.5-5.5V */
 	},
@@ -143,7 +143,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -55, others 4.5-5.5V */
 	},
@@ -170,7 +170,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -197,7 +197,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -224,7 +224,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -255,7 +255,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -45R, others 2.7-3.6V */
 	},
@@ -286,7 +286,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -45R, others 2.7-3.6V */
 	},
@@ -318,7 +318,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -55, others 2.7-3.6V */
 	},
@@ -350,7 +350,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -55, others 2.7-3.6V */
 	},
@@ -382,7 +382,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -414,7 +414,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -446,7 +446,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600} /* 3.0-3.6V for type -70R, others 2.7-3.6V */
 	},
@@ -478,7 +478,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600} /* 3.0-3.6V for type -70R, others 2.7-3.6V */
 	},
@@ -505,7 +505,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -60R, others 2.7-3.6V*/
 	},
@@ -532,7 +532,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -70R, others 2.7-3.6V */
 	},
@@ -566,7 +566,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -600,7 +600,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -635,7 +635,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -670,7 +670,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -705,7 +705,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -740,7 +740,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l05p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -780,7 +780,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -815,7 +815,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -850,7 +850,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -888,7 +888,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -926,7 +926,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -958,7 +958,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -990,7 +990,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1022,7 +1022,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1054,7 +1054,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1086,7 +1086,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1118,7 +1118,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1157,7 +1157,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l032,
 		.unlock		= NULL, /* Two status reg bytes (read with 0x35 and 0x05) */
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1196,7 +1196,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25lq032,
 		.unlock		= NULL, /* Two status reg bytes (read with 0x35 and 0x05) */
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1228,7 +1228,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -1260,7 +1260,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -1287,7 +1287,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -1315,7 +1315,7 @@ 
 			}
 		},
 		.unlock		= unlock_49fl00x,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -1354,7 +1354,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df,
 		.unlock		= spi_disable_blockprotect_at25df,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600}, /* 2.3-3.6V & 2.7-3.6V models available */
 	},
@@ -1392,7 +1392,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df,
 		.unlock		= spi_disable_blockprotect_at25df,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600}, /* 2.3-3.6V & 2.7-3.6V models available */
 	},
@@ -1430,7 +1430,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df,
 		.unlock		= spi_disable_blockprotect_at25df,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {1600, 2000}, /* Datasheet says range is 1.65-1.95 V */
 	},
@@ -1468,7 +1468,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df_sec,
 		.unlock		= spi_disable_blockprotect_at25df_sec,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1506,7 +1506,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df_sec,
 		.unlock		= spi_disable_blockprotect_at25df_sec,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1544,7 +1544,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df,
 		.unlock		= spi_disable_blockprotect_at25df,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1583,7 +1583,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df_sec,
 		.unlock		= spi_disable_blockprotect_at25df_sec,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1621,7 +1621,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df_sec,
 		.unlock		= spi_disable_blockprotect_at25df_sec,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1660,7 +1660,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df_sec,
 		.unlock		= spi_disable_blockprotect_at25df_sec,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1699,7 +1699,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25f512b,
 		.unlock		= spi_disable_blockprotect_at25f512b,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1740,7 +1740,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25fs010,
 		.unlock		= spi_disable_blockprotect_at25fs010,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1778,7 +1778,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25fs040,
 		.unlock		= spi_disable_blockprotect_at25fs040,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1802,7 +1802,7 @@ 
 				.block_erase = spi_block_erase_20,
 			}
 		},
-		.write		= NULL /* Incompatible Page write */,
+		.writer		= {NULL, 0} /* Incompatible Page write */,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600}, /* 3.0-3.6V for higher speed, 2.7-3.6V normal */
 	},
@@ -1840,7 +1840,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_atmel_at26df081a,
 		.unlock		= spi_disable_blockprotect_at25df,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1878,7 +1878,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_at25df,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1916,7 +1916,7 @@ 
 		},
 		.printlock	= spi_prettyprint_status_register_atmel_at26df081a,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1936,7 +1936,7 @@ 
 		.probe_timing	= TIMING_ZERO,
 		.printlock	= spi_prettyprint_status_register_atmel_at26df081a,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	  },*/
 
@@ -1971,7 +1971,7 @@ 
 				.block_erase = spi_block_erase_c7,
 			}
 		},
-		.write		= NULL /* Incompatible Page write */,
+		.writer		= {NULL, 0} /* Incompatible Page write */,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -1995,7 +1995,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2019,7 +2019,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,	/* FIXME */
+		.writer		= {write_jedec, 128},	/* FIXME */
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2043,7 +2043,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 256},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2067,7 +2067,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 256},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2084,7 +2084,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL /* Incompatible Page write */,
+		.writer		= {NULL, 0} /* Incompatible Page write */,
 		.read		= NULL /* Incompatible read */,
 		.voltage	= {2700, 3600},
 	},
@@ -2101,7 +2101,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600},
 	},
@@ -2118,7 +2118,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600},
 	},
@@ -2135,7 +2135,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2500, 3600}, /* 2.5-3.6V & 2.7-3.6V models available */
 	},
@@ -2152,7 +2152,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600}, /* 2.5-3.6V & 2.7-3.6V models available */
 	},
@@ -2169,7 +2169,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600}, /* 2.5-3.6V & 2.7-3.6V models available */
 	},
@@ -2186,7 +2186,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL /* Incompatible read */,
 		.voltage	= {2700, 3600},
 	},
@@ -2205,7 +2205,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600},
 	},
@@ -2222,7 +2222,7 @@ 
 		.tested		= TEST_BAD_READ,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 		.voltage	= {2700, 3600},
 	},
@@ -2246,7 +2246,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -2278,7 +2278,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2310,7 +2310,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2335,7 +2335,7 @@ 
 			}
 		},
 		.printlock	= printlock_at49f,
- 		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2366,7 +2366,7 @@ 
 			 */
 		},
 		.printlock	= printlock_at49f,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2397,7 +2397,7 @@ 
 			 */
 		},
 		.printlock	= printlock_at49f,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2428,7 +2428,7 @@ 
 			 */
 		},
 		.printlock	= printlock_at49f,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2460,7 +2460,7 @@ 
 			 */
 		},
 		.printlock	= printlock_at49f,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2496,7 +2496,7 @@ 
 		},
 		.printlock	= NULL, /* TODO */
 		.unlock		= NULL, /* unlock_82802ab() not correct(?) */
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -2520,7 +2520,7 @@ 
 				.block_erase = NULL, /* TODO */
 			},
 		},
-		.write		= NULL, /* TODO */
+		.writer		= {NULL, 0}, /* TODO */
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2547,7 +2547,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2579,7 +2579,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -2613,7 +2613,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1,
+		.writer		= {spi_chip_write, 1},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2646,7 +2646,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2679,7 +2679,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2712,7 +2712,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2745,7 +2745,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2779,7 +2779,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2813,7 +2813,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2847,7 +2847,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2881,7 +2881,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2915,7 +2915,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2949,7 +2949,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -2983,7 +2983,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3017,7 +3017,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3051,7 +3051,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3085,7 +3085,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3119,7 +3119,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3153,7 +3153,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3190,7 +3190,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3227,7 +3227,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3264,7 +3264,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3298,7 +3298,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3332,7 +3332,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3366,7 +3366,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3400,7 +3400,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3435,7 +3435,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -3470,7 +3470,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -3511,7 +3511,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3546,7 +3546,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -3581,7 +3581,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -3616,7 +3616,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -3651,7 +3651,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3687,7 +3687,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -3715,7 +3715,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -3747,7 +3747,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -3779,7 +3779,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -3809,7 +3809,7 @@ 
 				.block_erase = block_erase_chip_en29lv640b,
 			},
 		},
-		.write		= write_en29lv640b,
+		.writer		= {write_en29lv640b, 2},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -3841,7 +3841,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -3873,7 +3873,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -3906,7 +3906,7 @@ 
 				.block_erase = block_erase_chip_m29f400bt,
 			},
 		},
-		.write		= write_m29f400bt,
+		.writer		= {write_m29f400bt, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -55, others 4.5-5.5V */
 	},
@@ -3938,7 +3938,7 @@ 
 				.block_erase = block_erase_chip_m29f400bt,
 			},
 		},
-		.write		= write_m29f400bt,
+		.writer		= {write_m29f400bt, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -55, others 4.5-5.5V */
 	},
@@ -3975,7 +3975,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -4012,7 +4012,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage        = {2700, 3600},
 	},
@@ -4050,7 +4050,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4088,7 +4088,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4126,7 +4126,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4164,7 +4164,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -4201,7 +4201,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -4232,7 +4232,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -45, others 4.5-5.5V */
 	},
@@ -4264,7 +4264,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -45, others 4.5-5.5V */
 	},
@@ -4291,7 +4291,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -4318,7 +4318,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -4345,7 +4345,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -4373,7 +4373,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4396,7 +4396,7 @@ 
 			},
 		},
 		.unlock		= unlock_28f004s5,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4423,7 +4423,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4450,7 +4450,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4478,7 +4478,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4506,7 +4506,7 @@ 
 				.block_erase = erase_block_82802ab,
 			},
 		},
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 	},
 
@@ -4530,7 +4530,7 @@ 
 			},
 		},
 		.unlock		= unlock_82802ab,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -4555,7 +4555,7 @@ 
 			},
 		},
 		.unlock		= unlock_82802ab,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -4592,7 +4592,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4626,7 +4626,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4663,7 +4663,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4700,7 +4700,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4737,7 +4737,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4774,7 +4774,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4808,7 +4808,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4842,7 +4842,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4876,7 +4876,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4910,7 +4910,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4944,7 +4944,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -4978,7 +4978,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5011,7 +5011,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5044,7 +5044,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5076,7 +5076,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5108,7 +5108,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5135,7 +5135,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5162,7 +5162,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -5189,7 +5189,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5216,7 +5216,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5243,7 +5243,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5270,7 +5270,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5297,7 +5297,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5324,7 +5324,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5351,7 +5351,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5382,7 +5382,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5413,7 +5413,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5444,7 +5444,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5475,7 +5475,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5506,7 +5506,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5536,7 +5536,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -5566,7 +5566,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5603,7 +5603,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5634,7 +5634,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5665,7 +5665,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5702,7 +5702,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5733,7 +5733,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -5765,7 +5765,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5797,7 +5797,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -5827,7 +5827,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -5857,7 +5857,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -5887,7 +5887,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -5917,7 +5917,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -5948,7 +5948,7 @@ 
 			}
 		},
 		.unlock		= unlock_49fl00x,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -5979,7 +5979,7 @@ 
 			}
 		},
 		.unlock		= unlock_49fl00x,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -6006,7 +6006,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -6035,7 +6035,7 @@ 
 			}
 		},
 		.unlock		= unlock_lh28f008bjt,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6068,7 +6068,7 @@ 
 			},
 		},
 		.unlock		= unlock_82802ab,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -6096,7 +6096,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6124,7 +6124,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6152,7 +6152,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6180,7 +6180,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6208,7 +6208,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6239,7 +6239,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1, /* AAI supported, but opcode is 0xAF */
+		.writer		= {spi_chip_write, 1}, /* AAI supported, but opcode is 0xAF */
 		.read		= spi_chip_read,
 		.voltage	= {3000, 3600},
 	},
@@ -6270,7 +6270,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1, /* AAI supported, but opcode is 0xAF */
+		.writer		= {spi_chip_write, 1}, /* AAI supported, but opcode is 0xAF */
 		.read		= spi_chip_read,
 		.voltage	= {3000, 3600},
 	},
@@ -6301,7 +6301,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1,
+		.writer		= {spi_chip_write, 1},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6338,7 +6338,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.writer		= {spi_aai_write, 2},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6375,7 +6375,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.writer		= {spi_aai_write, 2},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6412,7 +6412,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6443,7 +6443,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1, /* AAI supported, but opcode is 0xAF */
+		.writer		= {spi_chip_write, 1}, /* AAI supported, but opcode is 0xAF */
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6480,7 +6480,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.writer		= {spi_aai_write, 2},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6517,7 +6517,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.writer		= {spi_aai_write, 2},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6554,7 +6554,7 @@ 
 			},
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.writer		= {spi_aai_write, 2},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -6582,7 +6582,7 @@ 
 			}
 		},
 		.unlock		= unprotect_28sf040,
-		.write		= write_28sf040,
+		.writer		= {write_28sf040, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6606,7 +6606,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6630,7 +6630,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -6654,7 +6654,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6678,7 +6678,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -6705,7 +6705,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6732,7 +6732,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6759,7 +6759,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6786,7 +6786,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -6813,7 +6813,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6840,7 +6840,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6867,7 +6867,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6894,7 +6894,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6924,7 +6924,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -6956,7 +6956,7 @@ 
 		},
 		.printlock	= printlock_sst_fwhub,
 		.unlock		= unlock_sst_fwhub,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -6988,7 +6988,7 @@ 
 		},
 		.printlock	= printlock_sst_fwhub,
 		.unlock		= unlock_sst_fwhub,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7023,7 +7023,7 @@ 
 		},
 		.printlock	= printlock_sst_fwhub,
 		.unlock		= unlock_sst_fwhub,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7056,7 +7056,7 @@ 
 			}
 		},
 		.unlock		= unlock_49lfxxxc,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7088,7 +7088,7 @@ 
 		},
 		.printlock	= printlock_sst_fwhub,
 		.unlock		= unlock_sst_fwhub,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7121,7 +7121,7 @@ 
 			}
 		},
 		.unlock		= unlock_49lfxxxc,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7154,7 +7154,7 @@ 
 			}
 		},
 		.unlock		= unlock_49lfxxxc,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7184,7 +7184,7 @@ 
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7214,7 +7214,7 @@ 
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7244,7 +7244,7 @@ 
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7275,7 +7275,7 @@ 
 			}
 		},
 		.unlock		= unlock_82802ab,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7305,7 +7305,7 @@ 
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7338,7 +7338,7 @@ 
 			}
 		},
 		.unlock		= unlock_49lfxxxc,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -7366,7 +7366,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7399,7 +7399,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1, /* 128 */
+		.writer		= {spi_chip_write, 128},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7427,7 +7427,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7456,7 +7456,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_1, /* 128 */
+		.writer		= {spi_chip_write, 128},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7484,7 +7484,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7512,7 +7512,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7540,7 +7540,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -7567,7 +7567,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7595,7 +7595,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7623,7 +7623,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7651,7 +7651,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7679,7 +7679,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7711,7 +7711,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -7741,7 +7741,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -7772,7 +7772,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -7803,7 +7803,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -X, others 4.5-5.5V */
 	},
@@ -7835,7 +7835,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -X, others 4.5-5.5V */
 	},
@@ -7862,7 +7862,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -7895,7 +7895,7 @@ 
 				.block_erase = block_erase_chip_m29f400bt,
 			}
 		},
-		.write		= write_m29f400bt,
+		.writer		= {write_m29f400bt, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -7927,7 +7927,7 @@ 
 				.block_erase = block_erase_chip_m29f400bt,
 			}
 		},
-		.write		= write_m29f400bt,
+		.writer		= {write_m29f400bt, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -7954,7 +7954,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -7981,7 +7981,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {2700, 3600},
 	},
@@ -8005,7 +8005,7 @@ 
                                 .block_erase = erase_chip_block_jedec,
                         }
                 },
-                .write          = write_jedec_1,
+		.writer		= {write_jedec, 1},
                 .read           = read_memmapped,
 		.voltage	= {2700, 3600},
         },
@@ -8038,7 +8038,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8071,7 +8071,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8104,7 +8104,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8137,7 +8137,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8167,7 +8167,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8192,7 +8192,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8217,7 +8217,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8242,7 +8242,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8273,7 +8273,7 @@ 
 			}
 		},
 		.unlock		= unlock_stm50flw0x0x,
-		.write		= write_82802ab,
+		.writer		= {write_82802ab, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program & erase */
 	},
@@ -8300,7 +8300,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8327,7 +8327,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8354,7 +8354,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 	},
 
@@ -8380,7 +8380,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 	},
 
@@ -8406,7 +8406,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8433,7 +8433,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8460,7 +8460,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -8487,7 +8487,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -8519,7 +8519,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8551,7 +8551,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -8589,7 +8589,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8627,7 +8627,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8665,7 +8665,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8703,7 +8703,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -8740,7 +8740,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 	},
 
@@ -8770,7 +8770,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8801,7 +8801,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8832,7 +8832,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8863,7 +8863,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8900,7 +8900,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8937,7 +8937,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8974,7 +8974,7 @@ 
 			}
 		},
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.writer		= {spi_chip_write, 256},
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
@@ -8998,7 +8998,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 	},
 
@@ -9021,7 +9021,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 	},
 
@@ -9044,7 +9044,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -9068,7 +9068,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.writer		= {write_jedec, 128},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -9099,7 +9099,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39l040,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9127,7 +9127,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v040a,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9155,7 +9155,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v040b,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9183,7 +9183,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v040c,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9215,7 +9215,7 @@ 
 		},
 		.printlock	= printlock_w39v040fa,
 		.unlock		= unlock_sst_fwhub,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9244,7 +9244,7 @@ 
 		},
 		.printlock	= printlock_w39v040fb,
 		.unlock		= unlock_w39v040fb,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program */
 	},
@@ -9272,7 +9272,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v040fc,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program */
 	},
@@ -9300,7 +9300,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v080a,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9332,7 +9332,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -9356,7 +9356,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
@@ -9388,7 +9388,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9420,7 +9420,7 @@ 
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600},
 	},
@@ -9449,7 +9449,7 @@ 
 		},
 		.printlock	= printlock_w39v080fa,
 		.unlock		= unlock_w39v080fa,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program */
 	},
@@ -9477,7 +9477,7 @@ 
 			}
 		},
 		.printlock	= printlock_w39v080fa_dual,
-		.write		= write_jedec_1,
+		.writer		= {write_jedec, 1},
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* Also has 12V fast program */
 	},
@@ -9498,7 +9498,7 @@ 
 		/* FIXME: some vendor extensions define this */
 		.voltage	= {0},
 		 /* Everything below will be set by the probing function. */
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.total_size	= 0,
 		.page_size	= 0,
 		.feature_bits	= 0,
@@ -9523,7 +9523,7 @@ 
 				.block_erase = erase_opaque,
 			}
 		},
-		.write		= write_opaque,
+		.writer		= {write_opaque, 0},
 		.read		= read_opaque,
 	},
 
@@ -9538,7 +9538,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid4,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9553,7 +9553,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9568,7 +9568,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9583,7 +9583,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9598,7 +9598,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9613,7 +9613,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9628,7 +9628,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9643,7 +9643,7 @@ 
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 		.read		= NULL,
 	},
 
@@ -9657,7 +9657,7 @@ 
 		.page_size	= 256,
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rdid,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 	},
 
 	{
@@ -9670,7 +9670,7 @@ 
 		.page_size	= 256,
 		.tested		= TEST_BAD_PREW,
 		.probe		= probe_spi_rems,
-		.write		= NULL,
+		.writer		= {NULL, 0},
 	},
 
 	{ NULL 	}
Index: flashrom-max_write_size/sfdp.c
===================================================================
--- flashrom-max_write_size/sfdp.c	(Revision 1587)
+++ flashrom-max_write_size/sfdp.c	(Arbeitskopie)
@@ -187,11 +187,13 @@ 
 	if (tmp32 & (1 << 2)) {
 		msg_cdbg2("at least 64 B.\n");
 		chip->page_size = 64;
-		chip->write = spi_chip_write_256;
+		chip->writer.write = spi_chip_write;
+		chip->writer.max_write_size = 64;
 	} else {
 		msg_cdbg2("1 B only.\n");
 		chip->page_size = 256;
-		chip->write = spi_chip_write_1;
+		chip->writer.write = spi_chip_write;
+		chip->writer.max_write_size = 1;
 	}
 
 	if ((tmp32 & 0x3) == 0x1) {
Index: flashrom-max_write_size/flashrom.c
===================================================================
--- flashrom-max_write_size/flashrom.c	(Revision 1587)
+++ flashrom-max_write_size/flashrom.c	(Arbeitskopie)
@@ -1276,8 +1276,7 @@ 
 		if (!writecount++)
 			msg_cdbg("W");
 		/* Needs the partial write function signature. */
-		ret = flash->chip->write(flash, newcontents + starthere,
-				   start + starthere, lenhere);
+		ret = flash->chip->writer.write(flash, newcontents + starthere, start + starthere, lenhere);
 		if (ret)
 			return ret;
 		starthere += lenhere;
@@ -1737,9 +1736,8 @@ 
 				return 1;
 			msg_cerr("Continuing anyway.\n");
 		}
-		if (!chip->write) {
-			msg_cerr("flashrom has no write function for this "
-				 "flash chip.\n");
+		if (!flash->chip->writer.write) {
+			msg_cerr("flashrom has no write function for this flash chip.\n");
 			return 1;
 		}
 	}
Index: flashrom-max_write_size/chipdrivers.h
===================================================================
--- flashrom-max_write_size/chipdrivers.h	(Revision 1587)
+++ flashrom-max_write_size/chipdrivers.h	(Arbeitskopie)
@@ -42,8 +42,7 @@ 
 int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
 int spi_block_erase_c7(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
 erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode);
-int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
-int spi_chip_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
+int spi_chip_write(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
 int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len);
 uint8_t spi_read_status_register(struct flashctx *flash);
 int spi_write_status_register(struct flashctx *flash, int status);
@@ -52,7 +51,6 @@ 
 void spi_prettyprint_status_register_welwip(uint8_t status);
 int spi_prettyprint_status_register(struct flashctx *flash);
 int spi_disable_blockprotect(struct flashctx *flash);
-int spi_byte_program(struct flashctx *flash, unsigned int addr, uint8_t databyte);
 int spi_nbyte_program(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
 int spi_nbyte_read(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
 int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize);