blob: b36e0f8d5d4c88da4979331905d63f07eaf5f644 [file] [log] [blame]
Maxime Ripardbdbdca32018-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
11#include <dm.h>
12
13#define W1_FAMILY_DS24B33 0x23
14#define W1_FAMILY_DS2431 0x2d
15
16struct w1_device {
17 u64 id;
18};
19
20struct w1_ops {
21 u8 (*read_byte)(struct udevice *dev);
22 bool (*reset)(struct udevice *dev);
23 u8 (*triplet)(struct udevice *dev, bool bdir);
24 void (*write_byte)(struct udevice *dev, u8 byte);
25};
26
27int w1_get_bus(int busnum, struct udevice **busp);
28u8 w1_get_device_family(struct udevice *dev);
29
30int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
31int w1_read_byte(struct udevice *dev);
32int w1_reset_select(struct udevice *dev);
33int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
34int w1_write_byte(struct udevice *dev, u8 byte);
35
36#endif