Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67479 )
Change subject: spi: Make 'default_spi_write_aai' the default unless defined ......................................................................
spi: Make 'default_spi_write_aai' the default unless defined
Drop the explicit need to specify the default 'default_spi_write_aai' callback function pointer. This is a reasonable default for every other driver in the tree with only a few exceptions.
This simplifies the code and driver development.
Change-Id: I7f14aaea0edcf0c08cea0e9cd27d58152707fb2a Signed-off-by: Edward O'Callaghan quasisec@google.com --- M bitbang_spi.c M buspirate_spi.c M ch341a_spi.c M digilent_spi.c M dummyflasher.c M ft2232_spi.c M ichspi.c M jlink_spi.c M linux_spi.c M mediatek_i2c_spi.c M mstarddc_spi.c M ni845x_spi.c M pickit2_spi.c M raiden_debug_spi.c M sb600spi.c M serprog.c M spi.c M stlinkv3_spi.c M usbblaster_spi.c 19 files changed, 20 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/67479/1
diff --git a/bitbang_spi.c b/bitbang_spi.c index a926b10..2823131 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -146,7 +146,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = bitbang_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/buspirate_spi.c b/buspirate_spi.c index 0704887..6a62ed9 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -181,7 +181,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = buspirate_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/ch341a_spi.c b/ch341a_spi.c index 48c6420..54675b3 100644 --- a/ch341a_spi.c +++ b/ch341a_spi.c @@ -416,7 +416,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = ch341a_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/digilent_spi.c b/digilent_spi.c index 41342a8..12c9ec2 100644 --- a/digilent_spi.c +++ b/digilent_spi.c @@ -336,7 +336,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = digilent_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/dummyflasher.c b/dummyflasher.c index 49a541b..b52c110 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -927,7 +927,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = dummy_spi_write_256, - .write_aai = default_spi_write_aai, .probe_opcode = dummy_spi_probe_opcode, };
diff --git a/ft2232_spi.c b/ft2232_spi.c index 5b45d7e..ab9d296 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -299,7 +299,6 @@ .multicommand = ft2232_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = ft2232_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/ichspi.c b/ichspi.c index f5876b7..b50019c 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1810,7 +1810,6 @@ .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_master spi_master_ich9 = { @@ -1820,7 +1819,6 @@ .multicommand = ich_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .probe_opcode = ich_spi_probe_opcode, };
@@ -2236,7 +2234,6 @@ .multicommand = ich_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .probe_opcode = ich_spi_probe_opcode, };
diff --git a/jlink_spi.c b/jlink_spi.c index 52fc786..ddc1b6b 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -187,7 +187,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .features = SPI_MASTER_4BA, .shutdown = jlink_spi_shutdown, .probe_opcode = default_spi_probe_opcode, diff --git a/linux_spi.c b/linux_spi.c index 09ee8a0..9e29007 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -119,7 +119,6 @@ .multicommand = default_spi_send_multicommand, .read = linux_spi_read, .write_256 = linux_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = linux_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c index 39a9cea..f0f700b 100644 --- a/mediatek_i2c_spi.c +++ b/mediatek_i2c_spi.c @@ -459,7 +459,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = mediatek_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/mstarddc_spi.c b/mstarddc_spi.c index af46b24..206aa73 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -145,7 +145,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = mstarddc_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/ni845x_spi.c b/ni845x_spi.c index 3d74fd9..e4933b4 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -535,7 +535,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = ni845x_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/pickit2_spi.c b/pickit2_spi.c index b838234..0c63880 100644 --- a/pickit2_spi.c +++ b/pickit2_spi.c @@ -383,7 +383,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = pickit2_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c index 28cab06..01c61f9 100644 --- a/raiden_debug_spi.c +++ b/raiden_debug_spi.c @@ -1319,7 +1319,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = raiden_debug_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/sb600spi.c b/sb600spi.c index 8b02b51..dab240c 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -602,7 +602,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = sb600spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; @@ -614,7 +613,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = sb600spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; @@ -626,7 +624,6 @@ .multicommand = default_spi_send_multicommand, .read = promontory_read_memmapped, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = sb600spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/serprog.c b/serprog.c index 57196a9..c6932e8 100644 --- a/serprog.c +++ b/serprog.c @@ -446,7 +446,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .probe_opcode = default_spi_probe_opcode, };
diff --git a/spi.c b/spi.c index 38d8d01..25df687 100644 --- a/spi.c +++ b/spi.c @@ -131,7 +131,9 @@
int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len) { - return flash->mst->spi.write_aai(flash, buf, start, len); + if (flash->mst->spi.write_aai) + return flash->mst->spi.write_aai(flash, buf, start, len); + return default_spi_write_aai(flash, buf, start, len); }
bool default_spi_probe_opcode(struct flashctx *flash, uint8_t opcode) @@ -150,7 +152,7 @@ } }
- if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command || + if (!mst->write_256 || !mst->read || !mst->command || !mst->multicommand || !mst->probe_opcode || ((mst->command == default_spi_send_command) && (mst->multicommand == default_spi_send_multicommand))) { diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index 38fe9f9..b2da2fe 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -469,7 +469,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = stlinkv3_spi_shutdown, .probe_opcode = default_spi_probe_opcode, }; diff --git a/usbblaster_spi.c b/usbblaster_spi.c index 2880a3c..67279c9 100644 --- a/usbblaster_spi.c +++ b/usbblaster_spi.c @@ -171,7 +171,6 @@ .multicommand = default_spi_send_multicommand, .read = default_spi_read, .write_256 = default_spi_write_256, - .write_aai = default_spi_write_aai, .shutdown = usbblaster_shutdown, .probe_opcode = default_spi_probe_opcode, };