* [PATCH 0/2] usb: dwc3: gadget: Check new capability
@ 2021-04-22 23:51 Thinh Nguyen
2021-04-22 23:51 ` [PATCH 1/2] usb: dwc3: Capture new capability register GHWPARAMS9 Thinh Nguyen
2021-04-22 23:51 ` [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability Thinh Nguyen
0 siblings, 2 replies; 6+ messages in thread
From: Thinh Nguyen @ 2021-04-22 23:51 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman, Thinh.Nguyen, linux-usb; +Cc: John Youn
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
--
2.28.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] usb: dwc3: Capture new capability register GHWPARAMS9
2021-04-22 23:51 [PATCH 0/2] usb: dwc3: gadget: Check new capability Thinh Nguyen
@ 2021-04-22 23:51 ` Thinh Nguyen
2021-04-23 6:08 ` Felipe Balbi
2021-04-22 23:51 ` [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability Thinh Nguyen
1 sibling, 1 reply; 6+ messages in thread
From: Thinh Nguyen @ 2021-04-22 23:51 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman, Thinh.Nguyen, linux-usb; +Cc: John Youn
DWC_usb32 introduces a new HW capability register GHWPARAMS9. Capture
this in the dwc->hwparams.hwparams9 field.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
drivers/usb/dwc3/core.c | 3 +++
drivers/usb/dwc3/core.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2f118ad43571..b6e53d8212cd 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -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)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 7e3afa5378e8..b678200cc51e 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -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 */
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
2021-04-22 23:51 [PATCH 0/2] usb: dwc3: gadget: Check new capability Thinh Nguyen
2021-04-22 23:51 ` [PATCH 1/2] usb: dwc3: Capture new capability register GHWPARAMS9 Thinh Nguyen
@ 2021-04-22 23:51 ` Thinh Nguyen
2021-04-23 6:09 ` Felipe Balbi
1 sibling, 1 reply; 6+ messages in thread
From: Thinh Nguyen @ 2021-04-22 23:51 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman, Thinh.Nguyen, linux-usb; +Cc: John Youn
DWC_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.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
drivers/usb/dwc3/core.h | 3 +++
drivers/usb/dwc3/gadget.c | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index b678200cc51e..b1e875c58f20 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -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
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 90f4f9e69b22..dd80e5ca8c78 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -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;
}
}
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
2021-04-22 23:51 ` [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability Thinh Nguyen
@ 2021-04-23 6:09 ` Felipe Balbi
2021-04-26 21:27 ` Thinh Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2021-04-23 6:09 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, Thinh.Nguyen, linux-usb; +Cc: John Youn
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> DWC_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.
>
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
so we still need to force restart for RX? Just making sure. Other than
that:
Acked-by: Felipe Balbi <balbi@kernel.org>
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability
2021-04-23 6:09 ` Felipe Balbi
@ 2021-04-26 21:27 ` Thinh Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Thinh Nguyen @ 2021-04-26 21:27 UTC (permalink / raw)
To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb; +Cc: John Youn
Felipe Balbi wrote:
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>
>> DWC_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.
>>
>> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
>
> so we still need to force restart for RX? Just making sure. Other than
> that:
>
> Acked-by: Felipe Balbi <balbi@kernel.org>
>
Yes, it's only for Tx. Same behavior remains for Rx. We have some
updates to simplify our design handling Tx direction.
Thanks,
Thinh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-26 21:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 23:51 [PATCH 0/2] usb: dwc3: gadget: Check new capability Thinh Nguyen
2021-04-22 23:51 ` [PATCH 1/2] usb: dwc3: Capture new capability register GHWPARAMS9 Thinh Nguyen
2021-04-23 6:08 ` Felipe Balbi
2021-04-22 23:51 ` [PATCH 2/2] usb: dwc3: gadget: Handle DEV_TXF_FLUSH_BYPASS capability Thinh Nguyen
2021-04-23 6:09 ` Felipe Balbi
2021-04-26 21:27 ` Thinh Nguyen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.