Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "mika.westerberg@linux.intel.com" <mika.westerberg@linux.intel.com>
Cc: "konrad.dybcio@oss.qualcomm.com" <konrad.dybcio@oss.qualcomm.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"westeri@kernel.org" <westeri@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"YehezkelShB@gmail.com" <YehezkelShB@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"sven@kernel.org" <sven@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"andreas.noever@gmail.com" <andreas.noever@gmail.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v3 7/8] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP
Date: Thu, 26 Nov 2026 08:48:54 +0000	[thread overview]
Message-ID: <269e96946472c8562657fa1b40f24a17ee52b447.camel@mediatek.com> (raw)
In-Reply-To: <20261124160038.GR229695@black.igk.intel.com>

On 二, 2026-11-24 at 17:00 +0100, Mika Westerberg wrote:
> On Mon, Nov 23, 2026 at 07:36:54PM +0800, Chunfeng Yun wrote:
> > When USB4 is woke up by device disconnect, no need wait for 2s,
> > usually the phase2~4 takes at most about 200ms, and enters to
> 
> usually phases 2-4 take at most..
> 
> The 200ms is not from the spec though? It's empirical right on your
> hardhware?

Yes, you are right. The ~200ms is empirical based on testing on our
hardware with various USB4 docks and devices, rather than a hard limit
from the spec.

In the USB4 spec, the lane adapter stays in CLd (TB_PORT_UNPLUGGED)
throughout Phases 2-4 until it sends LT_Resume at the end of Phase 4 to
enter Training (TB_PORT_CONNECTING), and the spec does not define an
overall maximum timeout for Phases 2-4. At the protocol level, Phase 2
(tConnectRx), Phase 3 (AT transactions), and Phase 4 (tLTPhase4 and
Broadcast RT transactions) only take tens of milliseconds; in practice,
the ~100-200ms delay mainly comes from partner router wake-up, re-timer
initialization, etc.

So I doubled that empirical ~200ms to 400ms as a safety margin.

I will clarify in the commit message that this is an empirical value in
v4. Do you think 400ms is fine here, or would you prefer 500ms to leave
a bit more margin for active cables and older Thunderbolt switches?

Thanks

> 
> > TB_PORT_CONNECTING, if it is still in TB_PORT_UNPLUGGED after
> > 400ms,
> > treat it as disconnected.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>


  reply	other threads:[~2026-11-26  8:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 11:36 [PATCH 0/8] thunderbolt: Add support platform NHI driver Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 1/8] thunderbolt: Prefix NHI core functions with tb_ and tb_ring_ Chunfeng Yun
2026-11-24 16:11   ` Mika Westerberg
2026-11-25  6:43     ` Chunfeng Yun (云春峰)
2026-11-25  7:13       ` mika.westerberg
2026-11-25 12:03         ` mika.westerberg
2026-11-26  7:58           ` Chunfeng Yun (云春峰)
2026-11-23 11:36 ` [PATCH v3 2/8] thunderbolt: Move ICM mailbox functions to icm.c and internalize interrupt work Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 3/8] thunderbolt: Make PCIe NHI support opt-in Chunfeng Yun
2026-11-24 16:06   ` Mika Westerberg
2026-11-25  6:53     ` Chunfeng Yun (云春峰)
2026-11-23 11:36 ` [PATCH v3 4/8] thunderbolt: Fix error handling and unwind paths in tb_nhi_probe() Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 5/8] thunderbolt: Add platform NHI driver Chunfeng Yun
2026-11-24 15:55   ` Mika Westerberg
2026-11-25  8:47     ` Chunfeng Yun (云春峰)
2026-11-23 11:36 ` [PATCH v3 6/8] thunderbolt: Increase the lane adapter link-up timeout value Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 7/8] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP Chunfeng Yun
2026-11-24 16:00   ` Mika Westerberg
2026-11-26  8:48     ` Chunfeng Yun (云春峰) [this message]
2026-11-26  9:21       ` mika.westerberg
2026-11-23 11:36 ` [PATCH v3 8/8] thunderbolt: Drop WARN_ON() in tb_disconnect_pci() Chunfeng Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=269e96946472c8562657fa1b40f24a17ee52b447.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sven@kernel.org \
    --cc=westeri@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox