diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c index 1bbb71f42..ae79fdd3b 100644 --- a/realtek_mst_i2c_spi.c +++ b/realtek_mst_i2c_spi.c @@ -375,10 +375,6 @@ static int realtek_mst_i2c_spi_write_256(struct flashctx *flash, const uint8_t * if (fd < 0) return SPI_GENERIC_ERROR; - ret = realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, true); - if (ret) - return ret; - ret |= realtek_mst_i2c_spi_write_register(fd, 0x6D, 0x02); /* write opcode */ ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, (PAGE_SIZE - 1)); /* fit len=256 */ @@ -404,8 +400,6 @@ static int realtek_mst_i2c_spi_write_256(struct flashctx *flash, const uint8_t * break; } - ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, false); - return ret; } @@ -432,6 +426,7 @@ static int realtek_mst_i2c_spi_shutdown(void *data) struct realtek_mst_i2c_spi_data *realtek_mst_data = (struct realtek_mst_i2c_spi_data *)data; int fd = realtek_mst_data->fd; + ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, false); if (realtek_mst_data->reset) { /* * Return value for reset mpu is not checked since @@ -532,6 +527,12 @@ int realtek_mst_i2c_spi_init(void) return ret; } + ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, true); + if (ret) { + msg_perr("Unable to toggle gpio 88 strap to True.\n"); + return ret; + } + struct realtek_mst_i2c_spi_data *data = calloc(1, sizeof(struct realtek_mst_i2c_spi_data)); if (!data) { msg_perr("Unable to allocate space for extra SPI master data.\n");