Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/33638
Change subject: bitbang_spi: Drop bitbang_spi_master_type ......................................................................
bitbang_spi: Drop bitbang_spi_master_type
It only existed to make maintenance harder and waste our time.
Change-Id: I7a3b5d9ff1e99d2d4f873c6f19fb318f93762037 Signed-off-by: Nico Huber nico.h@gmx.de --- M bitbang_spi.c M developerbox_spi.c M mcp6x_spi.c M nicintel_spi.c M ogp_spi.c M pony_spi.c M programmer.h M rayer_spi.c 8 files changed, 2 insertions(+), 38 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/38/33638/1
diff --git a/bitbang_spi.c b/bitbang_spi.c index 4b39164..2dad149 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, @@ -92,11 +91,8 @@ int register_spi_bitbang_master(const struct bitbang_spi_master *master) { struct spi_master mst = spi_master_bitbang; - /* BITBANG_SPI_INVALID is 0, so if someone forgot to initialize ->type, - * we catch it here. Same goes for missing initialization of bitbanging - * functions. - */ - if (!master || master->type == BITBANG_SPI_INVALID || !master->set_cs || + /* If someone forgot to initialize a bitbang function, we catch it here. */ + if (!master || !master->set_cs || !master->set_sck || !master->set_mosi || !master->get_miso || (master->request_bus && !master->release_bus) || (!master->request_bus && master->release_bus)) { diff --git a/developerbox_spi.c b/developerbox_spi.c index 4ad966e..c80a794 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -121,7 +121,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_cp210x = { - .type = BITBANG_SPI_MASTER_DEVELOPERBOX, .set_cs = cp210x_bitbang_set_cs, .set_sck = cp210x_bitbang_set_sck, .set_mosi = cp210x_bitbang_set_mosi, diff --git a/mcp6x_spi.c b/mcp6x_spi.c index 971780d..f369277 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -88,7 +88,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_mcp6x = { - .type = BITBANG_SPI_MASTER_MCP, .set_cs = mcp6x_bitbang_set_cs, .set_sck = mcp6x_bitbang_set_sck, .set_mosi = mcp6x_bitbang_set_mosi, diff --git a/nicintel_spi.c b/nicintel_spi.c index f31a2f9..bdb70a7 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -168,7 +168,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_nicintel = { - .type = BITBANG_SPI_MASTER_NICINTEL, .set_cs = nicintel_bitbang_set_cs, .set_sck = nicintel_bitbang_set_sck, .set_mosi = nicintel_bitbang_set_mosi, diff --git a/ogp_spi.c b/ogp_spi.c index 9a9e7fa..e603edb 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -83,7 +83,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_ogp = { - .type = BITBANG_SPI_MASTER_OGP, .set_cs = ogp_bitbang_set_cs, .set_sck = ogp_bitbang_set_sck, .set_mosi = ogp_bitbang_set_mosi, diff --git a/pony_spi.c b/pony_spi.c index 39a468b..6c03308 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -91,7 +91,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_pony = { - .type = BITBANG_SPI_MASTER_PONY, .set_cs = pony_bitbang_set_cs, .set_sck = pony_bitbang_set_sck, .set_mosi = pony_bitbang_set_mosi, diff --git a/programmer.h b/programmer.h index 9da49f8..8f0183f 100644 --- a/programmer.h +++ b/programmer.h @@ -159,33 +159,7 @@ int programmer_init(enum programmer prog, const char *param); int programmer_shutdown(void);
-enum bitbang_spi_master_type { - BITBANG_SPI_INVALID = 0, /* This must always be the first entry. */ -#if CONFIG_RAYER_SPI == 1 - BITBANG_SPI_MASTER_RAYER, -#endif -#if CONFIG_PONY_SPI == 1 - BITBANG_SPI_MASTER_PONY, -#endif -#if CONFIG_NICINTEL_SPI == 1 - BITBANG_SPI_MASTER_NICINTEL, -#endif -#if CONFIG_INTERNAL == 1 -#if defined(__i386__) || defined(__x86_64__) - BITBANG_SPI_MASTER_MCP, -#endif -#endif -#if CONFIG_OGP_SPI == 1 - BITBANG_SPI_MASTER_OGP, -#endif -#if CONFIG_DEVELOPERBOX_SPI == 1 - BITBANG_SPI_MASTER_DEVELOPERBOX, -#endif -}; - struct bitbang_spi_master { - enum bitbang_spi_master_type type; - /* Note that CS# is active low, so val=0 means the chip is active. */ void (*set_cs) (int val); void (*set_sck) (int val); diff --git a/rayer_spi.c b/rayer_spi.c index ef8ac26..8e869e6 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -157,7 +157,6 @@ }
static const struct bitbang_spi_master bitbang_spi_master_rayer = { - .type = BITBANG_SPI_MASTER_RAYER, .set_cs = rayer_bitbang_set_cs, .set_sck = rayer_bitbang_set_sck, .set_mosi = rayer_bitbang_set_mosi,