Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/41158 )
Change subject: realtek_mst_i2c_spi.c: Show MCU running fw version ......................................................................
realtek_mst_i2c_spi.c: Show MCU running fw version
NOT-FOR-MERGE yet.
Change-Id: I85eafd95833f7a280c46947e280f967489d1b8d1 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M realtek_mst_i2c_spi.c 1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/58/41158/1
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c index 5c1b901..68ee1a7 100644 --- a/realtek_mst_i2c_spi.c +++ b/realtek_mst_i2c_spi.c @@ -146,6 +146,28 @@ return ret; }
+static int realtek_mst_i2c_spi_version(int fd) +{ + int ret = 0; + + uint8_t command[] = { 0x70, 0x04 }; + ret = realtek_mst_i2c_spi_write_data(fd, REGISTER_ADDRESS, command, 2); + uint8_t buf[3]; + ret |= realtek_mst_i2c_spi_read_data(fd, REGISTER_ADDRESS, buf, 3); + printf("(flash): projectID = %d\n", ((buf[1] & 0xC0) >> 6) + (buf[0] << 2)); + printf("(flash): version = %d.%d\n", (buf[1] & 0x3F), buf[2]); + + uint8_t x0, x1, x2; + ret |= realtek_mst_i2c_spi_read_register(fd, 0x03, &x0); + ret |= realtek_mst_i2c_spi_read_register(fd, 0x04, &x1); + ret |= realtek_mst_i2c_spi_read_register(fd, 0x07, &x2); + + printf("(reg): projectID = %d\n", ((x1 & 0xC0) >> 6) + (x0 << 2)); + printf("(reg): version = %d.%d\n", (x1 & 0x3F), x2); + + return ret; +} + static int realtek_mst_i2c_spi_toggle_protection(int fd, int enable) { int ret = 0; @@ -461,6 +483,10 @@ if (ret) return ret;
+ ret |= realtek_mst_i2c_spi_version(fd); + if (ret) + 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");
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/41158 )
Change subject: realtek_mst_i2c_spi.c: Show MCU running fw version ......................................................................
Patch Set 1: Code-Review-2