diff options
author | Robert Beckett <bob.beckett@collabora.com> | 2019-10-28 18:29:06 +0000 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2019-12-17 06:58:19 +0100 |
commit | 033e18b47bd020610f84ca88c5ce3b88215d563a (patch) | |
tree | 97a49bbeaec32a4ee2fedef9d98da6c3d7e978a4 /include/i2c_eeprom.h | |
parent | 1a59cb426d50082821df941146a9ec20decd118f (diff) | |
download | u-boot-033e18b47bd020610f84ca88c5ce3b88215d563a.tar.gz u-boot-033e18b47bd020610f84ca88c5ce3b88215d563a.tar.bz2 u-boot-033e18b47bd020610f84ca88c5ce3b88215d563a.zip |
misc: i2c_eeprom: add size query
Add ability to query size of eeprom device and partitions
Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include/i2c_eeprom.h')
-rw-r--r-- | include/i2c_eeprom.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/i2c_eeprom.h b/include/i2c_eeprom.h index 0fcdf3831b..b96254ae79 100644 --- a/include/i2c_eeprom.h +++ b/include/i2c_eeprom.h @@ -10,6 +10,7 @@ struct i2c_eeprom_ops { int (*read)(struct udevice *dev, int offset, uint8_t *buf, int size); int (*write)(struct udevice *dev, int offset, const uint8_t *buf, int size); + int (*size)(struct udevice *dev); }; struct i2c_eeprom { @@ -17,6 +18,8 @@ struct i2c_eeprom { unsigned long pagesize; /* The EEPROM's page width in bits (pagesize = 2^pagewidth) */ unsigned pagewidth; + /* The EEPROM's capacity in bytes */ + unsigned long size; }; /* @@ -43,4 +46,13 @@ int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, int size); */ int i2c_eeprom_write(struct udevice *dev, int offset, uint8_t *buf, int size); +/* + * i2c_eeprom_size() - get size of I2C EEPROM chip + * + * @dev: Chip to query + * + * @return +ve size in bytes on success, -ve on failure + */ +int i2c_eeprom_size(struct udevice *dev); + #endif |