Skip to contentSkip to conversation

phy: qualcomm: phy-qcom-eusb2-repeater: rework reg override handler

PATCH Superseded Pengyu Luo 4 participants 4 messages Apr 5, 2025 – Apr 7, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Pengyu Luo

author
#0 lore raw

PATCH 1/1 phy: qualcomm: phy-qcom-eusb2-repeater: rework reg override handler

In downstream tree, many registers need to be overrided, it varies from devices and platforms, not only HS trasmit amplitude(0x51), HS disconnect threshold(0x53), Tx pre-emphasis tuning(0x57).

The device I plan to upstream also uses it, so I write the patch for it (Oneplus Pad Pro / Oneplus Pad 2, sm8650-mtp based).

In upstream, only Sony Xperia 1 V is using this, so fixing it for sony, in downstream, some crd, mtp, htk devices also use it, I have no such device, don't set it for them.

---
 .../qcom/sm8550-sony-xperia-yodo-pdx234.dts   |  5 +-
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 86 +++++++++++++++----
 2 files changed, 72 insertions(+), 19 deletions(-)
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +2 -3
index d90dc7b37..99f5fd32c 100644
@@ -673,9 +673,8 @@ cam_pwr_a_cs: cam-pwr-a-cs-state {
 };
 
 &pm8550b_eusb2_repeater {
-	qcom,tune-usb2-disc-thres = /bits/ 8 <0x6>;
-	qcom,tune-usb2-amplitude = /bits/ 8 <0xf>;
-	qcom,tune-usb2-preem = /bits/ 8 <0x7>;
+	qcom,param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;
+	qcom,host-param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;
 	vdd18-supply = <&pm8550_l15>;
 	vdd3-supply = <&pm8550_l5>;
 };
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c +70 -16

143 lines not on this page · raw message

Signature · 1 line
2.49.0
#1 lore raw
Quoted 7 lines · Pengyu Luo

In downstream tree, many registers need to be overrided, it varies from devices and platforms, not only HS trasmit amplitude(0x51), HS disconnect threshold(0x53), Tx pre-emphasis tuning(0x57).

The device I plan to upstream also uses it, so I write the patch for it (Oneplus Pad Pro / Oneplus Pad 2, sm8650-mtp based).

Quoted 8 lines

In upstream, only Sony Xperia 1 V is using this, so fixing it for sony, in downstream, some crd, mtp, htk devices also use it, I have no such device, don't set it for them.

---
 .../qcom/sm8550-sony-xperia-yodo-pdx234.dts   |  5 +-
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 86 +++++++++++++++----

DTS is always separate patch.

Quoted 7 lines
 2 files changed, 72 insertions(+), 19 deletions(-)
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +0 -0
index d90dc7b37..99f5fd32c 100644

arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts cam_pwr_a_cs: cam-pwr-a-cs-state { · line 677

Quoted 8 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +2 -3
@@ -673,9 +673,8 @@ cam_pwr_a_cs: cam-pwr-a-cs-state {
 };
 
 &pm8550b_eusb2_repeater {
-	qcom,tune-usb2-disc-thres = /bits/ 8 <0x6>;
-	qcom,tune-usb2-amplitude = /bits/ 8 <0xf>;
-	qcom,tune-usb2-preem = /bits/ 8 <0x7>;
+	qcom,param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;
+	qcom,host-param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;

There are no such properties.

It does not look like you tested the DTS against bindings. Please run make dtbs_check W=1 (see Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).
Maybe you need to update your dtschema and yamllint. Don't rely on distro packages for dtschema and be sure you are using the latest released dtschema.

Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +0 -0
 	vdd18-supply = <&pm8550_l15>;
 	vdd3-supply = <&pm8550_l5>;
 };

...

Quoted 11 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +1 -1
+
 static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr)
 {
 	int num = rptr->cfg->num_vregs;
@@ -127,20 +189,12 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr)
 static int eusb2_repeater_init(struct phy *phy)
 {
 	struct eusb2_repeater *rptr = phy_get_drvdata(phy);
-	struct device_node *np = rptr->dev->of_node;
 	struct regmap *regmap = rptr->regmap;
 	const u32 *init_tbl = rptr->cfg->init_tbl;

arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr) · line 142

Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +0 -6
-	u8 tune_usb2_preem = init_tbl[TUNE_USB2_PREEM];
-	u8 tune_hsdisc = init_tbl[TUNE_HSDISC];
-	u8 tune_iusb2 = init_tbl[TUNE_IUSB2];
 	u32 base = rptr->base;
 	u32 val;
 	int ret;
 
-	of_property_read_u8(np, "qcom,tune-usb2-amplitude", &tune_iusb2);
-	of_property_read_u8(np, "qcom,tune-usb2-disc-thres", &tune_hsdisc);
-	of_property_read_u8(np, "qcom,tune-usb2-preem", &tune_usb2_preem);

NAK, that's an ABI break.

Best regards,
Krzysztof

#2 lore raw
In reply to Pengyu Luo
Quoted 22 lines · Pengyu Luo

In downstream tree, many registers need to be overrided, it varies from devices and platforms, not only HS trasmit amplitude(0x51), HS disconnect threshold(0x53), Tx pre-emphasis tuning(0x57).

The device I plan to upstream also uses it, so I write the patch for it (Oneplus Pad Pro / Oneplus Pad 2, sm8650-mtp based).

In upstream, only Sony Xperia 1 V is using this, so fixing it for sony, in downstream, some crd, mtp, htk devices also use it, I have no such device, don't set it for them.

---
 .../qcom/sm8550-sony-xperia-yodo-pdx234.dts   |  5 +-
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 86 +++++++++++++++----
 2 files changed, 72 insertions(+), 19 deletions(-)
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +0 -0
index d90dc7b37..99f5fd32c 100644

arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts cam_pwr_a_cs: cam-pwr-a-cs-state { · line 677

Quoted 8 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +2 -3
@@ -673,9 +673,8 @@ cam_pwr_a_cs: cam-pwr-a-cs-state {
 };
 
 &pm8550b_eusb2_repeater {
-	qcom,tune-usb2-disc-thres = /bits/ 8 <0x6>;
-	qcom,tune-usb2-amplitude = /bits/ 8 <0xf>;
-	qcom,tune-usb2-preem = /bits/ 8 <0x7>;
+	qcom,param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;
+	qcom,host-param-override-seq = <0x51 0x08 0x53 0x06 0x57 0x07>;

Other than Krzysztof's comments: In upstream we describe invididual properties / overrides rather than just dumping the whole register sequence. So, using a single 'seq' property is not acceptable.

Quoted 3 lines
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts +0 -0
 	vdd18-supply = <&pm8550_l15>;
 	vdd3-supply = <&pm8550_l5>;
 };
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
In reply to Pengyu Luo
Quoted 11 lines · Pengyu Luo

In downstream tree, many registers need to be overrided, it varies from devices and platforms, not only HS trasmit amplitude(0x51), HS disconnect threshold(0x53), Tx pre-emphasis tuning(0x57).

The device I plan to upstream also uses it, so I write the patch for it (Oneplus Pad Pro / Oneplus Pad 2, sm8650-mtp based).

In upstream, only Sony Xperia 1 V is using this, so fixing it for sony, in downstream, some crd, mtp, htk devices also use it, I have no such device, don't set it for them.

Quoted 6 lines
---
 .../qcom/sm8550-sony-xperia-yodo-pdx234.dts   |  5 +-
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 86 +++++++++++++++----
 2 files changed, 72 insertions(+), 19 deletions(-)

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/v6.14-rc6-274-gf4e35e5f940c (exact match)

If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/qcom/' for [email protected]:

arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dtb: pmic@7 (qcom,pm8550): phy@fd00: 'qcom,host-param-override-seq', 'qcom,param-override-seq' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/qcom,spmi-pmic.yaml#
arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dtb: phy@fd00 (qcom,pm8550b-eusb2-repeater): 'qcom,host-param-override-seq', 'qcom,param-override-seq' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/phy/qcom,snps-eusb2-repeater.yaml#