xref: /openbmc/u-boot/include/w1-eeprom.h (revision cbd2fba1)
1 /* SPDX-License-Identifier:	GPL-2.0+
2  *
3  * Copyright (c) 2015 Free Electrons
4  * Copyright (c) 2015 NextThing Co
5  * Copyright (c) 2018 Microchip Technology, Inc.
6  *
7  */
8 
9 #ifndef __W1_EEPROM_H
10 #define __W1_EEPROM_H
11 
12 struct udevice;
13 
14 struct w1_eeprom_ops {
15 	/*
16 	 * Reads a buff from the given EEPROM memory, starting at
17 	 * given offset and place the results into the given buffer.
18 	 * Should read given count of bytes.
19 	 * Should return 0 on success, and normal error.h on error
20 	 */
21 	int	(*read_buf)(struct udevice *dev, unsigned int offset,
22 			    u8 *buf, unsigned int count);
23 };
24 
25 int w1_eeprom_read_buf(struct udevice *dev, unsigned int offset,
26 		       u8 *buf, unsigned int count);
27 
28 int w1_eeprom_dm_init(void);
29 
30 int w1_eeprom_register_new_device(u64 id);
31 
32 int w1_eeprom_get_id(struct udevice *dev, u64 *id);
33 #endif
34