Hello HAOUAS Elyes, David Hendricks, Stefan Reinauer,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/flashrom/+/33651
to review the following change.
Change subject: spi: Drop spi_controller type ......................................................................
spi: Drop spi_controller type
Not needed anymore. Drop it fast before it encourages anyone to layering violations again!
Change-Id: I8eda93b429e3ebaef79e22aba76be62987e496f4 Signed-off-by: Nico Huber nico.h@gmx.de --- M bitbang_spi.c M buspirate_spi.c M ch341a_spi.c M dediprog.c M digilent_spi.c M dummyflasher.c M ft2232_spi.c M ichspi.c M it85spi.c M it87spi.c M jlink_spi.c M linux_spi.c M mstarddc_spi.c M pickit2_spi.c M programmer.h M sb600spi.c M serprog.c M usbblaster_spi.c M wbsio_spi.c 19 files changed, 1 insertion(+), 81 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/51/33651/1
diff --git a/bitbang_spi.c b/bitbang_spi.c index 4b39164..fc941f4 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -70,7 +70,6 @@ unsigned char *readarr);
static const struct spi_master spi_master_bitbang = { - .type = SPI_CONTROLLER_BITBANG, .features = SPI_MASTER_4BA, .max_data_read = MAX_DATA_READ_UNLIMITED, .max_data_write = MAX_DATA_WRITE_UNLIMITED, diff --git a/buspirate_spi.c b/buspirate_spi.c index 09f10c3..fb066c2 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -133,7 +133,6 @@ const unsigned char *writearr, unsigned char *readarr);
static struct spi_master spi_master_buspirate = { - .type = SPI_CONTROLLER_BUSPIRATE, .features = SPI_MASTER_4BA, .max_data_read = MAX_DATA_UNSPECIFIED, .max_data_write = MAX_DATA_UNSPECIFIED, @@ -663,4 +662,4 @@ memcpy(readarr, bp_commbuf + 1, readcnt);
return ret; -} \ No newline at end of file +} diff --git a/ch341a_spi.c b/ch341a_spi.c index 83d5ccf..d3af32f 100644 --- a/ch341a_spi.c +++ b/ch341a_spi.c @@ -385,7 +385,6 @@ }
static const struct spi_master spi_master_ch341a_spi = { - .type = SPI_CONTROLLER_CH341A_SPI, .features = SPI_MASTER_4BA, /* flashrom's current maximum is 256 B. CH341A was tested on Linux and Windows to accept atleast * 128 kB. Basically there should be no hard limit because transfers are broken up into USB packets diff --git a/dediprog.c b/dediprog.c index 8552a3c..5aeb108 100644 --- a/dediprog.c +++ b/dediprog.c @@ -958,7 +958,6 @@ }
static struct spi_master spi_master_dediprog = { - .type = SPI_CONTROLLER_DEDIPROG, .features = SPI_MASTER_NO_4BA_MODES, .max_data_read = 16, /* 18 seems to work fine as well, but 19 times out sometimes with FW 5.15. */ .max_data_write = 16, diff --git a/digilent_spi.c b/digilent_spi.c index d42c90f..13a876e 100644 --- a/digilent_spi.c +++ b/digilent_spi.c @@ -313,7 +313,6 @@ }
static const struct spi_master spi_master_digilent_spi = { - .type = SPI_CONTROLLER_DIGILENT_SPI, .features = SPI_MASTER_4BA, .max_data_read = 252, .max_data_write = 252, diff --git a/dummyflasher.c b/dummyflasher.c index 22b28c4..63f0b19 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -107,7 +107,6 @@ static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
static const struct spi_master spi_master_dummyflasher = { - .type = SPI_CONTROLLER_DUMMY, .features = SPI_MASTER_4BA, .max_data_read = MAX_DATA_READ_UNLIMITED, .max_data_write = MAX_DATA_UNSPECIFIED, diff --git a/ft2232_spi.c b/ft2232_spi.c index 95584aa..7f4112c 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -154,7 +154,6 @@ unsigned char *readarr);
static const struct spi_master spi_master_ft2232 = { - .type = SPI_CONTROLLER_FT2232, .features = SPI_MASTER_4BA, .max_data_read = 64 * 1024, .max_data_write = 256, diff --git a/ichspi.c b/ichspi.c index a30ca02..5b26e8f 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1666,7 +1666,6 @@ }
static const struct spi_master spi_master_ich7 = { - .type = SPI_CONTROLLER_ICH7, .max_data_read = 64, .max_data_write = 64, .command = ich_spi_send_command, @@ -1677,7 +1676,6 @@ };
static const struct spi_master spi_master_ich9 = { - .type = SPI_CONTROLLER_ICH9, .max_data_read = 64, .max_data_write = 64, .command = ich_spi_send_command, @@ -1990,7 +1988,6 @@ }
static const struct spi_master spi_master_via = { - .type = SPI_CONTROLLER_VIA, .max_data_read = 16, .max_data_write = 16, .command = ich_spi_send_command, diff --git a/it85spi.c b/it85spi.c index e47cabb..e230109 100644 --- a/it85spi.c +++ b/it85spi.c @@ -276,7 +276,6 @@ unsigned char *readarr);
static const struct spi_master spi_master_it85xx = { - .type = SPI_CONTROLLER_IT85XX, .max_data_read = 64, .max_data_write = 64, .command = it85xx_spi_send_command, diff --git a/it87spi.c b/it87spi.c index 13b3aae..02dd7bd 100644 --- a/it87spi.c +++ b/it87spi.c @@ -108,7 +108,6 @@ unsigned int start, unsigned int len);
static const struct spi_master spi_master_it87xx = { - .type = SPI_CONTROLLER_IT87XX, .max_data_read = MAX_DATA_UNSPECIFIED, .max_data_write = MAX_DATA_UNSPECIFIED, .command = it8716f_spi_send_command, diff --git a/jlink_spi.c b/jlink_spi.c index 08a9ba9..8a69b41 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -152,7 +152,6 @@ }
static const struct spi_master spi_master_jlink_spi = { - .type = SPI_CONTROLLER_JLINK_SPI, /* Maximum data read size in one go (excluding opcode+address). */ .max_data_read = JTAG_MAX_TRANSFER_SIZE - 5, /* Maximum data write size in one go (excluding opcode+address). */ diff --git a/linux_spi.c b/linux_spi.c index 711ab4a..de09e60 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -54,7 +54,6 @@ unsigned int start, unsigned int len);
static const struct spi_master spi_master_linux = { - .type = SPI_CONTROLLER_LINUX, .features = SPI_MASTER_4BA, .max_data_read = MAX_DATA_UNSPECIFIED, /* TODO? */ .max_data_write = MAX_DATA_UNSPECIFIED, /* TODO? */ diff --git a/mstarddc_spi.c b/mstarddc_spi.c index afe4e12..db11157 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -220,7 +220,6 @@ }
static const struct spi_master spi_master_mstarddc = { - .type = SPI_CONTROLLER_MSTARDDC, .max_data_read = 256, .max_data_write = 256, .command = mstarddc_spi_send_command, diff --git a/pickit2_spi.c b/pickit2_spi.c index 4354025..e13e721 100644 --- a/pickit2_spi.c +++ b/pickit2_spi.c @@ -350,7 +350,6 @@ }
static const struct spi_master spi_master_pickit2 = { - .type = SPI_CONTROLLER_PICKIT2, .max_data_read = 40, .max_data_write = 40, .command = pickit2_spi_send_command, diff --git a/programmer.h b/programmer.h index 9da49f8..ed89c3f 100644 --- a/programmer.h +++ b/programmer.h @@ -597,64 +597,6 @@ char *extract_programmer_param(const char *param_name);
/* spi.c */ -enum spi_controller { - SPI_CONTROLLER_NONE, -#if CONFIG_INTERNAL == 1 -#if defined(__i386__) || defined(__x86_64__) - SPI_CONTROLLER_ICH7, - SPI_CONTROLLER_ICH9, - SPI_CONTROLLER_IT85XX, - SPI_CONTROLLER_IT87XX, - SPI_CONTROLLER_SB600, - SPI_CONTROLLER_YANGTZE, - SPI_CONTROLLER_VIA, - SPI_CONTROLLER_WBSIO, -#endif -#endif -#if CONFIG_FT2232_SPI == 1 - SPI_CONTROLLER_FT2232, -#endif -#if CONFIG_DUMMY == 1 - SPI_CONTROLLER_DUMMY, -#endif -#if CONFIG_BUSPIRATE_SPI == 1 - SPI_CONTROLLER_BUSPIRATE, -#endif -#if CONFIG_DEDIPROG == 1 - SPI_CONTROLLER_DEDIPROG, -#endif -#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) - SPI_CONTROLLER_BITBANG, -#endif -#if CONFIG_LINUX_MTD == 1 - SPI_CONTROLLER_LINUX_MTD, -#endif -#if CONFIG_LINUX_SPI == 1 - SPI_CONTROLLER_LINUX, -#endif -#if CONFIG_SERPROG == 1 - SPI_CONTROLLER_SERPROG, -#endif -#if CONFIG_USBBLASTER_SPI == 1 - SPI_CONTROLLER_USBBLASTER, -#endif -#if CONFIG_MSTARDDC_SPI == 1 - SPI_CONTROLLER_MSTARDDC, -#endif -#if CONFIG_PICKIT2_SPI == 1 - SPI_CONTROLLER_PICKIT2, -#endif -#if CONFIG_CH341A_SPI == 1 - SPI_CONTROLLER_CH341A_SPI, -#endif -#if CONFIG_DIGILENT_SPI == 1 - SPI_CONTROLLER_DIGILENT_SPI, -#endif -#if CONFIG_JLINK_SPI == 1 - SPI_CONTROLLER_JLINK_SPI, -#endif -}; - #define MAX_DATA_UNSPECIFIED 0 #define MAX_DATA_READ_UNLIMITED 64 * 1024 #define MAX_DATA_WRITE_UNLIMITED 256 @@ -664,7 +606,6 @@ register, 4BA mode switch) don't work */
struct spi_master { - enum spi_controller type; uint32_t features; unsigned int max_data_read; // (Ideally,) maximum data read size in one go (excluding opcode+address). unsigned int max_data_write; // (Ideally,) maximum data write size in one go (excluding opcode+address). diff --git a/sb600spi.c b/sb600spi.c index 1efb2ce..fd9487c 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -61,7 +61,6 @@ const unsigned char *writearr, unsigned char *readarr);
static struct spi_master spi_master_sb600 = { - .type = SPI_CONTROLLER_SB600, .max_data_read = FIFO_SIZE_OLD, .max_data_write = FIFO_SIZE_OLD - 3, .command = sb600_spi_send_command, @@ -72,7 +71,6 @@ };
static struct spi_master spi_master_yangtze = { - .type = SPI_CONTROLLER_YANGTZE, .max_data_read = FIFO_SIZE_YANGTZE - 3, /* Apparently the big SPI 100 buffer is not a ring buffer. */ .max_data_write = FIFO_SIZE_YANGTZE - 3, .command = spi100_spi_send_command, diff --git a/serprog.c b/serprog.c index c3d48a4..737c693 100644 --- a/serprog.c +++ b/serprog.c @@ -300,7 +300,6 @@ const unsigned char *writearr, unsigned char *readarr); static struct spi_master spi_master_serprog = { - .type = SPI_CONTROLLER_SERPROG, .features = SPI_MASTER_4BA, .max_data_read = MAX_DATA_READ_UNLIMITED, .max_data_write = MAX_DATA_WRITE_UNLIMITED, diff --git a/usbblaster_spi.c b/usbblaster_spi.c index fa984e5..eb973ad 100644 --- a/usbblaster_spi.c +++ b/usbblaster_spi.c @@ -208,7 +208,6 @@
static const struct spi_master spi_master_usbblaster = { - .type = SPI_CONTROLLER_USBBLASTER, .max_data_read = 256, .max_data_write = 256, .command = usbblaster_spi_send_command, diff --git a/wbsio_spi.c b/wbsio_spi.c index d7651c0..28b568e 100644 --- a/wbsio_spi.c +++ b/wbsio_spi.c @@ -65,7 +65,6 @@ unsigned int start, unsigned int len);
static const struct spi_master spi_master_wbsio = { - .type = SPI_CONTROLLER_WBSIO, .max_data_read = MAX_DATA_UNSPECIFIED, .max_data_write = MAX_DATA_UNSPECIFIED, .command = wbsio_spi_send_command,