i3c: master: Add sysfs option to rescan bus.
PATCH v2 1/1 i3c: master: Add sysfs option to rescan bus.
Add the ability to rescan the i3c bus from userspace, i.e. provoke a DDA. The usecase could be f.ex. an i3cdev userspace driver for a device with broken hotjoin support. If the i3c device boots slowly, it might be miss the DDA during boot.
---
Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]
--- drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
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 rescan_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +unsigned long val; +int ret; + + ret =kstrtoul (buf,0 , &val); +if (ret) +return ret; + +if (val) { + ret =i3c_master_do_daa (master); +if (ret) +return ret; + } + +return count; +} + +static DEVICE_ATTR_WO (rescan); +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_rescan.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev);
---
base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00
Best regards,
Signature · 1 line
David Nyström <[email protected]>
Quoted 5 lines · David Nyström
Add the ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
The usecase could be f.ex. an i3cdev userspace driver for a device with broken hotjoin support. If the i3c device boots slowly, it might be miss the DDA during boot.Signed-off-by David Nyström <[email protected]>---
Can we rename rescan to something where indicate we are only doing ENTDAA? I think rescan keyword should be reserved for complete rescan of i3c bus. DISEC -> RSTDAA -> ENTDAA -> ...
Quoted 62 lines
Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]--- drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)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 rescan_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +unsigned long val; +int ret; + + ret =kstrtoul (buf,0 , &val); +if (ret) +return ret; + +if (val) { + ret =i3c_master_do_daa (master); +if (ret) +return ret; + } + +return count; +} + +static DEVICE_ATTR_WO (rescan); +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_rescan.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev); ---base-commit:
e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
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
Signature · 3 lines
linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c
Quoted 10 lines · Joshua Yeong
Quoted 5 lines · David Nyström
Add the ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
The usecase could be f.ex. an i3cdev userspace driver for a device with broken hotjoin support. If the i3c device boots slowly, it might be miss the DDA during boot.Signed-off-by David Nyström <[email protected]>---
Can we rename rescan to something where indicate we are only doing ENTDAA? I think rescan keyword should be reserved for complete rescan of i3c bus. DISEC -> RSTDAA -> ENTDAA -> ...
Are you referring to clarifying wording in the commit message, or the sysfs interface naming ? What would be your suggestion, restore -> entdaa ?
Quoted 63 lines
Quoted 62 lines
Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]--- drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)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 rescan_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +unsigned long val; +int ret; + + ret =kstrtoul (buf,0 , &val); +if (ret) +return ret; + +if (val) { + ret =i3c_master_do_daa (master); +if (ret) +return ret; + } + +return count; +} + +static DEVICE_ATTR_WO (rescan); +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_rescan.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev); ---base-commit:
e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
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
Frank Li
reviewerQuoted 10 lines · Joshua Yeong
Quoted 5 lines · David Nyström
Add the ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
The usecase could be f.ex. an i3cdev userspace driver for a device with broken hotjoin support. If the i3c device boots slowly, it might be miss the DDA during boot.Signed-off-by David Nyström <[email protected]>---
Can we rename rescan to something where indicate we are only doing ENTDAA? I think rescan keyword should be reserved for complete rescan of i3c bus. DISEC -> RSTDAA -> ENTDAA -> ...
Look like this is more userful. The only do_daa() is not enough for rescan.
Frank
Quoted 63 lines
Quoted 63 lines
Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]--- drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)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 rescan_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +unsigned long val; +int ret; + + ret =kstrtoul (buf,0 , &val); +if (ret) +return ret; + +if (val) { + ret =i3c_master_do_daa (master); +if (ret) +return ret; + } + +return count; +} + +static DEVICE_ATTR_WO (rescan); +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_rescan.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev); ---base-commit:
e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
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
Quoted 9 lines · Frank Li
Quoted 8 lines · Joshua Yeong
Quoted 5 lines · David Nyström
Add the ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
The usecase could be f.ex. an i3cdev userspace driver for a device with broken hotjoin support. If the i3c device boots slowly, it might be miss the DDA during boot.Signed-off-by David Nyström <[email protected]>---
Quoted 6 lines
Quoted 2 lines
Can we rename rescan to something where indicate we are only doing ENTDAA? I think rescan keyword should be reserved for complete rescan of i3c bus. DISEC -> RSTDAA -> ENTDAA -> ...
Look like this is more userful. The only
do_daa()is not enough for rescan.Frank
If the other patch gets accepted ([PATCH V4 1/3] i3c: master: Add i3c_master_do_daa_ext() for post-hibernation address recovery) Perhaps we can rename here to match what is being used there.
Joshua
Quoted 66 lines
Quoted 66 lines
Quoted 66 lines
Changes in v2:
- Improved the commit message with "why".
- Link to v1:
https://patch.msgid.link/[email protected]
ech--- drivers/i3c/master.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)drivers/i3c/master.c index renamed from drivers/i3c/master.c +0
-0
80dda0e85558..edeae7493b3b100644drivers/i3c/master.c +23
-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 rescan_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) { +struct i3c_master_controller *master =dev_to_i3cmaster (dev); +unsigned long val; +int ret; + + ret =kstrtoul (buf,0 , &val); +if (ret) +return ret; + +if (val) { + ret =i3c_master_do_daa (master); +if (ret) +return ret; + } + +return count; +} + +static DEVICE_ATTR_WO (rescan); +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_rescan.attr,NULL , };ATTRIBUTE_GROUPS (i3c_masterdev); ---base-commit:
e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
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
Signature · 3 lines
linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c