diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-06-15 22:28:12 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2012-06-15 22:28:12 +0000 |
commit | 67c7dcc26f4ff449d915d6610c8a453821877bb0 (patch) | |
tree | 45c6b31e39846a88d89d157d758134d7b8dc1db1 | |
parent | c10ff1ed4f6d5eab827f89784578582be328ac5d (diff) | |
download | flashrom-67c7dcc26f4ff449d915d6610c8a453821877bb0.zip flashrom-67c7dcc26f4ff449d915d6610c8a453821877bb0.tar.gz |
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.
Corresponding to flashrom svn r1543.
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
-rw-r--r-- | bitbang_spi.c | 1 | ||||
-rw-r--r-- | buspirate_spi.c | 1 | ||||
-rw-r--r-- | dediprog.c | 1 | ||||
-rw-r--r-- | dummyflasher.c | 1 | ||||
-rw-r--r-- | ft2232_spi.c | 1 | ||||
-rw-r--r-- | ichspi.c | 3 | ||||
-rw-r--r-- | it85spi.c | 1 | ||||
-rw-r--r-- | it87spi.c | 1 | ||||
-rw-r--r-- | linux_spi.c | 1 | ||||
-rw-r--r-- | programmer.h | 2 | ||||
-rw-r--r-- | sb600spi.c | 1 | ||||
-rw-r--r-- | serprog.c | 1 | ||||
-rw-r--r-- | spi.c | 8 | ||||
-rw-r--r-- | spi25.c | 3 | ||||
-rw-r--r-- | wbsio_spi.c | 1 |
15 files changed, 24 insertions, 3 deletions
diff --git a/bitbang_spi.c b/bitbang_spi.c index 51fc9c6..11d2de1 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -71,6 +71,7 @@ static const struct spi_programmer spi_programmer_bitbang = { .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 diff --git a/buspirate_spi.c b/buspirate_spi.c index 848868c..8e649d8 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -124,6 +124,7 @@ static const struct spi_programmer spi_programmer_buspirate = { .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[] = { @@ -709,6 +709,7 @@ static const struct spi_programmer spi_programmer_dediprog = { .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) diff --git a/dummyflasher.c b/dummyflasher.c index 29256c2..66d0df0 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -127,6 +127,7 @@ static const struct spi_programmer spi_programmer_dummyflasher = { .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 = { diff --git a/ft2232_spi.c b/ft2232_spi.c index aec2fd5..a5d3828 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -148,6 +148,7 @@ static const struct spi_programmer spi_programmer_ft2232 = { .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. */ @@ -1521,6 +1521,7 @@ static const struct spi_programmer spi_programmer_ich7 = { .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 @@ static const struct spi_programmer spi_programmer_ich9 = { .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 @@ static const struct spi_programmer spi_programmer_via = { .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) @@ -283,6 +283,7 @@ static const struct spi_programmer spi_programmer_it85xx = { .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) @@ -120,6 +120,7 @@ static const struct spi_programmer spi_programmer_it87xx = { .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) diff --git a/linux_spi.c b/linux_spi.c index f4d30c9..2f46463 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -54,6 +54,7 @@ static const struct spi_programmer spi_programmer_linux = { .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) diff --git a/programmer.h b/programmer.h index 6f9ea8f..d60fc5d 100644 --- a/programmer.h +++ b/programmer.h @@ -530,6 +530,7 @@ struct spi_programmer { /* 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_command(struct flashctx *flash, unsigned int writecnt, unsi 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. */ @@ -201,6 +201,7 @@ static const struct spi_programmer spi_programmer_sb600 = { .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) @@ -313,6 +313,7 @@ static struct spi_programmer spi_programmer_serprog = { .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, @@ -161,11 +161,17 @@ uint32_t spi_get_valid_read_addr(struct flashctx *flash) } } +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))) { @@ -1069,8 +1069,7 @@ int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start, 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; diff --git a/wbsio_spi.c b/wbsio_spi.c index 774890e..38ac2d8 100644 --- a/wbsio_spi.c +++ b/wbsio_spi.c @@ -75,6 +75,7 @@ static const struct spi_programmer spi_programmer_wbsio = { .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) |