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 | 7bca126561b80f626dea269d7a6284a7cde0a8ed (patch) | |
tree | 45c6b31e39846a88d89d157d758134d7b8dc1db1 | |
parent | 3464d05eb41ab4c7a6faba9a1a36bfbeda0de850 (diff) | |
download | flashrom-7bca126561b80f626dea269d7a6284a7cde0a8ed.tar.gz flashrom-7bca126561b80f626dea269d7a6284a7cde0a8ed.tar.bz2 flashrom-7bca126561b80f626dea269d7a6284a7cde0a8ed.zip |
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 51fc9c606..11d2de1e0 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 848868c7d..8e649d861 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[] = { diff --git a/dediprog.c b/dediprog.c index a730e4bac..df8af6155 100644 --- a/dediprog.c +++ b/dediprog.c @@ -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 29256c2ef..66d0df03e 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 aec2fd5e6..a5d382835 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 f4d30c98d..2f4646340 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 6f9ea8f80..d60fc5dec 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. */ diff --git a/sb600spi.c b/sb600spi.c index c3d77106e..e36ac9629 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -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 774890efa..38ac2d88f 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) |