diff options
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/chromeec/crosec_proto.c | 2 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec.c | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/ec/google/chromeec/crosec_proto.c b/src/ec/google/chromeec/crosec_proto.c index 55a707db17..1183e827f1 100644 --- a/src/ec/google/chromeec/crosec_proto.c +++ b/src/ec/google/chromeec/crosec_proto.c @@ -235,7 +235,7 @@ static int send_command_proto3(struct chromeec_command *cec_command, rv = crosec_io(out_bytes, in_bytes, context); if (rv != 0) { - printk(BIOS_ERR, "%s: failed to complete I/O: Err = %#x.", + printk(BIOS_ERR, "%s: failed to complete I/O: Err = %#x.\n", __func__, rv >= 0 ? rv : -rv); return -EC_RES_ERROR; } diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 83c22d3a35..bda88e462f 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -232,11 +232,12 @@ int google_chromeec_vbnv_context(int is_read, uint8_t *data, int len) struct chromeec_command cec_cmd; struct ec_params_vbnvcontext cmd_vbnvcontext; struct ec_response_vbnvcontext rsp_vbnvcontext; + int retries = 3; if (len != EC_VBNV_BLOCK_SIZE) return -1; - + retry: cec_cmd.cmd_code = EC_CMD_VBNV_CONTEXT; cec_cmd.cmd_version = EC_VER_VBNV_CONTEXT; cec_cmd.cmd_data_in = &cmd_vbnvcontext; @@ -251,7 +252,13 @@ int google_chromeec_vbnv_context(int is_read, uint8_t *data, int len) if (!is_read) memcpy(&cmd_vbnvcontext.block, data, EC_VBNV_BLOCK_SIZE); - google_chromeec_command(&cec_cmd); + if (google_chromeec_command(&cec_cmd)) { + printk(BIOS_ERR, "ERROR: failed to %s vbnv_ec context: %d\n", + is_read ? "read" : "write", (int)cec_cmd.cmd_code); + mdelay(10); /* just in case */ + if (--retries) + goto retry; + } if (is_read) memcpy(data, &rsp_vbnvcontext.block, EC_VBNV_BLOCK_SIZE); |