diff options
author | Tom Rini <trini@konsulko.com> | 2022-07-11 10:18:13 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-07-11 14:58:57 -0400 |
commit | 36b661dc919da318c163a45f4a220d2e3d9db608 (patch) | |
tree | 268703050f58280feb3287d48eb0cedc974730e1 /include/i2c_eeprom.h | |
parent | e092e3250270a1016c877da7bdd9384f14b1321e (diff) | |
parent | 05a4859637567b13219efd6f1707fb236648b1b7 (diff) |
Merge branch 'next'
Diffstat (limited to 'include/i2c_eeprom.h')
-rw-r--r-- | include/i2c_eeprom.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/i2c_eeprom.h b/include/i2c_eeprom.h index 3ad565684fe..32dcb034973 100644 --- a/include/i2c_eeprom.h +++ b/include/i2c_eeprom.h @@ -6,6 +6,8 @@ #ifndef __I2C_EEPROM #define __I2C_EEPROM +struct udevice; + 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, @@ -20,6 +22,7 @@ struct i2c_eeprom { unsigned long size; }; +#if CONFIG_IS_ENABLED(I2C_EEPROM) /* * i2c_eeprom_read() - read bytes from an I2C EEPROM chip * @@ -42,7 +45,8 @@ int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, int size); * * Return: 0 on success, -ve on failure */ -int i2c_eeprom_write(struct udevice *dev, int offset, uint8_t *buf, int size); +int i2c_eeprom_write(struct udevice *dev, int offset, const uint8_t *buf, + int size); /* * i2c_eeprom_size() - get size of I2C EEPROM chip @@ -53,4 +57,25 @@ int i2c_eeprom_write(struct udevice *dev, int offset, uint8_t *buf, int size); */ int i2c_eeprom_size(struct udevice *dev); +#else /* !I2C_EEPROM */ + +static inline int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, + int size) +{ + return -ENOSYS; +} + +static inline int i2c_eeprom_write(struct udevice *dev, int offset, + const uint8_t *buf, int size) +{ + return -ENOSYS; +} + +static inline int i2c_eeprom_size(struct udevice *dev) +{ + return -ENOSYS; +} + +#endif /* I2C_EEPROM */ + #endif |