diff options
| author | Kory Maincent <[email protected]> | 2021-05-04 19:31:26 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2021-05-13 13:09:09 -0400 |
| commit | c9dffc971957e5fd18d64aa17a95e8d82a59d273 (patch) | |
| tree | 287136ba55d66eeca44f3d7996ccc5544b8a0b30 /include | |
| parent | 0705e25cd05a9772d1ae8de8debd3b424b03b59d (diff) | |
w1: replace dt detection by automatic detection
This patch changes the functioning of the detection of w1 devices.
The old way was a comparison between detected w1 and the ones described in
the device tree. Now it will just look for the driver matching the family
id of the w1 detected.
The patch is inspired from Maxime Ripard code.
Signed-off-by: Kory Maincent <[email protected]>
Reviewed-by: Maxime Ripard <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/w1-eeprom.h | 2 | ||||
| -rw-r--r-- | include/w1.h | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/include/w1-eeprom.h b/include/w1-eeprom.h index 22337368b4b..b3cf77a81ef 100644 --- a/include/w1-eeprom.h +++ b/include/w1-eeprom.h @@ -27,7 +27,5 @@ int w1_eeprom_read_buf(struct udevice *dev, unsigned int offset, int w1_eeprom_dm_init(void); -int w1_eeprom_register_new_device(u64 id); - int w1_eeprom_get_id(struct udevice *dev, u64 *id); #endif diff --git a/include/w1.h b/include/w1.h index 77f439e587f..b18078ba152 100644 --- a/include/w1.h +++ b/include/w1.h @@ -15,6 +15,23 @@ struct udevice; #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; }; |
