From: "Carlo Caione" <ccaione@baylibre.com>
To: "Marek Vasut" <marek.vasut@mailbox.org>,
"Carlo Caione" <ccaione@baylibre.com>,
"GSS_MTK_Uboot_upstream" <GSS_MTK_Uboot_upstream@mediatek.com>,
"Bin Meng" <bmeng.cn@gmail.com>,
"Chunfeng Yun" <chunfeng.yun@mediatek.com>,
<u-boot@lists.denx.de>
Cc: "Ryder Lee" <ryder.lee@mediatek.com>,
"Weijie Gao" <weijie.gao@mediatek.com>,
"Igor Belwon" <igor.belwon@mentallysanemainliners.org>,
"David Lechner" <dlechner@baylibre.com>,
"Julien Stephan" <jstephan@baylibre.com>,
"Marek Vasut" <marex@denx.de>, "Tom Rini" <trini@konsulko.com>,
"Vitor Sato Eschholz" <vsatoes@baylibre.com>
Subject: Re: [PATCH] usb: mtu3: wait for TX FIFO to drain before disconnect
Date: Sat, 18 Jul 2026 12:15:54 +0200 [thread overview]
Message-ID: <DK1MACIGH68W.BZCEOOOEM7EN@baylibre.com> (raw)
In-Reply-To: <804b4b7b-3c81-418b-81da-bacee46b8d46@mailbox.org>
On Fri Jul 17, 2026 at 5:21 PM CEST, Marek Vasut wrote:
> On 7/17/26 3:05 PM, Carlo Caione wrote:
>
> [...]
>
>> @@ -66,6 +69,28 @@ static inline void mtu3_ss_func_set(struct mtu3 *mtu, bool enable)
>> dev_dbg(mtu->dev, "USB3_EN = %d\n", !!enable);
>> }
>>
>> +static void mtu3_wait_for_tx_fifo_empty(struct mtu3 *mtu)
>> +{
>> + struct mtu3_ep *mep;
>> + u32 value;
>> + int ret;
>> + int i;
>> +
>> + for (i = 1; i < mtu->num_eps; i++) {
>> + mep = mtu->in_eps + i;
>> + if (!(mep->flags & MTU3_EP_ENABLED) ||
>> + !list_empty(&mep->req_list))
>> + continue;
>> +
>> + ret = readl_poll_timeout(mtu->mac_base + MU3D_EP_TXCR0(i),
>> + value, value & TX_FIFOEMPTY,
>> + MTU3_TX_FIFO_DRAIN_TIMEOUT_US);
>> + if (ret)
>> + dev_warn(mtu->dev, "%s TX FIFO did not drain\n",
>> + mep->name);
> Shouldn't there be some interface reset on failure ?
Agree, I'll issue a reset.
> Shouldn't the failure be propagated ?
I'll propagate -ETIMEDOUT in v2.
Thanks,
--
Carlo Caione
prev parent reply other threads:[~2026-07-18 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 13:05 [PATCH] usb: mtu3: wait for TX FIFO to drain before disconnect Carlo Caione
2026-07-17 15:21 ` Marek Vasut
2026-07-18 10:15 ` Carlo Caione [this message]
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=DK1MACIGH68W.BZCEOOOEM7EN@baylibre.com \
--to=ccaione@baylibre.com \
--cc=GSS_MTK_Uboot_upstream@mediatek.com \
--cc=bmeng.cn@gmail.com \
--cc=chunfeng.yun@mediatek.com \
--cc=dlechner@baylibre.com \
--cc=igor.belwon@mentallysanemainliners.org \
--cc=jstephan@baylibre.com \
--cc=marek.vasut@mailbox.org \
--cc=marex@denx.de \
--cc=ryder.lee@mediatek.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vsatoes@baylibre.com \
--cc=weijie.gao@mediatek.com \
/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