usb: dwc3: gadget: Check new capability
Subsystems (2)
Thinh Nguyen
maintainercover usb: dwc3: gadget: Check new capability
Capture a new capability register for DWC_usb32 and handle DEV_TXF_FLUSH_BYPASS.
Thinh Nguyen (2):
usb: dwc3: Capture new capability register GHWPARAMS9
usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
drivers/usb/dwc3/core.c | 3 +++ drivers/usb/dwc3/core.h | 5 +++++ drivers/usb/dwc3/gadget.c | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-)
base-commit: 3343f376d4bae98ec11fd104e0e211b275e754b8
Signature · 1 line
2.28.0
Thinh Nguyen
maintainerPATCH 1/2 usb: dwc3: Capture new capability register GHWPARAMS9
DWC_usb32 introduces a new HW capability register GHWPARAMS9. Capture this in the dwc->hwparams.hwparams9 field.
--- drivers/usb/dwc3/core.c | 3 +++ drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/usb/dwc3/core.c +3 -0
@@ -570,6 +570,9 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc) parms->hwparams6 =dwc3_readl (dwc->regs,DWC3_GHWPARAMS6 ); parms->hwparams7 =dwc3_readl (dwc->regs,DWC3_GHWPARAMS7 ); parms->hwparams8 =dwc3_readl (dwc->regs,DWC3_GHWPARAMS8 ); + +if (DWC3_IP_IS (DWC32 )) + parms->hwparams9 =dwc3_readl (dwc->regs,DWC3_GHWPARAMS9 ); }static int dwc3_core_ulpi_init (struct dwc3 *dwc)
drivers/usb/dwc3/core.h +2 -0
@@ -143,6 +143,7 @@#define DWC3_GHWPARAMS8 0xc600#define DWC3_GUCTL3 0xc60c#define DWC3_GFLADJ 0xc630 +#define DWC3_GHWPARAMS9 0xc680/* Device Registers */ #define DWC3_DCFG 0xc700
@@ -857,6 +858,7 @@ struct dwc3_hwparams {u32 hwparams6;u32 hwparams7;u32 hwparams8; +u32 hwparams9; };/* HWPARAMS0 */
Signature · 1 line
2.28.0
Re: [PATCH 1/2] usb: dwc3: Capture new capability register GHWPARAMS9
Hi,
Quoted 4 lines · Thinh Nguyen
DWC_usb32introduces a new HW capability register GHWPARAMS9. Capture this in thedwc->hwparams.hwparams9field.Signed-off-by Thinh Nguyen <[email protected]>
Signature · 1 line
balbi
Thinh Nguyen
maintainerPATCH 2/2 usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
In reply to Thinh NguyenDWC_usb32 IP introduces a new behavior when handling NoStream event for IN endpoints. If the controller is capable of DEV_TXF_FLUSH_BYPASS, then the driver does not need to force to restart stream for IN endpoints. The controller will generate ERDY and restart the stream periodically.
--- drivers/usb/dwc3/core.h | 3 +++ drivers/usb/dwc3/gadget.c | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.h +3 -0
@@ -379,6 +379,9 @@#define DWC3_GHWPARAMS7_RAM1_DEPTH (n) ((n) & 0xffff)#define DWC3_GHWPARAMS7_RAM2_DEPTH (n) (((n) >> 16) & 0xffff) +/* Global HWPARAMS9 Register */ +#define DWC3_GHWPARAMS9_DEV_TXF_FLUSH_BYPASS BIT(0) +/* Global Frame Length Adjustment Register */ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7)#define DWC3_GFLADJ_30MHZ_MASK 0x3f
drivers/usb/dwc3/gadget.c +9 -1
@@ -730,8 +730,16 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)* All stream eps will reinitiate stream on NoStream * rejection until we can determine that the host can * prime after the first transfer. +* +* However, if the controller is capable of +* TXF_FLUSH_BYPASS, then IN direction endpoints will +* automatically restart the stream without the driver +* initiation. */ - dep->flags |=DWC3_EP_FORCE_RESTART_STREAM ; +if (!dep->direction || + !(dwc->hwparams.hwparams9 & +DWC3_GHWPARAMS9_DEV_TXF_FLUSH_BYPASS )) + dep->flags |=DWC3_EP_FORCE_RESTART_STREAM ; } }
Signature · 1 line
2.28.0
Re: [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
Quoted 6 lines · Thinh Nguyen
DWC_usb32IP introduces a new behavior when handling NoStream event for IN endpoints. If the controller is capable ofDEV_TXF_FLUSH_BYPASS, then the driver does not need to force to restart stream for IN endpoints. The controller will generate ERDY and restart the stream periodically.Signed-off-by Thinh Nguyen <[email protected]>
so we still need to force restart for RX? Just making sure. Other than that:
Signature · 1 line
balbi
Thinh Nguyen
maintainerRe: [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
Quoted 7 lines · Felipe Balbi
Quoted 5 lines · Thinh Nguyen
DWC_usb32IP introduces a new behavior when handling NoStream event for IN endpoints. If the controller is capable ofDEV_TXF_FLUSH_BYPASS, then the driver does not need to force to restart stream for IN endpoints. The controller will generate ERDY and restart the stream periodically.
Quoted 7 lines
Quoted 1 line
Signed-off-by Thinh Nguyen <[email protected]>so we still need to force restart for RX? Just making sure. Other than that:
Acked-by Felipe Balbi <[email protected]>
Yes, it's only for Tx. Same behavior remains for Rx. We have some updates to simplify our design handling Tx direction.
Thanks,
Thinh