i3c: master: Add sysfs option to rescan bus via entdaa
PATCH v5 1/1 i3c: master: Add sysfs option to rescan bus via entdaa
Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.
---
Changes in v5:
- Change sysfs interface to boolean. Comment: Meagan Lloyd
- Change sysfs entry name to do_daa: Comment Megan Lloyd, Frank Li
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Improved the commit message with why.
- Link to v1: https://patch.msgid.link/[email protected]
--- Documentation/ABI/testing/sysfs-bus-i3c | 20 ++++++++++++++++++++ drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +20 -0
@@ -172,3 +172,23 @@ Description: the automatic retries. Exist only when I3C constroller supports this retry on nack feature. +What: /sys/bus/i3c/devices/i3c-<bus-id>/do_daa +KernelVersion: 7.0 +Contact: [email protected] +Description: + Write-only attribute that triggers a Dynamic Address Assignment + (DAA) procedure which discovers new I3C devices on the bus. + Writing a boolean true value (1, y, yes, true, on) to this + attribute causes the master controller to perform DAA, which + includes broadcasting an ENTDAA (Enter Dynamic Address Assignment) + Common Command Code (CCC) on the bus. Writing a false value + returns -EINVAL. + + This is useful for discovering I3C devices that were not present + during initial bus initialization and are unable to issue + Hot-Join. Only devices without a currently assigned dynamic address + will respond to the ENTDAA broadcast and be assigned addresses. + + Note that this mechanism is distinct from Hot-Join, since this is + controller-initiated discovery, while Hot-Join is device-initiated + method to provoke controller discovery procedure.
drivers/i3c/master.c +24 -0
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,static DEVICE_ATTR_RW (dev_nack_retry_count); +static ssize_t do_daa_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +bool val; +int ret; + +if (kstrtobool (buf, &val)) +return -EINVAL ; + +if (!val) +return -EINVAL ; + + ret =i3c_master_do_daa (master); +if (ret) +return ret; + +return count; +} + +static DEVICE_ATTR_WO (do_daa); +static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_mode.attr, &dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_dynamic_address.attr, &dev_attr_hdrcap.attr, &dev_attr_hotjoin.attr, + &dev_attr_do_daa.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev);
---
base-commit: 44982d352c33767cd8d19f8044e7e1161a587ff7
change-id: 20260116-i3c_rescan-4921d0b41a00
Best regards,
Signature · 1 line
David Nyström <[email protected]>
Quoted 7 lines · David Nyström
Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.
Signed-off-by David Nyström <[email protected]>---
Quoted 106 lines
Changes in v5:
- Change sysfs interface to boolean. Comment: Meagan Lloyd
- Change sysfs entry name todo_daa: Comment Megan Lloyd, Frank Li
- Link to v4: https://patch.msgid.link/[email protected]Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]Changes in v2:
- Improved the commit message with why.
- Link to v1: https://patch.msgid.link/[email protected]--- Documentation/ABI/testing/sysfs-bus-i3c | 20 ++++++++++++++++++++ drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+)Documentation/ABI/testing/sysfs-bus-i3c +20
-0@@ -172,3 +172,23 @@ Description: the automatic retries. Exist only when I3C constroller supports this retry on nack feature. +What: /sys/bus/i3c/devices/i3c-<bus-id>/do_daa +KernelVersion: 7.0 +Contact: [email protected] +Description: + Write-only attribute that triggers a Dynamic Address Assignment + (DAA) procedure which discovers new I3C devices on the bus. + Writing a boolean true value (1, y, yes, true, on) to this + attribute causes the master controller to perform DAA, which + includes broadcasting an ENTDAA (Enter Dynamic Address Assignment) + Common Command Code (CCC) on the bus. Writing a false value + returns -EINVAL. + + This is useful for discovering I3C devices that were not present + during initial bus initialization and are unable to issue + Hot-Join. Only devices without a currently assigned dynamic address + will respond to the ENTDAA broadcast and be assigned addresses. + + Note that this mechanism is distinct from Hot-Join, since this is + controller-initiated discovery, while Hot-Join is device-initiated + method to provoke controller discovery procedure.drivers/i3c/master.c +24
-1@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,static DEVICE_ATTR_RW (dev_nack_retry_count); +static ssize_t do_daa_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +bool val; +int ret; + +if (kstrtobool (buf, &val)) +return -EINVAL ; + +if (!val) +return -EINVAL ; + + ret =i3c_master_do_daa (master); +if (ret) +return ret; + +return count; +} + +static DEVICE_ATTR_WO (do_daa); +static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_mode.attr, &dev_attr_current_master.attr,@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_dynamic_address.attr, &dev_attr_hdrcap.attr, &dev_attr_hotjoin.attr, + &dev_attr_do_daa.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev); ---base-commit:
44982d352c33767cd8d19f8044e7e1161a587ff7
change-id: 20260116-i3c_rescan-4921d0b41a00Best regards,
--
David Nyström <[email protected]>--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c