Shiyu Sun has uploaded this change for review.

View Change

realtek_mst_i2c_spi.c: Move gpio 88 toggle outside write function

Gpio 88 toggle is used as write protection disable/enable now
and we need that to happen at the initialization of programmer.

BUG=b:147402710,b:152558985
BRANCH=none
TEST=flashrom -p realtek_mst_i2c_spi:bus=x,reset-mcu=1,enter-isp=1 -w
image.bin

Signed-off-by: Shiyu Sun <sshiyu@chromium.org>
Change-Id: I237bf9f8aa0fcbb904e7f0c09c74fd179e8c70c1
---
M realtek_mst_i2c_spi.c
1 file changed, 7 insertions(+), 6 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/85/49785/1
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 3dd1b36..e9d6a58 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -375,10 +375,6 @@
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 @@
break;
}

- ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, false);
-
return ret;
}

@@ -432,6 +426,7 @@
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) {
ret |= realtek_mst_i2c_spi_reset_mpu(fd);
if (ret != 0)
@@ -528,6 +523,12 @@
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");

To view, visit change 49785. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I237bf9f8aa0fcbb904e7f0c09c74fd179e8c70c1
Gerrit-Change-Number: 49785
Gerrit-PatchSet: 1
Gerrit-Owner: Shiyu Sun <sshiyu@google.com>
Gerrit-MessageType: newchange