From 9734af669768203349485bd76a4ad3c79c8bdc73 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Wed, 1 Nov 2017 13:15:33 +0100 Subject: device/i2c_bus: Add i2c_dev_read_at16() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i2c_dev_read_at16() sends a 16-bit offset to the I2C chip (for larger EEPROM parts), then reads bytes up to a given length into a buffer. Change-Id: I7516f3e5d9aca362c2b340aa5627d91510c09412 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/29478 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/include/device/i2c_bus.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/include') diff --git a/src/include/device/i2c_bus.h b/src/include/device/i2c_bus.h index 6aa4f9ba9d..5302d20228 100644 --- a/src/include/device/i2c_bus.h +++ b/src/include/device/i2c_bus.h @@ -89,4 +89,12 @@ int i2c_dev_readb_at(struct device *, uint8_t off); */ int i2c_dev_writeb_at(struct device *, uint8_t off, uint8_t val); +/* + * Sends the 16-bit register offset `off` and reads `len` bytes into `buf`. + * + * Returns the number of bytes read on success, negative `enum cb_err` + * value on error. + */ +int i2c_dev_read_at16(struct device *, uint8_t *buf, size_t len, uint16_t off); + #endif /* _DEVICE_I2C_BUS_H_ */ -- cgit v1.2.3