mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
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>
This commit is contained in:
parent
1a59cb426d
commit
033e18b47b
2 changed files with 138 additions and 19 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue