blob: 77f439e587f76e1e13e35311c91b7b508d5d141e [file] [log] [blame]
Maxime Ripardd3e19cf2018-09-18 10:35:24 +03001/* 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
Simon Glass411e9eb2020-07-19 10:15:42 -060011struct udevice;
Maxime Ripardd3e19cf2018-09-18 10:35:24 +030012
13#define W1_FAMILY_DS24B33 0x23
14#define W1_FAMILY_DS2431 0x2d
Martin Fuzzeyf9c87ad2018-10-24 10:21:19 +020015#define W1_FAMILY_DS2502 0x09
Eugen Hristev84e55bd2018-09-18 10:35:31 +030016#define W1_FAMILY_EEP_SANDBOX 0xfe
Maxime Ripardd3e19cf2018-09-18 10:35:24 +030017
18struct w1_device {
19 u64 id;
20};
21
22struct w1_ops {
23 u8 (*read_byte)(struct udevice *dev);
24 bool (*reset)(struct udevice *dev);
25 u8 (*triplet)(struct udevice *dev, bool bdir);
26 void (*write_byte)(struct udevice *dev, u8 byte);
27};
28
29int w1_get_bus(int busnum, struct udevice **busp);
30u8 w1_get_device_family(struct udevice *dev);
31
32int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
33int w1_read_byte(struct udevice *dev);
34int w1_reset_select(struct udevice *dev);
35int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
36int w1_write_byte(struct udevice *dev, u8 byte);
37
38#endif