public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa
@ 2026-02-19 20:58 David Nyström
  2026-02-20 16:05 ` Frank Li
  2026-03-11 21:59 ` Alexandre Belloni
  0 siblings, 2 replies; 4+ messages in thread
From: David Nyström @ 2026-02-19 20:58 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li
  Cc: linux-i3c, linux-kernel, Joshua Yeong, Meagan Lloyd,
	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 <david.nystrom@est.tech>
---
Changes in v6:
- Add check for init_done to close race with init.
- Link to v5: https://patch.msgid.link/20260219-i3c_rescan-v5-1-42404db20d18@est.tech

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/20260126-i3c_rescan-v4-1-6b3559d82abc@est.tech

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/20260123-i3c_rescan-v3-1-026429fa0c65@est.tech

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/20260122-i3c_rescan-v2-1-84c74a483f03@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
---
 Documentation/ABI/testing/sysfs-bus-i3c | 20 ++++++++++++++++++++
 drivers/i3c/master.c                    | 27 +++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-i3c b/Documentation/ABI/testing/sysfs-bus-i3c
index c1e048957a01..19f5cf8b1b11 100644
--- a/Documentation/ABI/testing/sysfs-bus-i3c
+++ b/Documentation/ABI/testing/sysfs-bus-i3c
@@ -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:	linux-i3c@vger.kernel.org
+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.
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 0eae19b3823d..8f49d4ad473d 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -758,6 +758,32 @@ 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;
+
+	if (!master->init_done)
+		return -EAGAIN;
+
+	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 +795,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,
--  
David Nyström <david.nystrom@est.tech>


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

* Re: [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa
  2026-02-19 20:58 [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa David Nyström
@ 2026-02-20 16:05 ` Frank Li
  2026-02-20 21:13   ` Meagan Lloyd
  2026-03-11 21:59 ` Alexandre Belloni
  1 sibling, 1 reply; 4+ messages in thread
From: Frank Li @ 2026-02-20 16:05 UTC (permalink / raw)
  To: David Nyström
  Cc: Alexandre Belloni, linux-i3c, linux-kernel, Joshua Yeong,
	Meagan Lloyd

On Thu, Feb 19, 2026 at 09:58:03PM +0100, David Nyström wrote:
> 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 <david.nystrom@est.tech>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v6:
> - Add check for init_done to close race with init.
> - Link to v5: https://patch.msgid.link/20260219-i3c_rescan-v5-1-42404db20d18@est.tech
>
> 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/20260126-i3c_rescan-v4-1-6b3559d82abc@est.tech
>
> 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/20260123-i3c_rescan-v3-1-026429fa0c65@est.tech
>
> Changes in v3:
> - Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
> - Link to v2: https://patch.msgid.link/20260122-i3c_rescan-v2-1-84c74a483f03@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
> ---
>  Documentation/ABI/testing/sysfs-bus-i3c | 20 ++++++++++++++++++++
>  drivers/i3c/master.c                    | 27 +++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-i3c b/Documentation/ABI/testing/sysfs-bus-i3c
> index c1e048957a01..19f5cf8b1b11 100644
> --- a/Documentation/ABI/testing/sysfs-bus-i3c
> +++ b/Documentation/ABI/testing/sysfs-bus-i3c
> @@ -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:	linux-i3c@vger.kernel.org
> +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.
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 0eae19b3823d..8f49d4ad473d 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -758,6 +758,32 @@ 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;
> +
> +	if (!master->init_done)
> +		return -EAGAIN;
> +
> +	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 +795,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,
> --
> David Nyström <david.nystrom@est.tech>
>

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

* Re: [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa
  2026-02-20 16:05 ` Frank Li
@ 2026-02-20 21:13   ` Meagan Lloyd
  0 siblings, 0 replies; 4+ messages in thread
From: Meagan Lloyd @ 2026-02-20 21:13 UTC (permalink / raw)
  To: Frank Li
  Cc: David Nyström, Alexandre Belloni, linux-i3c, linux-kernel,
	Joshua Yeong

On Fri, Feb 20, 2026 at 11:05:26AM -0500, Frank Li wrote:
> On Thu, Feb 19, 2026 at 09:58:03PM +0100, David Nyström wrote:
> > 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 <david.nystrom@est.tech>
> > ---
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>

> > Changes in v6:
> > - Add check for init_done to close race with init.
> > - Link to v5: https://patch.msgid.link/20260219-i3c_rescan-v5-1-42404db20d18@est.tech
> >
> > 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/20260126-i3c_rescan-v4-1-6b3559d82abc@est.tech
> >
> > 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/20260123-i3c_rescan-v3-1-026429fa0c65@est.tech
> >
> > Changes in v3:
> > - Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
> > - Link to v2: https://patch.msgid.link/20260122-i3c_rescan-v2-1-84c74a483f03@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
> > ---
> >  Documentation/ABI/testing/sysfs-bus-i3c | 20 ++++++++++++++++++++
> >  drivers/i3c/master.c                    | 27 +++++++++++++++++++++++++++
> >  2 files changed, 47 insertions(+)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-bus-i3c b/Documentation/ABI/testing/sysfs-bus-i3c
> > index c1e048957a01..19f5cf8b1b11 100644
> > --- a/Documentation/ABI/testing/sysfs-bus-i3c
> > +++ b/Documentation/ABI/testing/sysfs-bus-i3c
> > @@ -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:	linux-i3c@vger.kernel.org
> > +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.
> > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> > index 0eae19b3823d..8f49d4ad473d 100644
> > --- a/drivers/i3c/master.c
> > +++ b/drivers/i3c/master.c
> > @@ -758,6 +758,32 @@ 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;
> > +
> > +	if (!master->init_done)
> > +		return -EAGAIN;
> > +
> > +	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 +795,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,
> > --
> > David Nyström <david.nystrom@est.tech>
> >

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

* Re: [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa
  2026-02-19 20:58 [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa David Nyström
  2026-02-20 16:05 ` Frank Li
@ 2026-03-11 21:59 ` Alexandre Belloni
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2026-03-11 21:59 UTC (permalink / raw)
  To: Frank Li, David Nyström
  Cc: linux-i3c, linux-kernel, Joshua Yeong, Meagan Lloyd

On Thu, 19 Feb 2026 21:58:03 +0100, David Nyström wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] i3c: master: Add sysfs option to rescan bus via entdaa
      https://git.kernel.org/i3c/c/fe47fb62cf32

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2026-03-11 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19 20:58 [PATCH v6] i3c: master: Add sysfs option to rescan bus via entdaa David Nyström
2026-02-20 16:05 ` Frank Li
2026-02-20 21:13   ` Meagan Lloyd
2026-03-11 21:59 ` Alexandre Belloni

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