blob: 399177a12e34b5c651f0373905d35d950c3763ff [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
Eugen Hristev30369482018-09-18 10:35:31 +030015#define W1_FAMILY_EEP_SANDBOX 0xfe
Maxime Ripardbdbdca32018-09-18 10:35:24 +030016
17struct w1_device {
18 u64 id;
19};
20
21struct 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
28int w1_get_bus(int busnum, struct udevice **busp);
29u8 w1_get_device_family(struct udevice *dev);
30
31int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
32int w1_read_byte(struct udevice *dev);
33int w1_reset_select(struct udevice *dev);
34int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
35int w1_write_byte(struct udevice *dev, u8 byte);
36
37#endif