MIPS: convert CONFIG_SYS_MIPS_TIMER_FREQ to Kconfig
[platform/kernel/u-boot.git] / include / w1.h
index 399177a..b18078b 100644 (file)
@@ -8,12 +8,30 @@
 #ifndef __W1_H
 #define __W1_H
 
-#include <dm.h>
+struct udevice;
 
 #define W1_FAMILY_DS24B33      0x23
 #define W1_FAMILY_DS2431       0x2d
+#define W1_FAMILY_DS2502       0x09
 #define W1_FAMILY_EEP_SANDBOX  0xfe
 
+struct w1_driver_entry {
+       struct driver   *driver;
+       u8              *family;
+};
+
+/* U_BOOT_W1_DEVICE() tells U-Boot to create a one-wire device.
+ *
+ * @__name: Device name (C identifier, not a string. E.g. gpio7_at_ff7e0000)
+ * @__driver: Driver name (C identifier, not a string. E.g. gpio7_at_ff7e0000)
+ * @__family: Family code number of the one-wire
+ */
+#define U_BOOT_W1_DEVICE(__name, __family)                             \
+       ll_entry_declare(struct w1_driver_entry, __name, w1_driver_entry) = { \
+               .driver = llsym(struct driver, __name, driver),         \
+               .family = __family,                                     \
+       }
+
 struct w1_device {
        u64     id;
 };