diff options
author | Tom Rini <trini@konsulko.com> | 2020-11-15 10:13:22 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-11-15 10:13:22 -0500 |
commit | cd0d3749afdad4f4fd03bc005fe5efaad0e09417 (patch) | |
tree | 2b36d72786e953e1c59e332aeeda08a00acbc5ca /drivers/misc | |
parent | de865f7ee1d9b6dff6e265dee44509c8274ea606 (diff) | |
parent | a3e458524c15710e4ac9ce1556a5f0898084d09a (diff) |
Merge tag 'dm-pull-15nov20' of git://git.denx.de/u-boot-dm
Minor fixes/improvements to 'patman status'
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cros_ec.c | 16 | ||||
-rw-r--r-- | drivers/misc/cros_ec_lpc.c | 5 | ||||
-rw-r--r-- | drivers/misc/cros_ec_sandbox.c | 10 |
3 files changed, 24 insertions, 7 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index c3674908ee8..1b22f1883ee 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -495,18 +495,18 @@ int cros_ec_read_current_image(struct udevice *dev, } static int cros_ec_wait_on_hash_done(struct udevice *dev, + struct ec_params_vboot_hash *p, struct ec_response_vboot_hash *hash) { - struct ec_params_vboot_hash p; ulong start; start = get_timer(0); while (hash->status == EC_VBOOT_HASH_STATUS_BUSY) { mdelay(50); /* Insert some reasonable delay */ - p.cmd = EC_VBOOT_HASH_GET; - if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, &p, sizeof(p), - hash, sizeof(*hash)) < 0) + p->cmd = EC_VBOOT_HASH_GET; + if (ec_command(dev, EC_CMD_VBOOT_HASH, 0, p, sizeof(*p), hash, + sizeof(*hash)) < 0) return -1; if (get_timer(start) > CROS_EC_CMD_HASH_TIMEOUT_MS) { @@ -530,7 +530,7 @@ int cros_ec_read_hash(struct udevice *dev, uint hash_offset, return -1; /* If the EC is busy calculating the hash, fidget until it's done. */ - rv = cros_ec_wait_on_hash_done(dev, hash); + rv = cros_ec_wait_on_hash_done(dev, &p, hash); if (rv) return rv; @@ -553,9 +553,13 @@ int cros_ec_read_hash(struct udevice *dev, uint hash_offset, hash, sizeof(*hash)) < 0) return -1; - rv = cros_ec_wait_on_hash_done(dev, hash); + rv = cros_ec_wait_on_hash_done(dev, &p, hash); if (rv) return rv; + if (hash->status != EC_VBOOT_HASH_STATUS_DONE) { + log_err("Hash did not complete, status=%d\n", hash->status); + return -EIO; + } debug("%s: hash done\n", __func__); diff --git a/drivers/misc/cros_ec_lpc.c b/drivers/misc/cros_ec_lpc.c index 63702f90fbc..e0002b9753f 100644 --- a/drivers/misc/cros_ec_lpc.c +++ b/drivers/misc/cros_ec_lpc.c @@ -25,13 +25,16 @@ #define debug_trace(fmt, b...) #endif +/* Timeout waiting for a flash erase command to complete */ +static const int CROS_EC_CMD_TIMEOUT_MS = 5000; + static int wait_for_sync(struct cros_ec_dev *dev) { unsigned long start; start = get_timer(0); while (inb(EC_LPC_ADDR_HOST_CMD) & EC_LPC_STATUS_BUSY_MASK) { - if (get_timer(start) > 1000) { + if (get_timer(start) > CROS_EC_CMD_TIMEOUT_MS) { debug("%s: Timeout waiting for CROS_EC sync\n", __func__); return -1; diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index a191f061b89..ff7f782742a 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -460,6 +460,16 @@ static int process_cmd(struct ec_state *ec, case EC_CMD_ENTERING_MODE: len = 0; break; + case EC_CMD_GET_NEXT_EVENT: + /* + * TODO: + * This driver emulates an old keyboard device supporting + * EC_CMD_MKBP_STATE. Current Chrome OS keyboards use + * EC_CMD_GET_NEXT_EVENT. Cf. + * "mkbp: Add support for buttons and switches" + * https://chromium.googlesource.com/chromiumos/platform/ec/+/87a071941b89e3f7fd3eb329b682e60b3fbd6c73 + */ + return -EC_RES_INVALID_COMMAND; default: printf(" ** Unknown EC command %#02x\n", req_hdr->command); return -1; |