mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
spi: Drop spi_controller type
Not needed anymore. Drop it fast before it encourages anyone to violate layers again! Change-Id: I8eda93b429e3ebaef79e22aba76be62987e496f4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/33651 Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
959aafa53e
commit
deeac7e41a
@ -133,7 +133,6 @@ static int buspirate_spi_send_command_v2(struct flashctx *flash, unsigned int wr
|
|||||||
const unsigned char *writearr, unsigned char *readarr);
|
const unsigned char *writearr, unsigned char *readarr);
|
||||||
|
|
||||||
static struct spi_master spi_master_buspirate = {
|
static struct spi_master spi_master_buspirate = {
|
||||||
.type = SPI_CONTROLLER_BUSPIRATE,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = MAX_DATA_UNSPECIFIED,
|
.max_data_read = MAX_DATA_UNSPECIFIED,
|
||||||
.max_data_write = MAX_DATA_UNSPECIFIED,
|
.max_data_write = MAX_DATA_UNSPECIFIED,
|
||||||
@ -663,4 +662,4 @@ static int buspirate_spi_send_command_v2(struct flashctx *flash, unsigned int wr
|
|||||||
memcpy(readarr, bp_commbuf + 1, readcnt);
|
memcpy(readarr, bp_commbuf + 1, readcnt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,6 @@ static int ch341a_spi_spi_send_command(struct flashctx *flash, unsigned int writ
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_ch341a_spi = {
|
static const struct spi_master spi_master_ch341a_spi = {
|
||||||
.type = SPI_CONTROLLER_CH341A_SPI,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
/* flashrom's current maximum is 256 B. CH341A was tested on Linux and Windows to accept atleast
|
/* 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
|
* 128 kB. Basically there should be no hard limit because transfers are broken up into USB packets
|
||||||
|
@ -966,7 +966,6 @@ static int parse_voltage(char *voltage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct spi_master spi_master_dediprog = {
|
static struct spi_master spi_master_dediprog = {
|
||||||
.type = SPI_CONTROLLER_DEDIPROG,
|
|
||||||
.features = SPI_MASTER_NO_4BA_MODES,
|
.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_read = 16, /* 18 seems to work fine as well, but 19 times out sometimes with FW 5.15. */
|
||||||
.max_data_write = 16,
|
.max_data_write = 16,
|
||||||
|
@ -313,7 +313,6 @@ static int digilent_spi_send_command(struct flashctx *flash, unsigned int writec
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_digilent_spi = {
|
static const struct spi_master spi_master_digilent_spi = {
|
||||||
.type = SPI_CONTROLLER_DIGILENT_SPI,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = 252,
|
.max_data_read = 252,
|
||||||
.max_data_write = 252,
|
.max_data_write = 252,
|
||||||
|
@ -107,7 +107,6 @@ static uint32_t dummy_chip_readl(const struct flashctx *flash, const chipaddr ad
|
|||||||
static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
|
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 = {
|
static const struct spi_master spi_master_dummyflasher = {
|
||||||
.type = SPI_CONTROLLER_DUMMY,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = MAX_DATA_READ_UNLIMITED,
|
.max_data_read = MAX_DATA_READ_UNLIMITED,
|
||||||
.max_data_write = MAX_DATA_UNSPECIFIED,
|
.max_data_write = MAX_DATA_UNSPECIFIED,
|
||||||
|
@ -154,7 +154,6 @@ static int ft2232_spi_send_command(struct flashctx *flash,
|
|||||||
unsigned char *readarr);
|
unsigned char *readarr);
|
||||||
|
|
||||||
static const struct spi_master spi_master_ft2232 = {
|
static const struct spi_master spi_master_ft2232 = {
|
||||||
.type = SPI_CONTROLLER_FT2232,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = 64 * 1024,
|
.max_data_read = 64 * 1024,
|
||||||
.max_data_write = 256,
|
.max_data_write = 256,
|
||||||
|
3
ichspi.c
3
ichspi.c
@ -1666,7 +1666,6 @@ static void ich9_set_pr(const size_t reg_pr0, int i, int read_prot, int write_pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_ich7 = {
|
static const struct spi_master spi_master_ich7 = {
|
||||||
.type = SPI_CONTROLLER_ICH7,
|
|
||||||
.max_data_read = 64,
|
.max_data_read = 64,
|
||||||
.max_data_write = 64,
|
.max_data_write = 64,
|
||||||
.command = ich_spi_send_command,
|
.command = ich_spi_send_command,
|
||||||
@ -1677,7 +1676,6 @@ static const struct spi_master spi_master_ich7 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct spi_master spi_master_ich9 = {
|
static const struct spi_master spi_master_ich9 = {
|
||||||
.type = SPI_CONTROLLER_ICH9,
|
|
||||||
.max_data_read = 64,
|
.max_data_read = 64,
|
||||||
.max_data_write = 64,
|
.max_data_write = 64,
|
||||||
.command = ich_spi_send_command,
|
.command = ich_spi_send_command,
|
||||||
@ -1990,7 +1988,6 @@ int ich_init_spi(void *spibar, enum ich_chipset ich_gen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_via = {
|
static const struct spi_master spi_master_via = {
|
||||||
.type = SPI_CONTROLLER_VIA,
|
|
||||||
.max_data_read = 16,
|
.max_data_read = 16,
|
||||||
.max_data_write = 16,
|
.max_data_write = 16,
|
||||||
.command = ich_spi_send_command,
|
.command = ich_spi_send_command,
|
||||||
|
@ -276,7 +276,6 @@ static int it85xx_spi_send_command(struct flashctx *flash,
|
|||||||
unsigned char *readarr);
|
unsigned char *readarr);
|
||||||
|
|
||||||
static const struct spi_master spi_master_it85xx = {
|
static const struct spi_master spi_master_it85xx = {
|
||||||
.type = SPI_CONTROLLER_IT85XX,
|
|
||||||
.max_data_read = 64,
|
.max_data_read = 64,
|
||||||
.max_data_write = 64,
|
.max_data_write = 64,
|
||||||
.command = it85xx_spi_send_command,
|
.command = it85xx_spi_send_command,
|
||||||
|
@ -108,7 +108,6 @@ static int it8716f_spi_chip_write_256(struct flashctx *flash, const uint8_t *buf
|
|||||||
unsigned int start, unsigned int len);
|
unsigned int start, unsigned int len);
|
||||||
|
|
||||||
static const struct spi_master spi_master_it87xx = {
|
static const struct spi_master spi_master_it87xx = {
|
||||||
.type = SPI_CONTROLLER_IT87XX,
|
|
||||||
.max_data_read = MAX_DATA_UNSPECIFIED,
|
.max_data_read = MAX_DATA_UNSPECIFIED,
|
||||||
.max_data_write = MAX_DATA_UNSPECIFIED,
|
.max_data_write = MAX_DATA_UNSPECIFIED,
|
||||||
.command = it8716f_spi_send_command,
|
.command = it8716f_spi_send_command,
|
||||||
|
@ -152,7 +152,6 @@ static int jlink_spi_send_command(struct flashctx *flash, unsigned int writecnt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_jlink_spi = {
|
static const struct spi_master spi_master_jlink_spi = {
|
||||||
.type = SPI_CONTROLLER_JLINK_SPI,
|
|
||||||
/* Maximum data read size in one go (excluding opcode+address). */
|
/* Maximum data read size in one go (excluding opcode+address). */
|
||||||
.max_data_read = JTAG_MAX_TRANSFER_SIZE - 5,
|
.max_data_read = JTAG_MAX_TRANSFER_SIZE - 5,
|
||||||
/* Maximum data write size in one go (excluding opcode+address). */
|
/* Maximum data write size in one go (excluding opcode+address). */
|
||||||
|
@ -54,7 +54,6 @@ static int linux_spi_write_256(struct flashctx *flash, const uint8_t *buf,
|
|||||||
unsigned int start, unsigned int len);
|
unsigned int start, unsigned int len);
|
||||||
|
|
||||||
static const struct spi_master spi_master_linux = {
|
static const struct spi_master spi_master_linux = {
|
||||||
.type = SPI_CONTROLLER_LINUX,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = MAX_DATA_UNSPECIFIED, /* TODO? */
|
.max_data_read = MAX_DATA_UNSPECIFIED, /* TODO? */
|
||||||
.max_data_write = MAX_DATA_UNSPECIFIED, /* TODO? */
|
.max_data_write = MAX_DATA_UNSPECIFIED, /* TODO? */
|
||||||
|
@ -220,7 +220,6 @@ static int mstarddc_spi_send_command(struct flashctx *flash,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_mstarddc = {
|
static const struct spi_master spi_master_mstarddc = {
|
||||||
.type = SPI_CONTROLLER_MSTARDDC,
|
|
||||||
.max_data_read = 256,
|
.max_data_read = 256,
|
||||||
.max_data_write = 256,
|
.max_data_write = 256,
|
||||||
.command = mstarddc_spi_send_command,
|
.command = mstarddc_spi_send_command,
|
||||||
|
@ -350,7 +350,6 @@ static int parse_voltage(char *voltage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_master spi_master_pickit2 = {
|
static const struct spi_master spi_master_pickit2 = {
|
||||||
.type = SPI_CONTROLLER_PICKIT2,
|
|
||||||
.max_data_read = 40,
|
.max_data_read = 40,
|
||||||
.max_data_write = 40,
|
.max_data_write = 40,
|
||||||
.command = pickit2_spi_send_command,
|
.command = pickit2_spi_send_command,
|
||||||
|
59
programmer.h
59
programmer.h
@ -571,64 +571,6 @@ unsigned int count_max_decode_exceedings(const struct flashctx *flash);
|
|||||||
char *extract_programmer_param(const char *param_name);
|
char *extract_programmer_param(const char *param_name);
|
||||||
|
|
||||||
/* spi.c */
|
/* 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_UNSPECIFIED 0
|
||||||
#define MAX_DATA_READ_UNLIMITED 64 * 1024
|
#define MAX_DATA_READ_UNLIMITED 64 * 1024
|
||||||
#define MAX_DATA_WRITE_UNLIMITED 256
|
#define MAX_DATA_WRITE_UNLIMITED 256
|
||||||
@ -638,7 +580,6 @@ enum spi_controller {
|
|||||||
register, 4BA mode switch) don't work */
|
register, 4BA mode switch) don't work */
|
||||||
|
|
||||||
struct spi_master {
|
struct spi_master {
|
||||||
enum spi_controller type;
|
|
||||||
uint32_t features;
|
uint32_t features;
|
||||||
unsigned int max_data_read; // (Ideally,) maximum data read size in one go (excluding opcode+address).
|
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).
|
unsigned int max_data_write; // (Ideally,) maximum data write size in one go (excluding opcode+address).
|
||||||
|
@ -61,7 +61,6 @@ static int spi100_spi_send_command(struct flashctx *flash, unsigned int writecnt
|
|||||||
const unsigned char *writearr, unsigned char *readarr);
|
const unsigned char *writearr, unsigned char *readarr);
|
||||||
|
|
||||||
static struct spi_master spi_master_sb600 = {
|
static struct spi_master spi_master_sb600 = {
|
||||||
.type = SPI_CONTROLLER_SB600,
|
|
||||||
.max_data_read = FIFO_SIZE_OLD,
|
.max_data_read = FIFO_SIZE_OLD,
|
||||||
.max_data_write = FIFO_SIZE_OLD - 3,
|
.max_data_write = FIFO_SIZE_OLD - 3,
|
||||||
.command = sb600_spi_send_command,
|
.command = sb600_spi_send_command,
|
||||||
@ -72,7 +71,6 @@ static struct spi_master spi_master_sb600 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct spi_master spi_master_yangtze = {
|
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_read = FIFO_SIZE_YANGTZE - 3, /* Apparently the big SPI 100 buffer is not a ring buffer. */
|
||||||
.max_data_write = FIFO_SIZE_YANGTZE - 3,
|
.max_data_write = FIFO_SIZE_YANGTZE - 3,
|
||||||
.command = spi100_spi_send_command,
|
.command = spi100_spi_send_command,
|
||||||
|
@ -300,7 +300,6 @@ static int serprog_spi_send_command(struct flashctx *flash,
|
|||||||
const unsigned char *writearr,
|
const unsigned char *writearr,
|
||||||
unsigned char *readarr);
|
unsigned char *readarr);
|
||||||
static struct spi_master spi_master_serprog = {
|
static struct spi_master spi_master_serprog = {
|
||||||
.type = SPI_CONTROLLER_SERPROG,
|
|
||||||
.features = SPI_MASTER_4BA,
|
.features = SPI_MASTER_4BA,
|
||||||
.max_data_read = MAX_DATA_READ_UNLIMITED,
|
.max_data_read = MAX_DATA_READ_UNLIMITED,
|
||||||
.max_data_write = MAX_DATA_WRITE_UNLIMITED,
|
.max_data_write = MAX_DATA_WRITE_UNLIMITED,
|
||||||
|
@ -208,7 +208,6 @@ static int usbblaster_spi_send_command(struct flashctx *flash, unsigned int writ
|
|||||||
|
|
||||||
|
|
||||||
static const struct spi_master spi_master_usbblaster = {
|
static const struct spi_master spi_master_usbblaster = {
|
||||||
.type = SPI_CONTROLLER_USBBLASTER,
|
|
||||||
.max_data_read = 256,
|
.max_data_read = 256,
|
||||||
.max_data_write = 256,
|
.max_data_write = 256,
|
||||||
.command = usbblaster_spi_send_command,
|
.command = usbblaster_spi_send_command,
|
||||||
|
@ -65,7 +65,6 @@ static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf,
|
|||||||
unsigned int start, unsigned int len);
|
unsigned int start, unsigned int len);
|
||||||
|
|
||||||
static const struct spi_master spi_master_wbsio = {
|
static const struct spi_master spi_master_wbsio = {
|
||||||
.type = SPI_CONTROLLER_WBSIO,
|
|
||||||
.max_data_read = MAX_DATA_UNSPECIFIED,
|
.max_data_read = MAX_DATA_UNSPECIFIED,
|
||||||
.max_data_write = MAX_DATA_UNSPECIFIED,
|
.max_data_write = MAX_DATA_UNSPECIFIED,
|
||||||
.command = wbsio_spi_send_command,
|
.command = wbsio_spi_send_command,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user