1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

w1: Add 1-Wire uclass

We might want to use 1-Wire devices connected on boards such as EEPROMs in
U-Boot.

Provide a framework to be able to do that.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: reworked]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
This commit is contained in:
Maxime Ripard
2018-09-18 10:35:24 +03:00
committed by Tom Rini
parent 620300043c
commit d3e19cf919
7 changed files with 295 additions and 0 deletions

36
include/w1.h Normal file
View File

@@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-2.0+
*
* Copyright (c) 2015 Free Electrons
* Copyright (c) 2015 NextThing Co
*
*/
#ifndef __W1_H
#define __W1_H
#include <dm.h>
#define W1_FAMILY_DS24B33 0x23
#define W1_FAMILY_DS2431 0x2d
struct w1_device {
u64 id;
};
struct w1_ops {
u8 (*read_byte)(struct udevice *dev);
bool (*reset)(struct udevice *dev);
u8 (*triplet)(struct udevice *dev, bool bdir);
void (*write_byte)(struct udevice *dev, u8 byte);
};
int w1_get_bus(int busnum, struct udevice **busp);
u8 w1_get_device_family(struct udevice *dev);
int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
int w1_read_byte(struct udevice *dev);
int w1_reset_select(struct udevice *dev);
int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
int w1_write_byte(struct udevice *dev, u8 byte);
#endif