Skip to contentSkip to conversation

dt-bindings: phy: mediatek,xsphy: add property to set disconnect threshold

PATCH RESEND Superseded Chunfeng Yun 3 participants 9 messages Jan 11, 2025 – Feb 24, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chunfeng Yun

author maintainer
#0 lore raw

PATCH RESEND 1/2 dt-bindings: phy: mediatek,xsphy: add property to set disconnect threshold

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +8 -0
index a9e3139fd421..2e012d5e1da1 100644
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
   reg:
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
+      mediatek,discth:
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15
+
       mediatek,efuse-intr:
         description:
           The selection of Internal Resistor (U2/U3 phy)
Signature · 7 lines
2.46.0


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author maintainer
#1 lore raw

PATCH RESEND 2/2 phy: mediatek: xsphy: add support to set disconnect threshold

Add a property to tune usb2 phy's disconnect threshold.

---
based on kernel 6.13-rc1

---
 drivers/phy/mediatek/phy-mtk-xsphy.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/phy/mediatek/phy-mtk-xsphy.c +10 -2
index 7c248f5cfca5..718ed8f17c2d 100644
@@ -59,6 +59,7 @@
 #define XSP_USBPHYACR6		((SSUSB_SIFSLV_U2PHY_COM) + 0x018)
 #define P2A6_RG_BC11_SW_EN	BIT(23)
 #define P2A6_RG_OTG_VBUSCMP_EN	BIT(20)
+#define PA6_RG_U2_DISCTH	GENMASK(7, 4)
 
 #define XSP_U2PHYDTM1		((SSUSB_SIFSLV_U2PHY_COM) + 0x06C)
 #define P2D_FORCE_IDDIG		BIT(9)
@@ -95,6 +96,7 @@ struct xsphy_instance {
 	int eye_src;
 	int eye_vrt;
 	int eye_term;
+	int discth;
 };
 
 struct mtk_xsphy {
@@ -244,9 +246,12 @@ static void phy_parse_property(struct mtk_xsphy *xsphy,
 					 &inst->eye_vrt);
 		device_property_read_u32(dev, "mediatek,eye-term",
 					 &inst->eye_term);
-		dev_dbg(dev, "intr:%d, src:%d, vrt:%d, term:%d\n",
+		device_property_read_u32(dev, "mediatek,discth",
+					 &inst->discth);
+		dev_dbg(dev, "intr:%d, src:%d, vrt:%d, term:%d, discth:%d\n",
 			inst->efuse_intr, inst->eye_src,
-			inst->eye_vrt, inst->eye_term);
+			inst->eye_vrt, inst->eye_term,
+			inst->discth);
 		break;
 	case PHY_TYPE_USB3:
 		device_property_read_u32(dev, "mediatek,efuse-intr",
@@ -285,6 +290,9 @@ static void u2_phy_props_set(struct mtk_xsphy *xsphy,
 	if (inst->eye_term)
 		mtk_phy_update_field(pbase + XSP_USBPHYACR1, P2A1_RG_TERM_SEL,
 				     inst->eye_term);
+	if (inst->discth)
+		mtk_phy_update_field(pbase + XSP_USBPHYACR6, PA6_RG_U2_DISCTH,
+				     inst->discth);
 }
 
 static void u3_phy_props_set(struct mtk_xsphy *xsphy,
Signature · 1 line
2.46.0
maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Chunfeng Yun

Il 11/01/25 15:15, Chunfeng Yun ha scritto:

Quoted 4 lines

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

Quoted 8 lines

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are similar.

---
  Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8 ++++++++
  1 file changed, 8 insertions(+)
#4 lore raw
In reply to Chunfeng Yun
Quoted 25 lines · Chunfeng Yun

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
index a9e3139fd421..2e012d5e1da1 100644
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
   reg:

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 138

Quoted 9 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +6 -0
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
+      mediatek,discth:
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15

What unit is this? Unitless? How are the values determined?

Quoted 7 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
+
       mediatek,efuse-intr:
         description:
           The selection of Internal Resistor (U2/U3 phy)
Signature · 1 line
2.46.0
author maintainer
#5 lore raw
Quoted 33 lines · Conor Dooley
Quoted 32 lines · Chunfeng Yun

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8
++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml index a9e3139fd421..2e012d5e1da1 100644

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
   reg:
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
Quoted 8 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 138

Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +6 -0
+      mediatek,discth:
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15

What unit is this? Unitless? How are the values determined?

No unit, it's a level, may be treat it as an index to select different threshold.

Thanks

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
+
       mediatek,efuse-intr:
         description:
           The selection of Internal Resistor (U2/U3 phy)
Signature · 1 line
2.46.0
#6 lore raw
Quoted 29 lines · Chunfeng Yun (云春峰)
Quoted 28 lines · Conor Dooley
Quoted 27 lines · Chunfeng Yun

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8
++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml index a9e3139fd421..2e012d5e1da1 100644

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 133

Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
   reg:
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
+      mediatek,discth:

Just make it "disconnect-threshold" please.

Quoted 9 lines
Quoted 7 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 138

Quoted 5 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +5 -0
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15

What unit is this? Unitless? How are the values determined?

No unit, it's a level, may be treat it as an index to select different threshold.

So this is a register value of some sort? What is the actual threshold measured in?

author maintainer
#7 lore raw
Quoted 31 lines · Conor Dooley
Quoted 30 lines · Chunfeng Yun (云春峰)
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Chunfeng Yun

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are
similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8
++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml index a9e3139fd421..2e012d5e1da1 100644

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 133

Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
   reg:
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
+      mediatek,discth:

Just make it "disconnect-threshold" please.

Ohhh, Ok, I'll modify it

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +5 -0
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

What unit is this? Unitless? How are the values determined?

No unit, it's a level, may be treat it as an index to select different
threshold.

So this is a register value of some sort?

Yes, the big value means higher threshold.

Quoted 2 lines

What is the actual threshold
measured in?

I think that is mV in fact.

Thanks

#8 lore raw
Quoted 54 lines · Chunfeng Yun (云春峰)
Quoted 31 lines · Conor Dooley
Quoted 30 lines · Chunfeng Yun (云春峰)
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Chunfeng Yun

Add a property to tune usb2 phy's disconnect threshold. And add a compatible for mt8196.

---
based on kernel 6.13-rc1

this property is porting from t-phy driver, due to the u2 phy are
similar.

---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 8
++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml index a9e3139fd421..2e012d5e1da1 100644

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt8196-xsphy
       - const: mediatek,xsphy
 
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 133

Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +1 -0
   reg:
@@ -129,6 +130,13 @@ patternProperties:
         minimum: 1
         maximum: 7
 
+      mediatek,discth:

Just make it "disconnect-threshold" please.

Ohhh, Ok, I'll modify it

Quoted 13 lines
Quoted 12 lines
Quoted 8 lines

Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml patternProperties: · line 138

Quoted 6 lines
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml +5 -0
+        description:
+          The selection of disconnect threshold (U2 phy)
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 1
+        maximum: 15

What unit is this? Unitless? How are the values determined?

No unit, it's a level, may be treat it as an index to select different
threshold.

Quoted 5 lines
Quoted 1 line

So this is a register value of some sort?

Yes, the big value means higher threshold.

Quoted 2 lines

What is the actual threshold
measured in?

I think that is mV in fact.

Can you put it in terms of uV then? The -microvolt suffix is standard in property-units.yaml