diff options
author | Kory Maincent <kory.maincent@bootlin.com> | 2021-05-04 19:31:26 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-05-13 13:09:09 -0400 |
commit | c9dffc971957e5fd18d64aa17a95e8d82a59d273 (patch) | |
tree | 287136ba55d66eeca44f3d7996ccc5544b8a0b30 /drivers/w1-eeprom | |
parent | 0705e25cd05a9772d1ae8de8debd3b424b03b59d (diff) | |
download | u-boot-c9dffc971957e5fd18d64aa17a95e8d82a59d273.zip u-boot-c9dffc971957e5fd18d64aa17a95e8d82a59d273.tar.gz u-boot-c9dffc971957e5fd18d64aa17a95e8d82a59d273.tar.bz2 |
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 <kory.maincent@bootlin.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/w1-eeprom')
-rw-r--r-- | drivers/w1-eeprom/ds24xxx.c | 7 | ||||
-rw-r--r-- | drivers/w1-eeprom/ds2502.c | 6 | ||||
-rw-r--r-- | drivers/w1-eeprom/w1-eeprom-uclass.c | 31 |
3 files changed, 13 insertions, 31 deletions
diff --git a/drivers/w1-eeprom/ds24xxx.c b/drivers/w1-eeprom/ds24xxx.c index d12fd57..4be378b 100644 --- a/drivers/w1-eeprom/ds24xxx.c +++ b/drivers/w1-eeprom/ds24xxx.c @@ -53,3 +53,10 @@ U_BOOT_DRIVER(ds24xxx) = { .ops = &ds24xxx_ops, .probe = ds24xxx_probe, }; + +u8 family_supported[] = { + W1_FAMILY_DS24B33, + W1_FAMILY_DS2431, +}; + +U_BOOT_W1_DEVICE(ds24xxx, family_supported); diff --git a/drivers/w1-eeprom/ds2502.c b/drivers/w1-eeprom/ds2502.c index b3d68d7..a67f5ed 100644 --- a/drivers/w1-eeprom/ds2502.c +++ b/drivers/w1-eeprom/ds2502.c @@ -243,3 +243,9 @@ U_BOOT_DRIVER(ds2502) = { .ops = &ds2502_ops, .probe = ds2502_probe, }; + +u8 family_supported[] = { + W1_FAMILY_DS2502, +}; + +U_BOOT_W1_DEVICE(ds2502, family_supported); diff --git a/drivers/w1-eeprom/w1-eeprom-uclass.c b/drivers/w1-eeprom/w1-eeprom-uclass.c index 97a9d43..7a02af3 100644 --- a/drivers/w1-eeprom/w1-eeprom-uclass.c +++ b/drivers/w1-eeprom/w1-eeprom-uclass.c @@ -37,37 +37,6 @@ int w1_eeprom_read_buf(struct udevice *dev, unsigned int offset, return ops->read_buf(dev, offset, buf, count); } -int w1_eeprom_register_new_device(u64 id) -{ - u8 family = id & 0xff; - int ret; - struct udevice *dev; - - for (ret = uclass_first_device(UCLASS_W1_EEPROM, &dev); - !ret && dev; - uclass_next_device(&dev)) { - if (ret || !dev) { - debug("cannot find w1 eeprom dev\n"); - return ret; - } - if (dev_get_driver_data(dev) == family) { - struct w1_device *w1; - - w1 = dev_get_parent_plat(dev); - if (w1->id) /* device already in use */ - continue; - w1->id = id; - debug("%s: Match found: %s:%s %llx\n", __func__, - dev->name, dev->driver->name, id); - return 0; - } - } - - debug("%s: No matches found: error %d\n", __func__, ret); - - return ret; -} - int w1_eeprom_get_id(struct udevice *dev, u64 *id) { struct w1_device *w1 = dev_get_parent_plat(dev); |