Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i3c: master: Disable slave events before RSTDAA
@ 2026-11-06  6:22 Defa Li
  2026-11-19  7:11 ` Mukesh Savaliya
  2026-11-23 19:54 ` Frank Li
  0 siblings, 2 replies; 5+ messages in thread
From: Defa Li @ 2026-11-06  6:22 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-i3c, linux-kernel, linux-arm-kernel, linux-mediatek,
	wsd_upstream, mingchang.jia, yuhan.wei, hao.lin, Defa Li

Bus initialization sends RSTDAA before disabling slave events. A hot-join
or other slave event may occur after RSTDAA and interfere with the
following DISEC command or the remaining initialization.

Send broadcast DISEC before RSTDAA to disable SIR, master request, and
hot-join events before resetting dynamic addresses. This prevents slave
events from disrupting bus initialization.

Signed-off-by: Defa Li <defa.li@mediatek.com>
---
 drivers/i3c/master.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 01e05bad8661..4fdc8f721364 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2571,10 +2571,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 	}
 
 	/*
-	 * Reset all dynamic address that may have been assigned before
-	 * (assigned by the bootloader for example).
+	 * Disable all slave events before starting DAA. When no active device
+	 * is on the bus, returns Mx error code M2, this error is ignored.
 	 */
-	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
+	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
+					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
+					   I3C_CCC_EVENT_HJ, true);
 	if (ret)
 		goto err_bus_cleanup;
 
@@ -2585,12 +2587,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 	}
 
 	/*
-	 * Disable all slave events before starting DAA. When no active device
-	 * is on the bus, returns Mx error code M2, this error is ignored.
+	 * Reset all dynamic address that may have been assigned before
+	 * (assigned by the bootloader for example).
 	 */
-	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
-					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
-					   I3C_CCC_EVENT_HJ, true);
+	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
 	if (ret)
 		goto err_bus_cleanup;
 
-- 
2.43.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH] i3c: master: Disable slave events before RSTDAA
  2026-11-06  6:22 Defa Li
@ 2026-11-19  7:11 ` Mukesh Savaliya
  2026-11-23 19:54 ` Frank Li
  1 sibling, 0 replies; 5+ messages in thread
From: Mukesh Savaliya @ 2026-11-19  7:11 UTC (permalink / raw)
  To: Defa Li, Alexandre Belloni, Frank Li, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-i3c, linux-kernel, linux-arm-kernel, linux-mediatek,
	wsd_upstream, mingchang.jia, yuhan.wei, hao.lin



On 11/6/2026 11:52 AM, Defa Li wrote:
> Bus initialization sends RSTDAA before disabling slave events. A hot-join
> or other slave event may occur after RSTDAA and interfere with the
> following DISEC command or the remaining initialization.
> 
> Send broadcast DISEC before RSTDAA to disable SIR, master request, and
> hot-join events before resetting dynamic addresses. This prevents slave
> events from disrupting bus initialization.
> 

While the sequence you suggested making sense to me, but i am wondering 
before bus_init, are there really a target device getting powered up who 
can generate hotjoin ?

MY understanding is, post master registration and bus_init only target 
devices should start life, isn't it ?


> Signed-off-by: Defa Li <defa.li@mediatek.com>
> ---
>   drivers/i3c/master.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 01e05bad8661..4fdc8f721364 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2571,10 +2571,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
>   	}
>   
>   	/*
> -	 * Reset all dynamic address that may have been assigned before
> -	 * (assigned by the bootloader for example).
> +	 * Disable all slave events before starting DAA. When no active device
> +	 * is on the bus, returns Mx error code M2, this error is ignored.
>   	 */
> -	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> +	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
> +					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
> +					   I3C_CCC_EVENT_HJ, true);
>   	if (ret)
>   		goto err_bus_cleanup;
>   
> @@ -2585,12 +2587,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
>   	}
>   
>   	/*
> -	 * Disable all slave events before starting DAA. When no active device
> -	 * is on the bus, returns Mx error code M2, this error is ignored.
> +	 * Reset all dynamic address that may have been assigned before
> +	 * (assigned by the bootloader for example).
>   	 */
> -	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
> -					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
> -					   I3C_CCC_EVENT_HJ, true);
> +	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
>   	if (ret)
>   		goto err_bus_cleanup;
>   


-- 
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] i3c: master: Disable slave events before RSTDAA
  2026-11-06  6:22 Defa Li
  2026-11-19  7:11 ` Mukesh Savaliya
@ 2026-11-23 19:54 ` Frank Li
  1 sibling, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-11-23 19:54 UTC (permalink / raw)
  To: Defa Li
  Cc: Alexandre Belloni, Frank Li, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-i3c, linux-kernel,
	linux-arm-kernel, linux-mediatek, wsd_upstream, mingchang.jia,
	yuhan.wei, hao.lin

On Fri, Nov 06, 2026 at 02:22:10PM +0800, Defa Li wrote:
> Bus initialization sends RSTDAA before disabling slave events. A hot-join
> or other slave event may occur after RSTDAA and interfere with the
> following DISEC command or the remaining initialization.
>
> Send broadcast DISEC before RSTDAA to disable SIR, master request, and
> hot-join events before resetting dynamic addresses. This prevents slave
> events from disrupting bus initialization.
>
> Signed-off-by: Defa Li <defa.li@mediatek.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/i3c/master.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 01e05bad8661..4fdc8f721364 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2571,10 +2571,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
>  	}
>
>  	/*
> -	 * Reset all dynamic address that may have been assigned before
> -	 * (assigned by the bootloader for example).
> +	 * Disable all slave events before starting DAA. When no active device
> +	 * is on the bus, returns Mx error code M2, this error is ignored.
>  	 */
> -	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
> +	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
> +					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
> +					   I3C_CCC_EVENT_HJ, true);
>  	if (ret)
>  		goto err_bus_cleanup;
>
> @@ -2585,12 +2587,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
>  	}
>
>  	/*
> -	 * Disable all slave events before starting DAA. When no active device
> -	 * is on the bus, returns Mx error code M2, this error is ignored.
> +	 * Reset all dynamic address that may have been assigned before
> +	 * (assigned by the bootloader for example).
>  	 */
> -	ret = i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false,
> -					   I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
> -					   I3C_CCC_EVENT_HJ, true);
> +	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
>  	if (ret)
>  		goto err_bus_cleanup;
>
> --
> 2.43.0
>

-- 
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] i3c: master: Disable slave events before RSTDAA
       [not found] <6b079454.7734c9c0.2aca01.17e2SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2026-11-26 19:52 ` Mukesh Savaliya
  2026-11-26 19:56 ` Mukesh Savaliya
  1 sibling, 0 replies; 5+ messages in thread
From: Mukesh Savaliya @ 2026-11-26 19:52 UTC (permalink / raw)
  To: Defa Li (李德发); +Cc: linux-i3c@lists.infradead.org



On 11/26/2026 7:37 AM, Defa Li (李德发) wrote:

[...]

>> 
>> While the sequence you suggested making sense to me, but i am
>> wondering
>> before bus_init, are there really a target device getting powered up
>> who
>> can generate hotjoin ?
>> 
>> MY understanding is, post master registration and bus_init only
>> target
>> devices should start life, isn't it ?
>> 
> 
> This patch is not intended to address any target device behaviors that
> occur before bus_init itself.
> 
> Our actual hardware testing revealed that some target devices will
> actively trigger a Hot-Join request within a short window after
> receiving the RSTDAA CCC. By sending the broadcast DISEC first, we
> ensure that no such Hot-Join requests can be fired after RSTDAA,
> successfully preventing this issue.
> 
I see, so it's not a target device fault but i take it as valid scenario 
even from target side.
> Therefore, sending broadcast DISEC before RSTDAA makes the entire
> initialization sequence much more robust.
> 
Agreed ! Makes sense to me.
>> 
>> > Signed-off-by: Defa Li <defa.li@mediatek.com>
>> > ---
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>

-- 
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] i3c: master: Disable slave events before RSTDAA
       [not found] <6b079454.7734c9c0.2aca01.17e2SMTPIN_ADDED_BROKEN@mx.google.com>
  2026-11-26 19:52 ` [PATCH] i3c: master: Disable slave events before RSTDAA Mukesh Savaliya
@ 2026-11-26 19:56 ` Mukesh Savaliya
  1 sibling, 0 replies; 5+ messages in thread
From: Mukesh Savaliya @ 2026-11-26 19:56 UTC (permalink / raw)
  To: Defa Li (李德发), alexandre.belloni@bootlin.com,
	Frank Li
  Cc: linux-i3c@lists.infradead.org

Though i have reviewed, I don't see you have added Frank and Alexandre 
while replying. I believe they should add/keep them while replying.

On 11/26/2026 7:37 AM, Defa Li (李德发) wrote:
> Hi Mukesh,
> 
> On Thu, 2026-11-19 at 12:41 +0530, Mukesh Savaliya wrote:
>> 
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>> 
>> 
>> On 11/6/2026 11:52 AM, Defa Li wrote:
>> > Bus initialization sends RSTDAA before disabling slave events. A
>> > hot-join
>> > or other slave event may occur after RSTDAA and interfere with the
>> > following DISEC command or the remaining initialization.
>> > 
>> > Send broadcast DISEC before RSTDAA to disable SIR, master request,
>> > and
>> > hot-join events before resetting dynamic addresses. This prevents
>> > slave
>> > events from disrupting bus initialization.
>> > 
>> 
>> While the sequence you suggested making sense to me, but i am
>> wondering
>> before bus_init, are there really a target device getting powered up
>> who
>> can generate hotjoin ?
>> 
>> MY understanding is, post master registration and bus_init only
>> target
>> devices should start life, isn't it ?
>> 
> 
> This patch is not intended to address any target device behaviors that
> occur before bus_init itself.
> 
> Our actual hardware testing revealed that some target devices will
> actively trigger a Hot-Join request within a short window after
> receiving the RSTDAA CCC. By sending the broadcast DISEC first, we
> ensure that no such Hot-Join requests can be fired after RSTDAA,
> successfully preventing this issue.
> 
> Therefore, sending broadcast DISEC before RSTDAA makes the entire
> initialization sequence much more robust.
> 
>> 
>> > Signed-off-by: Defa Li <defa.li@mediatek.com>
>> > ---
>> >   drivers/i3c/master.c | 16 ++++++++--------
>> >   1 file changed, 8 insertions(+), 8 deletions(-)
>> > 
>> > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
>> > index 01e05bad8661..4fdc8f721364 100644
>> > --- a/drivers/i3c/master.c
>> > +++ b/drivers/i3c/master.c
>> > @@ -2571,10 +2571,12 @@ static int i3c_master_bus_init(struct
>> > i3c_master_controller *master)
>> >       }
>> > 
>> >       /*
>> > -      * Reset all dynamic address that may have been assigned
>> > before
>> > -      * (assigned by the bootloader for example).
>> > +      * Disable all slave events before starting DAA. When no
>> > active device
>> > +      * is on the bus, returns Mx error code M2, this error is
>> > ignored.
>> >        */
>> > -     ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
>> > +     ret = i3c_master_enec_disec_locked(master,
>> > I3C_BROADCAST_ADDR, false,
>> > +                                        I3C_CCC_EVENT_SIR |
>> > I3C_CCC_EVENT_MR |
>> > +                                        I3C_CCC_EVENT_HJ, true);
>> >       if (ret)
>> >               goto err_bus_cleanup;
>> > 
>> > @@ -2585,12 +2587,10 @@ static int i3c_master_bus_init(struct
>> > i3c_master_controller *master)
>> >       }
>> > 
>> >       /*
>> > -      * Disable all slave events before starting DAA. When no
>> > active device
>> > -      * is on the bus, returns Mx error code M2, this error is
>> > ignored.
>> > +      * Reset all dynamic address that may have been assigned
>> > before
>> > +      * (assigned by the bootloader for example).
>> >        */
>> > -     ret = i3c_master_enec_disec_locked(master,
>> > I3C_BROADCAST_ADDR, false,
>> > -                                        I3C_CCC_EVENT_SIR |
>> > I3C_CCC_EVENT_MR |
>> > -                                        I3C_CCC_EVENT_HJ, true);
>> > +     ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
>> >       if (ret)
>> >               goto err_bus_cleanup;
>> > 
>> 
> 
> Thanks,
> Defa
> 
> 
> ************* MEDIATEK Confidentiality Notice ********************
> The information contained in this e-mail message (including any
> attachments) may be confidential, proprietary, privileged, or otherwise
> exempt from disclosure under applicable laws. It is intended to be
> conveyed only to the designated recipient(s). Any use, dissemination,
> distribution, printing, retaining or copying of this e-mail (including its
> attachments) by unintended recipient(s) is strictly prohibited and may
> be unlawful. If you are not an intended recipient of this e-mail, or believe
> that you have received this e-mail in error, please notify the sender
> immediately (by replying to this e-mail), delete any and all copies of
> this e-mail (including any attachments) from your system, and do not
> disclose the content of this e-mail to any other person. Thank you!
> 


-- 
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-11-26 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6b079454.7734c9c0.2aca01.17e2SMTPIN_ADDED_BROKEN@mx.google.com>
2026-11-26 19:52 ` [PATCH] i3c: master: Disable slave events before RSTDAA Mukesh Savaliya
2026-11-26 19:56 ` Mukesh Savaliya
2026-11-06  6:22 Defa Li
2026-11-19  7:11 ` Mukesh Savaliya
2026-11-23 19:54 ` Frank Li

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