Unify chip write functions

The currently used write functions (wrappers) all use helpers which
perform the actual write (inner functions).

The signature of the write wrappers is: int write_chip(struct flashchip
*flash, uint8_t * buf);

The signature of the inner write functions varied a lot. This patch
changes them to: int write_part(struct flashchip *flash, uint8_t *src,
int start, int len);

Did you know that flashrom has only 8 inner write functions for all
flash chips? write_page_write_jedec_common write_sector_jedec_common
write_sector_28sf040 spi_chip_write_256_new spi_chip_write_1_new
spi_aai_write_new write_page_82802ab write_page_m29f400bt

Export all inner write functions.

Change the function signature of wait_82802ab to eliminate single-use
variables.

Remove an error message in write_page_m29f400bt which was printed for
every byte written regardless of success.

Add sharplhf00l04.c to the list of flash chip drivers in the Makefile.
While the functions in there are unused, I suspect we will need them
later, and by hooking the file up we ensure that compilation won't
break.

Corresponding to flashrom svn r1208.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/chipdrivers.h b/chipdrivers.h
index 60220e6..f19e991 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -65,12 +65,12 @@
 int spi_aai_write(struct flashchip *flash, uint8_t *buf);
 
 /* 82802ab.c */
-uint8_t wait_82802ab(chipaddr bios);
+uint8_t wait_82802ab(struct flashchip *flash);
 int probe_82802ab(struct flashchip *flash);
 int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize);
 int write_82802ab(struct flashchip *flash, uint8_t *buf);
 void print_status_82802ab(uint8_t status);
-void write_page_82802ab(chipaddr bios, uint8_t *src, chipaddr dst, int page_size);
+int write_page_82802ab(struct flashchip *flash, uint8_t *src, int start, int len);
 int unlock_82802ab(struct flashchip *flash);
 int unlock_28f004s5(struct flashchip *flash);
 
@@ -86,7 +86,8 @@
 int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize);
 int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
 int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
-int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, chipaddr dst, unsigned int page_size, unsigned int mask);
+int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, int start, int len, unsigned int mask);
+int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src, int start, int page_size, unsigned int mask);
 
 /* m29f400bt.c */
 int probe_m29f400bt(struct flashchip *flash);
@@ -94,8 +95,7 @@
 int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len);
 int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
 void protect_m29f400bt(chipaddr bios);
-void write_page_m29f400bt(chipaddr bios, uint8_t *src,
-			  chipaddr dst, int page_size);
+int write_page_m29f400bt(struct flashchip *flash, uint8_t *src, int start, int len);
 
 /* pm49fl00x.c */
 int unlock_49fl00x(struct flashchip *flash);
@@ -105,6 +105,7 @@
 int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
 int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size);
 int write_28sf040(struct flashchip *flash, uint8_t *buf);
+int write_sector_28sf040(struct flashchip *flash, uint8_t *src, int start, int len);
 
 /* sst49lfxxxc.c */
 int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size);