]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - include/i2c_eeprom.h
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
,
13 int (*size
)(struct udevice
*dev
);
17 /* The EEPROM's page size in byte */
18 unsigned long pagesize
;
19 /* The EEPROM's capacity in bytes */
24 * i2c_eeprom_read() - read bytes from an I2C EEPROM chip
26 * @dev: Chip to read from
27 * @offset: Offset within chip to start reading
28 * @buf: Place to put data
29 * @size: Number of bytes to read
31 * @return 0 on success, -ve on failure
33 int i2c_eeprom_read(struct udevice
*dev
, int offset
, uint8_t *buf
, int size
);
36 * i2c_eeprom_write() - write bytes to an I2C EEPROM chip
38 * @dev: Chip to write to
39 * @offset: Offset within chip to start writing
40 * @buf: Buffer containing data to write
41 * @size: Number of bytes to write
43 * @return 0 on success, -ve on failure
45 int i2c_eeprom_write(struct udevice
*dev
, int offset
, uint8_t *buf
, int size
);
48 * i2c_eeprom_size() - get size of I2C EEPROM chip
52 * @return +ve size in bytes on success, -ve on failure
54 int i2c_eeprom_size(struct udevice
*dev
);