1 /* SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2015 Free Electrons
4 * Copyright (c) 2015 NextThing Co
13 #define W1_FAMILY_DS24B33 0x23
14 #define W1_FAMILY_DS2431 0x2d
15 #define W1_FAMILY_DS2502 0x09
16 #define W1_FAMILY_EEP_SANDBOX 0xfe
18 struct w1_driver_entry {
19 struct driver *driver;
23 /* U_BOOT_W1_DEVICE() tells U-Boot to create a one-wire device.
25 * @__name: Device name (C identifier, not a string. E.g. gpio7_at_ff7e0000)
26 * @__driver: Driver name (C identifier, not a string. E.g. gpio7_at_ff7e0000)
27 * @__family: Family code number of the one-wire
29 #define U_BOOT_W1_DEVICE(__name, __family) \
30 ll_entry_declare(struct w1_driver_entry, __name, w1_driver_entry) = { \
31 .driver = llsym(struct driver, __name, driver), \
40 u8 (*read_byte)(struct udevice *dev);
41 bool (*reset)(struct udevice *dev);
42 u8 (*triplet)(struct udevice *dev, bool bdir);
43 void (*write_byte)(struct udevice *dev, u8 byte);
46 int w1_get_bus(int busnum, struct udevice **busp);
47 u8 w1_get_device_family(struct udevice *dev);
49 int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
50 int w1_read_byte(struct udevice *dev);
51 int w1_reset_select(struct udevice *dev);
52 int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
53 int w1_write_byte(struct udevice *dev, u8 byte);