mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] usb: dwc2: wa for isoc packet tx fifo flush at periodic frame boundary
Date: Thu, 5 Nov 2026 01:27:33 +0000	[thread overview]
Message-ID: <auvbRQQXJsnbhvQw@vbox> (raw)
In-Reply-To: <20261104-dwc2-fifo-fixes-v2-v2-2-2bb13820f662@foss.st.com>

On Wed, Nov 04, 2026, Fabrice Gasnier wrote:
> If an isochronous packet is still being transmitted, when the end of
> periodic frame interval elapses, using dma desc on dwc2 controller,
> the device wrongly flushes the pending packets from the tx fifo.
> This can lead to a huge packet is sent on the bus, leading to the host
> finally reset the bus, and re-enumerate it.
> 
> Workaround it by tuning the periodic frame interval limit from 80% to 95%,
> on the affected cores (2.70a to 4.00a). It makes the issue very unlikely
> to occur.
> 
> Fixes: 540ccba08599 ("usb: dwc2: gadget: Start and complete DDMA isoc transfers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
> Changes in v2:
> - Thinh review comments:
> - Fix a typo 'flushes'
> - Use DCFG_PERFRINT() macro
> - Add DWC2_HS_IOT_REV_1_00a and DWC2_FS_IOT_REV_1_00a core revisions.
> - Add a Fixes tag, and Cc stable
> ---
>  drivers/usb/dwc2/core.h   |  1 +
>  drivers/usb/dwc2/gadget.c | 15 +++++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 015a5fb7842d..54c040da0cae 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -1108,6 +1108,7 @@ struct dwc2_hsotg {
>  
>  	/* DWC OTG HW Release versions */
>  #define DWC2_CORE_REV_4_30a	0x4f54430a
> +#define DWC2_CORE_REV_2_70a	0x4f54270a
>  #define DWC2_CORE_REV_2_71a	0x4f54271a
>  #define DWC2_CORE_REV_2_72a     0x4f54272a
>  #define DWC2_CORE_REV_2_80a	0x4f54280a
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index bdabf3c39da1..b84cb6b2cefa 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -3511,6 +3511,21 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>  	if (hsotg->params.ipg_isoc_en)
>  		dcfg |= DCFG_IPG_ISOC_SUPPORDED;
>  
> +	/*
> +	 * WA for Device Flushes Ongoing ISOC IN Packet at End-of-Periodic-Frame Boundary.
> +	 * Once passed the end of periodic frame, and the controller is transmitting an
> +	 * ISOC IN packet, the device flushes the transmit FIFO. Tune periodic frame
> +	 * interval to 95% instead of 80% to avoid it.
> +	 */
> +	if (using_desc_dma(hsotg) &&
> +	    ((hsotg->hw_params.snpsid >= DWC2_CORE_REV_2_70a &&
> +	      hsotg->hw_params.snpsid <= DWC2_CORE_REV_4_00a) ||
> +	     hsotg->hw_params.snpsid == DWC2_FS_IOT_REV_1_00a ||
> +	     hsotg->hw_params.snpsid == DWC2_HS_IOT_REV_1_00a)) {
> +		dcfg &= ~DCFG_PERFRINT_MASK;
> +		dcfg |= DCFG_PERFRINT(DCFG_PERFRINT_LIMIT);
> +	}
> +
>  	dwc2_writel(hsotg, dcfg,  DCFG);
>  
>  	dwc2_hsotg_init_fifo(hsotg);
> 
> -- 
> 2.43.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      reply	other threads:[~2026-11-05  1:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 13:20 [PATCH v2 0/2] usb: dwc2: fix fifo reinit and workaround for isoc tx packet Fabrice Gasnier
2026-11-04 13:20 ` [PATCH v2 1/2] usb: dwc2: fix fifo reinit in dwc2_hsotg_core_init_disconnected Fabrice Gasnier
2026-11-04 13:20 ` [PATCH v2 2/2] usb: dwc2: wa for isoc packet tx fifo flush at periodic frame boundary Fabrice Gasnier
2026-11-05  1:27   ` Thinh Nguyen [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=auvbRQQXJsnbhvQw@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.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

all inboxes | Powered by JetHome®