mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
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. Background: The RTD devices has an interesting implementation where the flag we need to flash is `aa aa aa ff ff`. However, after reset, the boot firmware of RTD device will overwrite this flag value to `aa aa aa ff aa`. Given this evidence, the root cause would be that the boot firmware is doing something with protection enable by itself. This explains why the message 'Block protection cannot be disabled' is shown since the block protection is called before write operation. BUG=b:147402710,b:152558985,b:178766553 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/49785 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
32aa933b1d
commit
6cad608483
@ -375,10 +375,6 @@ static int realtek_mst_i2c_spi_write_256(struct flashctx *flash, const uint8_t *
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return SPI_GENERIC_ERROR;
|
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, 0x6D, 0x02); /* write opcode */
|
||||||
ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, (PAGE_SIZE - 1)); /* fit len=256 */
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, false);
|
|
||||||
|
|
||||||
return ret;
|
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 *realtek_mst_data =
|
||||||
(struct realtek_mst_i2c_spi_data *)data;
|
(struct realtek_mst_i2c_spi_data *)data;
|
||||||
int fd = realtek_mst_data->fd;
|
int fd = realtek_mst_data->fd;
|
||||||
|
ret |= realtek_mst_i2c_spi_toggle_gpio_88_strap(fd, false);
|
||||||
if (realtek_mst_data->reset) {
|
if (realtek_mst_data->reset) {
|
||||||
/*
|
/*
|
||||||
* Return value for reset mpu is not checked since
|
* Return value for reset mpu is not checked since
|
||||||
@ -532,6 +527,12 @@ int realtek_mst_i2c_spi_init(void)
|
|||||||
return ret;
|
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));
|
struct realtek_mst_i2c_spi_data *data = calloc(1, sizeof(struct realtek_mst_i2c_spi_data));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
msg_perr("Unable to allocate space for extra SPI master data.\n");
|
msg_perr("Unable to allocate space for extra SPI master data.\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user