public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: dwc3: core: add p3p2tranok quirk
@ 2024-06-01  9:26 joswang
  2024-06-01  9:32 ` [PATCH 2/2] usb: dwc3: core: Workaround for CSR read timeout joswang
                   ` (9 more replies)
  0 siblings, 10 replies; 51+ messages in thread
From: joswang @ 2024-06-01  9:26 UTC (permalink / raw)
  To: Thinh.Nguyen; +Cc: gregkh, linux-usb, linux-kernel, joswang

From: joswang <joswang@lenovo.com>

In the case of enable hibernation, there is an issue with
the DWC31 2.00a and earlier versions where the controller
link power state transition from P3/P3CPM/P4 to P2 may take
longer than expected, ultimately resulting in the hibernation
D3 entering time exceeding the expected 10ms.

Synopsys workaround:
If the PHY supports direct P3 to P2 transition, program
GUSB3PIPECTL.P3P2Tran0K=1. However, note that as per PIPE4
Specification, direct transition from P3 to P2 is illegal.

Therefore, adding p3p2tranok quirk for workaround hibernation
D3 exceeded the expected entry time.

Signed-off-by: joswang <joswang@lenovo.com>
---
 drivers/usb/dwc3/core.c | 5 +++++
 drivers/usb/dwc3/core.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7ee61a89520b..3a8fbc2d6b99 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -666,6 +666,9 @@ static int dwc3_ss_phy_setup(struct dwc3 *dwc, int index)
 	if (dwc->dis_del_phy_power_chg_quirk)
 		reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE;
 
+	if (dwc->p2p3tranok_quirk)
+		reg |= DWC3_GUSB3PIPECTL_P3P2TRANOK;
+
 	dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(index), reg);
 
 	return 0;
@@ -1715,6 +1718,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 
 	dwc->dis_split_quirk = device_property_read_bool(dev,
 				"snps,dis-split-quirk");
+	dwc->p2p3tranok_quirk = device_property_read_bool(dev,
+				"snps,p2p3tranok-quirk");
 
 	dwc->lpm_nyet_threshold = lpm_nyet_threshold;
 	dwc->tx_de_emphasis = tx_de_emphasis;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 3781c736c1a1..2810dce8b42e 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -327,6 +327,7 @@
 #define DWC3_GUSB3PIPECTL_DEP1P2P3_EN	DWC3_GUSB3PIPECTL_DEP1P2P3(1)
 #define DWC3_GUSB3PIPECTL_DEPOCHANGE	BIT(18)
 #define DWC3_GUSB3PIPECTL_SUSPHY	BIT(17)
+#define DWC3_GUSB3PIPECTL_P3P2TRANOK	BIT(11)
 #define DWC3_GUSB3PIPECTL_LFPSFILT	BIT(9)
 #define DWC3_GUSB3PIPECTL_RX_DETOPOLL	BIT(8)
 #define DWC3_GUSB3PIPECTL_TX_DEEPH_MASK	DWC3_GUSB3PIPECTL_TX_DEEPH(3)
@@ -1132,6 +1133,8 @@ struct dwc3_scratchpad_array {
  *			instances in park mode.
  * @parkmode_disable_hs_quirk: set if we need to disable all HishSpeed
  *			instances in park mode.
+ * @p2p3tranok_quirk: set if Controller transitions directly from phy
+ *			power state P2 to P3 or from state P3 to P2.
  * @gfladj_refclk_lpm_sel: set if we need to enable SOF/ITP counter
  *                          running based on ref_clk
  * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
@@ -1361,6 +1364,7 @@ struct dwc3 {
 	unsigned		ulpi_ext_vbus_drv:1;
 	unsigned		parkmode_disable_ss_quirk:1;
 	unsigned		parkmode_disable_hs_quirk:1;
+	unsigned		p2p3tranok_quirk:1;
 	unsigned		gfladj_refclk_lpm_sel:1;
 
 	unsigned		tx_de_emphasis_quirk:1;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2024-07-01 11:48 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-01  9:26 [PATCH 1/2] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-01  9:32 ` [PATCH 2/2] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-03 13:00 ` [PATCH v2, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-04  6:33   ` Krzysztof Kozlowski
2024-06-12 14:28     ` joswang
2024-06-13  6:09       ` Krzysztof Kozlowski
2024-06-03 13:01 ` [PATCH v2, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-04  0:02   ` Thinh Nguyen
2024-06-05  4:49     ` joswang
2024-06-07 14:24     ` joswang
2024-06-19 11:56     ` joswang
2024-06-22  0:05       ` Thinh Nguyen
2024-06-25 13:31         ` joswang
2024-06-26  1:29           ` Thinh Nguyen
2024-07-01 11:48             ` joswang
2024-06-03 13:02 ` [PATCH v2, 3/3] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-04  0:07   ` Thinh Nguyen
2024-06-04 13:36     ` joswang
2024-06-04 23:13       ` Thinh Nguyen
2024-06-06  1:29       ` Thinh Nguyen
2024-06-07 14:07         ` joswang
2024-06-07 22:36           ` Thinh Nguyen
     [not found]         ` <CAMtoTm1roAvvWCu9LSfcbnozZnakMEexdUVxNyZ7N5KOG8tHcg@mail.gmail.com>
2024-06-07 22:49           ` Thinh Nguyen
2024-06-11 14:29 ` [PATCH v3, " joswang
2024-06-12  7:58   ` Greg KH
2024-06-12 12:44     ` joswang
2024-06-12 13:52     ` joswang
2024-06-12 14:07       ` Greg KH
2024-06-12 14:15         ` joswang
2024-06-12  7:58   ` Greg KH
2024-06-12 12:47     ` joswang
2024-06-12 12:56       ` Greg KH
2024-06-12 13:39         ` joswang
2024-06-12 13:52           ` Greg KH
2024-06-12 14:54 ` [PATCH v3, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-12 15:07 ` [PATCH v3, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-12 15:23 ` [PATCH v4, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-13  6:17   ` Krzysztof Kozlowski
2024-06-13 13:19     ` joswang
2024-06-13 14:03       ` Krzysztof Kozlowski
2024-06-12 15:36 ` [PATCH v4, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-12 15:39 ` [PATCH v4, 3/3] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-12 17:04   ` Greg KH
2024-06-12 17:13     ` Conor Dooley
2024-06-13 11:46     ` joswang
2024-06-18  0:05       ` Thinh Nguyen
2024-06-18  4:24         ` Jung Daehwan
2024-06-18 21:36           ` Thinh Nguyen
2024-06-19  1:34             ` Jung Daehwan
2024-06-18 12:47         ` joswang
2024-06-18 13:38           ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox