From cb44eb7dad17522f47792dca4fc499310ff7d6f3 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 22 Apr 2017 00:09:42 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/33638 Tested-by: build bot (Jenkins) Reviewed-by: HAOUAS Elyes Reviewed-by: Angel Pons --- bitbang_spi.c | 8 ++------ developerbox_spi.c | 1 - mcp6x_spi.c | 1 - nicintel_spi.c | 1 - ogp_spi.c | 1 - pony_spi.c | 1 - programmer.h | 26 -------------------------- rayer_spi.c | 1 - 8 files changed, 2 insertions(+), 38 deletions(-) diff --git a/bitbang_spi.c b/bitbang_spi.c index 4b3916411..2dad1499c 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -70,7 +70,6 @@ static int bitbang_spi_send_command(struct flashctx *flash, 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 @@ static int bitbang_spi_shutdown(const struct bitbang_spi_master *master) 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 4ad966ecc..c80a79449 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -121,7 +121,6 @@ static void cp210x_bitbang_set_sck_set_mosi(int sck, int mosi) } 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 971780d36..f3692778f 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -88,7 +88,6 @@ static int mcp6x_bitbang_get_miso(void) } 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 f31a2f92a..bdb70a725 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -168,7 +168,6 @@ static int nicintel_bitbang_get_miso(void) } 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 9a9e7fa3f..e603edb8b 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -83,7 +83,6 @@ static int ogp_bitbang_get_miso(void) } 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 39a468bb5..6c033081a 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -91,7 +91,6 @@ static int pony_bitbang_get_miso(void) } 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 9da49f87c..8f0183ff9 100644 --- a/programmer.h +++ b/programmer.h @@ -159,33 +159,7 @@ extern const struct programmer_entry programmer_table[]; 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 ef8ac2677..8e869e66d 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -157,7 +157,6 @@ static int rayer_bitbang_get_miso(void) } 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, -- cgit v1.2.3