Skip to content

Commit fc1d1a7

Browse files
Jos Wanggregkh
authored andcommitted
usb: dwc3: core: Workaround for CSR read timeout
This is a workaround for STAR 4846132, which only affects DWC_usb31 version2.00a operating in host mode. There is a problem in DWC_usb31 version 2.00a operating in host mode that would cause a CSR read timeout When CSR read coincides with RAM Clock Gating Entry. By disable Clock Gating, sacrificing power consumption for normal operation. Cc: stable <stable@kernel.org> # 5.10.x: 1e43c86: usb: dwc3: core: Add DWC31 version 2.00a controller Signed-off-by: Jos Wang <joswang@lenovo.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20240619114529.3441-1-joswang1221@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c50814a commit fc1d1a7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/usb/dwc3/core.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,12 +957,16 @@ static bool dwc3_core_is_valid(struct dwc3 *dwc)
957957

958958
static void dwc3_core_setup_global_control(struct dwc3 *dwc)
959959
{
960+
unsigned int power_opt;
961+
unsigned int hw_mode;
960962
u32 reg;
961963

962964
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
963965
reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
966+
hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
967+
power_opt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1);
964968

965-
switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
969+
switch (power_opt) {
966970
case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
967971
/**
968972
* WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
@@ -995,6 +999,20 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc)
995999
break;
9961000
}
9971001

1002+
/*
1003+
* This is a workaround for STAR#4846132, which only affects
1004+
* DWC_usb31 version2.00a operating in host mode.
1005+
*
1006+
* There is a problem in DWC_usb31 version 2.00a operating
1007+
* in host mode that would cause a CSR read timeout When CSR
1008+
* read coincides with RAM Clock Gating Entry. By disable
1009+
* Clock Gating, sacrificing power consumption for normal
1010+
* operation.
1011+
*/
1012+
if (power_opt != DWC3_GHWPARAMS1_EN_PWROPT_NO &&
1013+
hw_mode != DWC3_GHWPARAMS0_MODE_GADGET && DWC3_VER_IS(DWC31, 200A))
1014+
reg |= DWC3_GCTL_DSBLCLKGTNG;
1015+
9981016
/* check if current dwc3 is on simulation board */
9991017
if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) {
10001018
dev_info(dwc->dev, "Running with FPGA optimizations\n");

0 commit comments

Comments
 (0)