diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-17 00:52:25 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-01-31 00:25:41 +0300 |
commit | 7791df576c4e0bcb0529850e14173d028ec37275 (patch) | |
tree | 93b1185fd5fb60bc540d9b93d0478cf072978ac1 /drivers | |
parent | 698e30f7a862ae6eb4754ef0d42b8dc8cf416edd (diff) | |
download | u-boot-7791df576c4e0bcb0529850e14173d028ec37275.tar.xz |
cros_ec: Add support for reading the SKU ID
This allows reading strapping pins attached to the EC. Add an
implementation for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/cros_ec.c | 13 | ||||
-rw-r--r-- | drivers/misc/cros_ec_sandbox.c | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index e51ac87409..80709be2f1 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1105,6 +1105,19 @@ int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image, return 0; } +int cros_ec_get_sku_id(struct udevice *dev) +{ + struct ec_sku_id_info *r; + int ret; + + ret = ec_command_inptr(dev, EC_CMD_GET_SKU_ID, 0, NULL, 0, + (uint8_t **)&r, sizeof(*r)); + if (ret != sizeof(*r)) + return -ret; + + return r->sku_id; +} + int cros_ec_read_nvdata(struct udevice *dev, uint8_t *block, int size) { struct ec_params_vbnvcontext p; diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index 1922a9c1b9..9324384704 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -473,6 +473,13 @@ static int process_cmd(struct ec_state *ec, len = sizeof(*resp); break; } + case EC_CMD_GET_SKU_ID: { + struct ec_sku_id_info *resp = resp_data; + + resp->sku_id = 1234; + len = sizeof(*resp); + break; + } default: printf(" ** Unknown EC command %#02x\n", req_hdr->command); return -1; |