1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2014 Google, Inc
9 struct i2c_eeprom_ops {
10 int (*read)(struct udevice *dev, int offset, uint8_t *buf, int size);
11 int (*write)(struct udevice *dev, int offset, const uint8_t *buf,
16 /* The EEPROM's page size in byte */
17 unsigned long pagesize;
18 /* The EEPROM's page width in bits (pagesize = 2^pagewidth) */
23 * i2c_eeprom_read() - read bytes from an I2C EEPROM chip
25 * @dev: Chip to read from
26 * @offset: Offset within chip to start reading
27 * @buf: Place to put data
28 * @size: Number of bytes to read
30 * @return 0 on success, -ve on failure
32 int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, int size);
35 * i2c_eeprom_write() - write bytes to an I2C EEPROM chip
37 * @dev: Chip to write to
38 * @offset: Offset within chip to start writing
39 * @buf: Buffer containing data to write
40 * @size: Number of bytes to write
42 * @return 0 on success, -ve on failure
44 int i2c_eeprom_write(struct udevice *dev, int offset, uint8_t *buf, int size);