xref: /openbmc/u-boot/include/w1.h (revision 2909abd0)
1 /* SPDX-License-Identifier:	GPL-2.0+
2  *
3  * Copyright (c) 2015 Free Electrons
4  * Copyright (c) 2015 NextThing Co
5  *
6  */
7 
8 #ifndef __W1_H
9 #define __W1_H
10 
11 #include <dm.h>
12 
13 #define W1_FAMILY_DS24B33	0x23
14 #define W1_FAMILY_DS2431	0x2d
15 #define W1_FAMILY_EEP_SANDBOX	0xfe
16 
17 struct w1_device {
18 	u64	id;
19 };
20 
21 struct w1_ops {
22 	u8	(*read_byte)(struct udevice *dev);
23 	bool	(*reset)(struct udevice *dev);
24 	u8	(*triplet)(struct udevice *dev, bool bdir);
25 	void	(*write_byte)(struct udevice *dev, u8 byte);
26 };
27 
28 int w1_get_bus(int busnum, struct udevice **busp);
29 u8 w1_get_device_family(struct udevice *dev);
30 
31 int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
32 int w1_read_byte(struct udevice *dev);
33 int w1_reset_select(struct udevice *dev);
34 int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
35 int w1_write_byte(struct udevice *dev, u8 byte);
36 
37 #endif
38