mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] i3c: master: Add sysfs option to rescan bus.
@ 2026-01-22 17:58 David Nyström
  2026-01-22 18:08 ` Joshua Yeong
  0 siblings, 1 reply; 5+ messages in thread
From: David Nyström @ 2026-01-22 17:58 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel, 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 <david.nystrom@est.tech>
---
Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.tech
---
 drivers/i3c/master.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 80dda0e85558..edeae7493b3b 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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,
--  
David Nyström <david.nystrom@est.tech>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] i3c: master: Add sysfs option to rescan bus.
  2026-01-22 17:58 [PATCH v2] i3c: master: Add sysfs option to rescan bus David Nyström
@ 2026-01-22 18:08 ` Joshua Yeong
  2026-01-23  7:04   ` David Nyström
  2026-01-23 19:37   ` Frank Li
  0 siblings, 2 replies; 5+ messages in thread
From: Joshua Yeong @ 2026-01-22 18:08 UTC (permalink / raw)
  To: David Nyström, Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel

On Friday, January 23, 2026 1:58 AM, David Nyström wrote:

> 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 <david.nystrom@est.tech>
> ---

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 -> ...

> Changes in v2:
> - Improved the commit message with "why".
> - Link to v1: https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.tech
> ---
>  drivers/i3c/master.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 80dda0e85558..edeae7493b3b 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -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,
> --
> David Nyström <david.nystrom@est.tech>
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] i3c: master: Add sysfs option to rescan bus.
  2026-01-22 18:08 ` Joshua Yeong
@ 2026-01-23  7:04   ` David Nyström
  2026-01-23 19:37   ` Frank Li
  1 sibling, 0 replies; 5+ messages in thread
From: David Nyström @ 2026-01-23  7:04 UTC (permalink / raw)
  To: Joshua Yeong
  Cc: David Nyström, Alexandre Belloni, Frank Li, linux-i3c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2569 bytes --]



On Thu, 22 Jan 2026, Joshua Yeong wrote:

> On Friday, January 23, 2026 1:58 AM, David Nyström wrote:
>
>> 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 <david.nystrom@est.tech>
>> ---
>
> 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 ?

>> Changes in v2:
>> - Improved the commit message with "why".
>> - Link to v1: https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.tech
>> ---
>>  drivers/i3c/master.c | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 80dda0e85558..edeae7493b3b 100644
>> --- a/drivers/i3c/master.c
>> +++ b/drivers/i3c/master.c
>> @@ -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,
>> --
>> David Nyström <david.nystrom@est.tech>
>>
>>
>> --
>> linux-i3c mailing list
>> linux-i3c@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-i3c
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] i3c: master: Add sysfs option to rescan bus.
  2026-01-22 18:08 ` Joshua Yeong
  2026-01-23  7:04   ` David Nyström
@ 2026-01-23 19:37   ` Frank Li
  2026-01-24  5:19     ` Joshua Yeong
  1 sibling, 1 reply; 5+ messages in thread
From: Frank Li @ 2026-01-23 19:37 UTC (permalink / raw)
  To: Joshua Yeong
  Cc: David Nyström, Alexandre Belloni, linux-i3c, linux-kernel

On Thu, Jan 22, 2026 at 06:08:29PM +0000, Joshua Yeong wrote:
> On Friday, January 23, 2026 1:58 AM, David Nyström wrote:
>
> > 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 <david.nystrom@est.tech>
> > ---
>
> 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
>
> > Changes in v2:
> > - Improved the commit message with "why".
> > - Link to v1: https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.tech
> > ---
> >  drivers/i3c/master.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 80dda0e85558..edeae7493b3b 100644
> > --- a/drivers/i3c/master.c
> > +++ b/drivers/i3c/master.c
> > @@ -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,
> > --
> > David Nyström <david.nystrom@est.tech>
> >
> >
> > --
> > linux-i3c mailing list
> > linux-i3c@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] i3c: master: Add sysfs option to rescan bus.
  2026-01-23 19:37   ` Frank Li
@ 2026-01-24  5:19     ` Joshua Yeong
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua Yeong @ 2026-01-24  5:19 UTC (permalink / raw)
  To: Frank Li; +Cc: David Nyström, Alexandre Belloni, linux-i3c, linux-kernel

On Saturday, January 24, 2026 3:37 AM, Frank Li <Frank.li@nxp.com> wrote:

> On Thu, Jan 22, 2026 at 06:08:29PM +0000, Joshua Yeong wrote:
> > On Friday, January 23, 2026 1:58 AM, David Nyström wrote:
> >
> > > 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 <david.nystrom@est.tech>
> > > ---
> >
> > 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

> >
> > > Changes in v2:
> > > - Improved the commit message with "why".
> > > - Link to v1: 
> > > https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.t
> > > ech
> > > ---
> > >  drivers/i3c/master.c | 24 ++++++++++++++++++++++++
> > >  1 file changed, 24 insertions(+)
> > >
> > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 
> > > 80dda0e85558..edeae7493b3b 100644
> > > --- a/drivers/i3c/master.c
> > > +++ b/drivers/i3c/master.c
> > > @@ -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,
> > > --
> > > David Nyström <david.nystrom@est.tech>
> > >
> > >
> > > --
> > > linux-i3c mailing list
> > > linux-i3c@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-24  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-22 17:58 [PATCH v2] i3c: master: Add sysfs option to rescan bus David Nyström
2026-01-22 18:08 ` Joshua Yeong
2026-01-23  7:04   ` David Nyström
2026-01-23 19:37   ` Frank Li
2026-01-24  5:19     ` Joshua Yeong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®