mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] phy: qualcomm: m31-eusb2: Add register XCFGI_159_152 for SE0 recovery
@ 2026-11-19  9:17 Peter Chen
  0 siblings, 0 replies; only message in thread
From: Peter Chen @ 2026-11-19  9:17 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Neil Armstrong, Manivannan Sadhasivam, Konrad Dybcio,
	Elson Serrao, Ronak Raheja, Wesley Cheng, Udipto Goswami,
	Jack Pham, Pratham Pratap, Krishna Kurapati, linux-arm-msm,
	linux-phy, linux-kernel, Abel Vesa, Christian Cortner,
	Manivannan Sadhasivam, Peter Chen

From: Elson Serrao <elson.serrao@oss.qualcomm.com>

During PHY initialization, spurious pulses from external devices can
interfere with speed negotiation, potentially leading to abnormal
behavior in host mode. The M31 PHY provides a hardware-based fail-safe
mechanism for this, controlled by bit 159 of the XCFGI register.

When XCFG_SE0_TIMEOUT_EN (bit 159) is set, a hardware counter monitors
the SE0 state. If SE0 persists for more than 2.5 ms before entering L0
mode, the PHY treats this as bus inactivity and resets its state
machine to the default state. After transitioning to L0, the PHY
resumes normal operation in accordance with the eUSB specification.

Add the XCFGI_159_152 register definition and set XCFG_SE0_TIMEOUT_EN
in the PHY override sequence to enable this SE0 recovery mechanism.

Fixes: 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Reviewed-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Tested-by: Christian Cortner <ccortner@gmail.com> # Asus Zenbook A16 (UX3607OA)
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Peter Chen <peter.chen@oss.qualcomm.com>
---
Changes for v3:
- Rewrite commit message in imperative mood, drop "This patch" (Mani)
- Reflow the code comment to use 80 columns (Mani)
- Add Reviewed-by tags from Krishna, Abel and Mani
- Add Tested-by tag from Christian
- Link to v2: https://lore.kernel.org/all/20261027015545.2758784-1-peter.chen@oss.qualcomm.com/

Changes for v2:
- Add Fixes and Reviewed-by tags
- Link to v1: https://lore.kernel.org/all/20261020061811.3127511-1-peter.chen@oss.qualcomm.com/

 drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
index 275df38256de..70fcfaa8ced4 100644
--- a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
@@ -56,6 +56,9 @@
 #define USB_PHY_XCFGI_7_0		(0x15c)
 #define PLL_LOCK_TIME			GENMASK(1, 0)
 
+#define USB_PHY_XCFGI_159_152		(0x1a8)
+#define SE0_TIMEOUT_EN			BIT(7)
+
 #define M31_EUSB_PHY_INIT_CFG(o, b, v)	\
 {				\
 	.off = o,		\
@@ -88,6 +91,12 @@ static const struct m31_phy_tbl_entry m31_eusb2_setup_tbl[] = {
 };
 
 static const struct m31_phy_tbl_entry m31_eusb_phy_override_tbl[] = {
+	/*
+	 * Set XCFGI[159] to enable the SE0 timeout mechanism in M31. This
+	 * enables a counter which assumes the bus is inactive if SE0 lasts
+	 * more than 2.5ms, and resets the state machine to its default state.
+	 */
+	M31_EUSB_PHY_INIT_CFG(USB_PHY_XCFGI_159_152, SE0_TIMEOUT_EN, 1),
 	M31_EUSB_PHY_INIT_CFG(USB_PHY_XCFGI_39_32, HSTX_PE, 0),
 	M31_EUSB_PHY_INIT_CFG(USB_PHY_XCFGI_71_64, HSTX_SWING, 7),
 	M31_EUSB_PHY_INIT_CFG(USB_PHY_XCFGI_31_24, HSTX_SLEW, 0),

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19  9:17 [PATCH v3] phy: qualcomm: m31-eusb2: Add register XCFGI_159_152 for SE0 recovery Peter Chen

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®