Skip to contentSkip to conversation

phy: qualcomm: m31-eusb2: Add register XCFGI_159_152 for SE0 recovery

PATCH Superseded Peter Chen 5 participants 5 messages Oct 27 – Nov 15

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH v2 1/1 phy: qualcomm: m31-eusb2: Add register XCFGI_159_152 for SE0 recovery

From: Elson Serrao <[email protected]>

This patch introduces support for the XCFGI_159_152 register to enable a hardware-based SE0 recovery mechanism in the M31 PHY when operating in host mode.

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

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

Fixes 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")

---
Changes for v2:
- Add Fixes and Reviewed-by tags
- Link to v1: https://lore.kernel.org/all/[email protected]/

 drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +10 -0
index 275df38256de..8d954e772585 100644
@@ -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,13 @@ 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 SE0 timeout mechanism in M31.
+	 * This enables a counter which will assume bus inactive if
+	 * SE0 is more than 2.5ms and reset the state machine to 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),
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 18 lines · Peter Chen

From: Elson Serrao <[email protected]>

This patch introduces support for the XCFGI_159_152 register to enable a hardware-based SE0 recovery mechanism in the M31 PHY when operating in host mode.

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

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

Quoted 4 lines
Fixes 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")
Reviewed-by on v2 1/1
#2 lore raw
In reply to Peter Chen
Quoted 18 lines · Peter Chen

From: Elson Serrao <[email protected]>

This patch introduces support for the XCFGI_159_152 register to enable a hardware-based SE0 recovery mechanism in the M31 PHY when operating in host mode.

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

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

Quoted 4 lines
Fixes 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")
Quoted 36 lines

---
Changes for v2:
- Add Fixes and Reviewed-by tags
- Link to v1: https://lore.kernel.org/all/[email protected]/

  drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +10 -0
index 275df38256de..8d954e772585 100644
@@ -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,13 @@ 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 SE0 timeout mechanism in M31.
+	 * This enables a counter which will assume bus inactive if
+	 * SE0 is more than 2.5ms and reset the state machine to 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),
Reviewed-by on v2 1/1
#4 lore raw
In reply to Peter Chen
Quoted 3 lines · Peter Chen

From: Elson Serrao <[email protected]>

This patch introduces support for the XCFGI_159_152 register to enable a

Avoid using 'This patch'. Once a patch gets merged, it will become a commit.

Quoted 8 lines

hardware-based SE0 recovery mechanism in the M31 PHY when operating in host mode.

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

Quoted 7 lines

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

Please rewrite the commit message in imperative tone.

Quoted 27 lines
Fixes 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")

---
Changes for v2:
- Add Fixes and Reviewed-by tags
- Link to v1: https://lore.kernel.org/all/[email protected]/

 drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +3 -0
index 275df38256de..8d954e772585 100644
@@ -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,		\

drivers/phy/qualcomm/phy-qcom-m31-eusb2.c static const struct m31_phy_tbl_entry m31_eusb2_setup_tbl[] = { · line 99

Quoted 9 lines
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +6 -0
@@ -88,6 +91,13 @@ 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 SE0 timeout mechanism in M31.
+	 * This enables a counter which will assume bus inactive if
+	 * SE0 is more than 2.5ms and reset the state machine to default
+	 * state.
+	 */

Any reason on not making use of 80columns for comments?

With these fixed,

- Mani