Author: hailfinger Date: Sat Jun 16 00:28:12 2012 New Revision: 1543 URL: http://flashrom.org/trac/flashrom/changeset/1543
Log: Let the programmer driver decide how to do AAI transfers
Currently spi_aai_write() is implemented without an abstraction mechanism for the programmer driver. This adds another function pointer 'write_aai' to struct spi_programmer, which is set to default_spi_write_aai (renamed spi_aai_write) for all programmers for now.
A patch which utilises this abstraction in the dediprog driver will follow.
Signed-off-by: Nico Huber nico.huber@secunet.com Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/bitbang_spi.c trunk/buspirate_spi.c trunk/dediprog.c trunk/dummyflasher.c trunk/ft2232_spi.c trunk/ichspi.c trunk/it85spi.c trunk/it87spi.c trunk/linux_spi.c trunk/programmer.h trunk/sb600spi.c trunk/serprog.c trunk/spi.c trunk/spi25.c trunk/wbsio_spi.c
Modified: trunk/bitbang_spi.c ============================================================================== --- trunk/bitbang_spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/bitbang_spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -71,6 +71,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
#if 0 // until it is needed
Modified: trunk/buspirate_spi.c ============================================================================== --- trunk/buspirate_spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/buspirate_spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -124,6 +124,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
static const struct buspirate_spispeeds spispeeds[] = {
Modified: trunk/dediprog.c ============================================================================== --- trunk/dediprog.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/dediprog.c Sat Jun 16 00:28:12 2012 (r1543) @@ -709,6 +709,7 @@ .multicommand = default_spi_send_multicommand, .read = dediprog_spi_read, .write_256 = dediprog_spi_write_256, + .write_aai = default_spi_write_aai, };
static int dediprog_shutdown(void *data)
Modified: trunk/dummyflasher.c ============================================================================== --- trunk/dummyflasher.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/dummyflasher.c Sat Jun 16 00:28:12 2012 (r1543) @@ -127,6 +127,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = dummy_spi_write_256, + .write_aai = default_spi_write_aai, };
static const struct par_programmer par_programmer_dummy = {
Modified: trunk/ft2232_spi.c ============================================================================== --- trunk/ft2232_spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/ft2232_spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -148,6 +148,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
/* Returns 0 upon success, a negative number upon errors. */
Modified: trunk/ichspi.c ============================================================================== --- trunk/ichspi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/ichspi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -1521,6 +1521,7 @@ .multicommand = ich_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
static const struct spi_programmer spi_programmer_ich9 = { @@ -1531,6 +1532,7 @@ .multicommand = ich_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
static const struct opaque_programmer opaque_programmer_ich_hwseq = { @@ -1838,6 +1840,7 @@ .multicommand = ich_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
int via_init_spi(struct pci_dev *dev)
Modified: trunk/it85spi.c ============================================================================== --- trunk/it85spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/it85spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -283,6 +283,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
int it85xx_spi_init(struct superio s)
Modified: trunk/it87spi.c ============================================================================== --- trunk/it87spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/it87spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -120,6 +120,7 @@ .multicommand = default_spi_send_multicommand, .read = it8716f_spi_chip_read, .write_256 = it8716f_spi_chip_write_256, + .write_aai = default_spi_write_aai, };
static uint16_t it87spi_probe(uint16_t port)
Modified: trunk/linux_spi.c ============================================================================== --- trunk/linux_spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/linux_spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -54,6 +54,7 @@ .multicommand = default_spi_send_multicommand, .read = linux_spi_read, .write_256 = linux_spi_write_256, + .write_aai = default_spi_write_aai, };
int linux_spi_init(void)
Modified: trunk/programmer.h ============================================================================== --- trunk/programmer.h Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/programmer.h Sat Jun 16 00:28:12 2012 (r1543) @@ -530,6 +530,7 @@ /* Optimized functions for this programmer */ int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int (*write_256)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); + int (*write_aai)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); const void *data; };
@@ -538,6 +539,7 @@ int default_spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds); int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int default_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); +int default_spi_write_aai(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int register_spi_programmer(const struct spi_programmer *programmer);
/* The following enum is needed by ich_descriptor_tool and ich* code. */
Modified: trunk/sb600spi.c ============================================================================== --- trunk/sb600spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/sb600spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -201,6 +201,7 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
int sb600_probe_spi(struct pci_dev *dev)
Modified: trunk/serprog.c ============================================================================== --- trunk/serprog.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/serprog.c Sat Jun 16 00:28:12 2012 (r1543) @@ -313,6 +313,7 @@ .multicommand = default_spi_send_multicommand, .read = serprog_spi_read, .write_256 = default_spi_write_256, + .write_aai = default_spi_write_aai, };
static void serprog_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/spi.c ============================================================================== --- trunk/spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -161,11 +161,17 @@ } }
+int spi_aai_write(struct flashctx *flash, uint8_t *buf, + unsigned int start, unsigned int len) +{ + return flash->pgm->spi.write_aai(flash, buf, start, len); +} + int register_spi_programmer(const struct spi_programmer *pgm) { struct registered_programmer rpgm;
- if (!pgm->write_256 || !pgm->read || !pgm->command || + if (!pgm->write_aai || !pgm->write_256 || !pgm->read || !pgm->command || !pgm->multicommand || ((pgm->command == default_spi_send_command) && (pgm->multicommand == default_spi_send_multicommand))) {
Modified: trunk/spi25.c ============================================================================== --- trunk/spi25.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/spi25.c Sat Jun 16 00:28:12 2012 (r1543) @@ -1069,8 +1069,7 @@ return 0; }
-int spi_aai_write(struct flashctx *flash, uint8_t *buf, unsigned int start, - unsigned int len) +int default_spi_write_aai(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) { uint32_t pos = start; int result;
Modified: trunk/wbsio_spi.c ============================================================================== --- trunk/wbsio_spi.c Thu Jun 14 15:08:33 2012 (r1542) +++ trunk/wbsio_spi.c Sat Jun 16 00:28:12 2012 (r1543) @@ -75,6 +75,7 @@ .multicommand = default_spi_send_multicommand, .read = wbsio_spi_read, .write_256 = spi_chip_write_1, + .write_aai = default_spi_write_aai, };
int wbsio_check_for_spi(void)