diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2018-09-18 10:35:27 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-09-28 20:22:35 -0400 |
commit | c924ee25aa0e837bf4ae207e9959babe23a372d6 (patch) | |
tree | 96f4a40580f9118f6e25a962c2c44c11251128bb /include/w1-eeprom.h | |
parent | e1721ba0e68ebe8ef88e375301b53077d66c0448 (diff) | |
download | u-boot-c924ee25aa0e837bf4ae207e9959babe23a372d6.tar.gz |
W1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs
We might want to access data stored onto one wire EEPROMs.
Create a framework to provide a consistent API.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: reworked patch]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Diffstat (limited to 'include/w1-eeprom.h')
-rw-r--r-- | include/w1-eeprom.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/w1-eeprom.h b/include/w1-eeprom.h new file mode 100644 index 0000000000..22337368b4 --- /dev/null +++ b/include/w1-eeprom.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ + * + * Copyright (c) 2015 Free Electrons + * Copyright (c) 2015 NextThing Co + * Copyright (c) 2018 Microchip Technology, Inc. + * + */ + +#ifndef __W1_EEPROM_H +#define __W1_EEPROM_H + +struct udevice; + +struct w1_eeprom_ops { + /* + * Reads a buff from the given EEPROM memory, starting at + * given offset and place the results into the given buffer. + * Should read given count of bytes. + * Should return 0 on success, and normal error.h on error + */ + int (*read_buf)(struct udevice *dev, unsigned int offset, + u8 *buf, unsigned int count); +}; + +int w1_eeprom_read_buf(struct udevice *dev, unsigned int offset, + u8 *buf, unsigned int count); + +int w1_eeprom_dm_init(void); + +int w1_eeprom_register_new_device(u64 id); + +int w1_eeprom_get_id(struct udevice *dev, u64 *id); +#endif |