Shiyu Sun has uploaded this change for review.

View Change

lspcon_i2c_spi.c: Add debug message that shows the active block.

This is all for debug propose to verify A/B update work as
expected.

BUG=b:148746232
BRANCH=none
TEST=flashrom -p lspcon_i2c_spi:bus=7 --flash-size -V
verified the related message appears.

Signed-off-by: Shiyu Sun <sshiyu@chromium.org>
Change-Id: I1b3022542f98f114097c6f39254ef4c2cf188c90
---
M lspcon_i2c_spi.c
1 file changed, 25 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/41779/1
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c0..e5e5dc9 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -27,6 +27,7 @@

#define REGISTER_ADDRESS (0x94 >> 1)
#define PAGE_ADDRESS (0x9e >> 1)
+#define ACTIVE_BLOCK_ADDRESS (0x9a >> 1)
#define PAGE_SIZE 256
#define MAX_SPI_WAIT_RETRIES 1000

@@ -472,6 +473,27 @@
return ret;
}

+static void lspcon_i2c_spi_boot_block_info(int fd)
+{
+ uint8_t block_id = 0;
+ int ret = 0;
+ ret |= lspcon_i2c_spi_write_register(fd, 0xbc, 0xc0);
+ ret |= lspcon_i2c_spi_write_register(fd, 0xbc, 0x40);
+ ret |= lspcon_i2c_spi_write_register(fd, 0x8e, 0x00);
+ ret |= lspcon_i2c_spi_write_register(fd, 0x8f, 0x00);
+ struct timespec wait_10ms = { 0, (unsigned)1e7 };
+ nanosleep(&wait_10ms, NULL);
+
+ uint8_t command[] = { 0x0e };
+ ret |= lspcon_i2c_spi_write_data(fd, ACTIVE_BLOCK_ADDRESS, command, 1);
+ ret |= lspcon_i2c_spi_read_data(fd, ACTIVE_BLOCK_ADDRESS, &block_id, 1);
+ if (ret) {
+ msg_pdbg("Failed to get LSPCON boot block information.\n");
+ } else {
+ msg_pdbg("LSPCON is booting from block #%d.\n", block_id);
+ }
+}
+
int lspcon_i2c_spi_init(void)
{
int lspcon_i2c_spi_bus = get_bus();
@@ -489,6 +511,9 @@
return ret;
}

+ /* Show current activate block information for debug propose. */
+ lspcon_i2c_spi_boot_block_info(fd);
+
struct lspcon_i2c_spi_data *data = calloc(1, sizeof(struct lspcon_i2c_spi_data));
if (!data) {
msg_perr("Unable to allocate space for extra SPI master data.\n");

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

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