Nico Huber has uploaded a new change for review. ( https://review.coreboot.org/19417 )
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 mcp6x_spi.c M nicintel_spi.c M ogp_spi.c M pony_spi.c M programmer.h M rayer_spi.c 7 files changed, 2 insertions(+), 34 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/19417/1
diff --git a/bitbang_spi.c b/bitbang_spi.c index 0b27a67..17b7426 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -64,7 +64,6 @@ unsigned char *readarr);
static const struct spi_master spi_master_bitbang = { - .type = SPI_CONTROLLER_BITBANG, .max_data_read = MAX_DATA_READ_UNLIMITED, .max_data_write = MAX_DATA_WRITE_UNLIMITED, .command = bitbang_spi_send_command, @@ -85,11 +84,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/mcp6x_spi.c b/mcp6x_spi.c index 4a57cb0..f41e6ab 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -92,7 +92,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 9195c79..348fd8b 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -159,7 +159,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 929ecd9..63895a2 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -87,7 +87,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 f8faeb3..0bae340 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -95,7 +95,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 3853413..63057d7 100644 --- a/programmer.h +++ b/programmer.h @@ -149,30 +149,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 -}; - 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 3656d26..dea7104 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -161,7 +161,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,