summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--digilent_spi.c5
-rw-r--r--dummyflasher.c5
-rw-r--r--ft2232_spi.c6
-rw-r--r--it85spi.c6
-rw-r--r--it87spi.c5
-rw-r--r--jlink_spi.c5
-rw-r--r--linux_spi.c5
-rw-r--r--lspcon_i2c_spi.c5
-rw-r--r--pickit2_spi.c5
-rw-r--r--usbblaster_spi.c5
-rw-r--r--wbsio_spi.c5
11 files changed, 22 insertions, 35 deletions
diff --git a/digilent_spi.c b/digilent_spi.c
index 5471724e4..ee788901d 100644
--- a/digilent_spi.c
+++ b/digilent_spi.c
@@ -315,7 +315,7 @@ static int digilent_spi_send_command(const struct flashctx *flash, unsigned int
return 0;
}
-static struct spi_master spi_master_digilent_spi = {
+static const struct spi_master spi_master_digilent_spi = {
.features = SPI_MASTER_4BA,
.max_data_read = 252,
.max_data_write = 252,
@@ -454,10 +454,9 @@ int digilent_spi_init(void)
}
digilent_data->reset_board = reset_board;
digilent_data->handle = handle;
- spi_master_digilent_spi.data = digilent_data;
register_shutdown(digilent_spi_shutdown, digilent_data);
- register_spi_master(&spi_master_digilent_spi, NULL);
+ register_spi_master(&spi_master_digilent_spi, digilent_data);
return 0;
diff --git a/dummyflasher.c b/dummyflasher.c
index 74075f4ea..d434eec34 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -611,7 +611,7 @@ static int dummy_spi_send_command(const struct flashctx *flash, unsigned int wri
-static struct spi_master spi_master_dummyflasher = {
+static const struct spi_master spi_master_dummyflasher = {
.features = SPI_MASTER_4BA,
.max_data_read = MAX_DATA_READ_UNLIMITED,
.max_data_write = MAX_DATA_UNSPECIFIED,
@@ -674,7 +674,6 @@ int dummy_init(void)
}
data->emu_chip = EMULATE_NONE;
data->delay_us = 0;
- spi_master_dummyflasher.data = data;
par_master_dummy.data = data;
msg_pspew("%s\n", __func__);
@@ -1030,7 +1029,7 @@ dummy_init_out:
register_par_master(&par_master_dummy,
dummy_buses_supported & (BUS_PARALLEL | BUS_LPC | BUS_FWH));
if (dummy_buses_supported & BUS_SPI)
- register_spi_master(&spi_master_dummyflasher, NULL);
+ register_spi_master(&spi_master_dummyflasher, data);
return 0;
}
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 8d50d2041..6072cd26e 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -276,7 +276,7 @@ static int ft2232_spi_send_command(const struct flashctx *flash,
return failed ? -1 : 0;
}
-static struct spi_master spi_master_ft2232 = {
+static const struct spi_master spi_master_ft2232 = {
.features = SPI_MASTER_4BA,
.max_data_read = 64 * 1024,
.max_data_write = 256,
@@ -620,13 +620,11 @@ int ft2232_spi_init(void)
spi_data->pindir = pindir;
spi_data->ftdic_context = ftdic;
- spi_master_ft2232.data = spi_data;
-
if (register_shutdown(ft2232_shutdown, spi_data)) {
free(spi_data);
goto ftdi_err;
}
- register_spi_master(&spi_master_ft2232, NULL);
+ register_spi_master(&spi_master_ft2232, spi_data);
return 0;
diff --git a/it85spi.c b/it85spi.c
index 4d0f98801..810f062c5 100644
--- a/it85spi.c
+++ b/it85spi.c
@@ -281,7 +281,7 @@ static int it85xx_spi_send_command(const struct flashctx *flash,
return 0;
}
-static struct spi_master spi_master_it85xx = {
+static const struct spi_master spi_master_it85xx = {
.max_data_read = 64,
.max_data_write = 64,
.command = it85xx_spi_send_command,
@@ -358,15 +358,13 @@ int it85xx_spi_init(struct superio s)
return 1;
}
- spi_master_it85xx.data = data;
-
/* FIXME: Really leave FWH enabled? We can't use this region
* anymore since accessing it would mess up IT85 communication.
* If we decide to disable FWH for this region, we should print
* a debug message about it.
*/
/* Set this as SPI controller. */
- register_spi_master(&spi_master_it85xx, NULL);
+ register_spi_master(&spi_master_it85xx, data);
return 0;
}
diff --git a/it87spi.c b/it87spi.c
index 0760ac864..92c95fa40 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -290,7 +290,7 @@ static int it8716f_spi_chip_write_256(struct flashctx *flash, const uint8_t *buf
return 0;
}
-static struct spi_master spi_master_it87xx = {
+static const struct spi_master spi_master_it87xx = {
.max_data_read = 3,
.max_data_write = MAX_DATA_UNSPECIFIED,
.command = it8716f_spi_send_command,
@@ -419,14 +419,13 @@ static uint16_t it87spi_probe(uint16_t port)
data->flashport = flashport;
data->fast_spi = 1;
- spi_master_it87xx.data = data;
register_shutdown(it8716f_shutdown, data);
if (internal_buses_supported & BUS_SPI)
msg_pdbg("Overriding chipset SPI with IT87 SPI.\n");
/* FIXME: Add the SPI bus or replace the other buses with it? */
- register_spi_master(&spi_master_it87xx, NULL);
+ register_spi_master(&spi_master_it87xx, data);
return 0;
}
diff --git a/jlink_spi.c b/jlink_spi.c
index 9fe44a500..6342e7fca 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -155,7 +155,7 @@ static int jlink_spi_send_command(const struct flashctx *flash, unsigned int wri
return 0;
}
-static struct spi_master spi_master_jlink_spi = {
+static const struct spi_master spi_master_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). */
@@ -464,7 +464,6 @@ int jlink_spi_init(void)
jlink_data->ctx = jaylink_ctx;
jlink_data->devh = jaylink_devh;
jlink_data->reset_cs = reset_cs;
- spi_master_jlink_spi.data = jlink_data;
/* Ensure that the CS signal is not active initially. */
if (!deassert_cs(jlink_data))
@@ -472,7 +471,7 @@ int jlink_spi_init(void)
if (register_shutdown(jlink_spi_shutdown, jlink_data))
goto init_err;
- register_spi_master(&spi_master_jlink_spi, NULL);
+ register_spi_master(&spi_master_jlink_spi, jlink_data);
return 0;
diff --git a/linux_spi.c b/linux_spi.c
index 82741bf60..7d866f477 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -113,7 +113,7 @@ static int linux_spi_send_command(const struct flashctx *flash, unsigned int wri
return 0;
}
-static struct spi_master spi_master_linux = {
+static const struct spi_master spi_master_linux = {
.features = SPI_MASTER_4BA,
.max_data_read = MAX_DATA_UNSPECIFIED, /* TODO? */
.max_data_write = MAX_DATA_UNSPECIFIED, /* TODO? */
@@ -238,13 +238,12 @@ int linux_spi_init(void)
}
spi_data->fd = fd;
spi_data->max_kernel_buf_size = max_kernel_buf_size;
- spi_master_linux.data = spi_data;
if (register_shutdown(linux_spi_shutdown, spi_data)) {
free(spi_data);
goto init_err;
}
- register_spi_master(&spi_master_linux, NULL);
+ register_spi_master(&spi_master_linux, spi_data);
return 0;
init_err:
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 6b8dfe661..7f5e3efda 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -408,7 +408,7 @@ static int lspcon_i2c_spi_write_aai(struct flashctx *flash, const uint8_t *buf,
return SPI_GENERIC_ERROR;
}
-static struct spi_master spi_master_i2c_lspcon = {
+static const struct spi_master spi_master_i2c_lspcon = {
.max_data_read = 16,
.max_data_write = 12,
.command = lspcon_i2c_spi_send_command,
@@ -454,10 +454,9 @@ int lspcon_i2c_spi_init(void)
}
data->fd = fd;
- spi_master_i2c_lspcon.data = data;
ret |= register_shutdown(lspcon_i2c_spi_shutdown, data);
- ret |= register_spi_master(&spi_master_i2c_lspcon, NULL);
+ ret |= register_spi_master(&spi_master_i2c_lspcon, data);
return ret;
}
diff --git a/pickit2_spi.c b/pickit2_spi.c
index 47316d05c..9c423b96b 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -340,7 +340,7 @@ static int parse_voltage(char *voltage)
return millivolt;
}
-static struct spi_master spi_master_pickit2 = {
+static const struct spi_master spi_master_pickit2 = {
.max_data_read = 40,
.max_data_write = 40,
.command = pickit2_spi_send_command,
@@ -477,7 +477,6 @@ int pickit2_spi_init(void)
return 1;
}
pickit2_data->pickit2_handle = pickit2_handle;
- spi_master_pickit2.data = pickit2_data;
if (pickit2_get_firmware_version(pickit2_handle))
goto init_err_cleanup_exit;
@@ -501,7 +500,7 @@ int pickit2_spi_init(void)
if (register_shutdown(pickit2_shutdown, pickit2_data))
goto init_err_cleanup_exit;
- register_spi_master(&spi_master_pickit2, NULL);
+ register_spi_master(&spi_master_pickit2, pickit2_data);
return 0;
diff --git a/usbblaster_spi.c b/usbblaster_spi.c
index b652a3d58..115876e88 100644
--- a/usbblaster_spi.c
+++ b/usbblaster_spi.c
@@ -168,7 +168,7 @@ static int usbblaster_shutdown(void *data)
return 0;
}
-static struct spi_master spi_master_usbblaster = {
+static const struct spi_master spi_master_usbblaster = {
.max_data_read = 256,
.max_data_write = 256,
.command = usbblaster_spi_send_command,
@@ -226,13 +226,12 @@ int usbblaster_spi_init(void)
return -1;
}
usbblaster_data->ftdic = ftdic;
- spi_master_usbblaster.data = usbblaster_data;
if (register_shutdown(usbblaster_shutdown, usbblaster_data)) {
free(usbblaster_data);
return -1;
}
- register_spi_master(&spi_master_usbblaster, NULL);
+ register_spi_master(&spi_master_usbblaster, usbblaster_data);
return 0;
}
diff --git a/wbsio_spi.c b/wbsio_spi.c
index 9eed495c8..d17d49dc1 100644
--- a/wbsio_spi.c
+++ b/wbsio_spi.c
@@ -177,7 +177,7 @@ static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf,
return 0;
}
-static struct spi_master spi_master_wbsio = {
+static const struct spi_master spi_master_wbsio = {
.max_data_read = MAX_DATA_UNSPECIFIED,
.max_data_write = MAX_DATA_UNSPECIFIED,
.command = wbsio_spi_send_command,
@@ -215,8 +215,7 @@ int wbsio_check_for_spi(void)
data->spibase = wbsio_spibase;
register_shutdown(wbsio_spi_shutdown, data);
- spi_master_wbsio.data = data;
- register_spi_master(&spi_master_wbsio, NULL);
+ register_spi_master(&spi_master_wbsio, data);
return 0;
}