diff options
author | Moritz Fischer <moritz.fischer@ettus.com> | 2016-09-13 14:44:48 -0700 |
---|---|---|
committer | sjg <sjg@chromium.org> | 2016-10-09 09:30:32 -0600 |
commit | 281ca88fab7f6b66a18d494c05a1f1fa39f11075 (patch) | |
tree | f2bcb612177f783acb6019a684cde379aa8397e0 /drivers/misc | |
parent | 2880e6b5e231690bbc64816d696322b06d41b2ee (diff) | |
download | u-boot-281ca88fab7f6b66a18d494c05a1f1fa39f11075.zip u-boot-281ca88fab7f6b66a18d494c05a1f1fa39f11075.tar.gz u-boot-281ca88fab7f6b66a18d494c05a1f1fa39f11075.tar.bz2 |
cros_ec: Add function to read back flash parameters
Add support for reading back flash parameters as reported by
the ec.
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cros_ec.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 5225cdb..bb6e8fe 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -790,6 +790,27 @@ static int cros_ec_data_is_erased(const uint32_t *data, int size) return 1; } +/** + * Read back flash parameters + * + * This function reads back parameters of the flash as reported by the EC + * + * @param dev Pointer to device + * @param info Pointer to output flash info struct + */ +int cros_ec_read_flashinfo(struct cros_ec_dev *dev, + struct ec_response_flash_info *info) +{ + int ret; + + ret = ec_command(dev, EC_CMD_FLASH_INFO, 0, + NULL, 0, info, sizeof(*info)); + if (ret < 0) + return ret; + + return ret < sizeof(*info) ? -1 : 0; +} + int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data, uint32_t offset, uint32_t size) { |