Skip to contentSkip to conversation

sm8550: Add support for eUSB2 repeater

PATCH Superseded Abel Vesa 2 participants 10 messages Feb 7, 2023 – Feb 8, 2023

Subsystems (5)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Abel Vesa

author
#0 lore raw

v4 cover sm8550: Add support for eUSB2 repeater

This patchset adds support for the eUSB2 repeater found in pmic PM8550B, used along with SM8550. Since there is no dedicated generic framework for eUSB2 repeaters, the most appropriate subsystem to model it is the generic phy. This patchset also adds support for such repeater to the eUSB2 PHY found in SM8550. Basically, the eUSB2 PHY will have its own "phy" which is actually a repeater.

This patchset is based on the following patchset:
https://lore.kernel.org/all/[email protected]

Changes since v3:
* This time is a normal patchset, rather than an RFC
* reversed the order of patches 1 and 2, in order to make the repeater schema available for the pmic schema update

Changes since v2:
* moved the bindings qcom,spmi-pmic patch before the repeater schema patch in order to avoid the repeater schema validation failure due to phy pattern property not being found in qcom,spmi-pmic schema

Changes since v1:
* the repeater driver is implemented now as a PHY rather than adding a new generic framework for USB repeaters

Abel Vesa (5):
dt-bindings: phy: Add qcom,snps-eusb2-repeater schema file
dt-bindings: mfd: qcom,spmi-pmic: Add pattern property for phy
dt-bindings: phy: qcom,snps-eusb2-phy: Add phys property for the
repeater
phy: qcom: Add QCOM SNPS eUSB2 repeater driver
arm64: dts: qcom: sm8550-mtp: Add eUSB2 repeater node

Neil Armstrong (2):
phy: qcom: phy-qcom-snps-eusb2: Add support for eUSB2 repeater
arm64: dts: qcom: pm8550b: Add eUSB2 repeater node

 .../bindings/mfd/qcom,spmi-pmic.yaml          |   4 +
 .../bindings/phy/qcom,snps-eusb2-phy.yaml     |   5 +
 .../phy/qcom,snps-eusb2-repeater.yaml         |  48 ++++
 arch/arm64/boot/dts/qcom/pm8550b.dtsi         |   6 +
 arch/arm64/boot/dts/qcom/sm8550-mtp.dts       |   7 +
 drivers/phy/qualcomm/Kconfig                  |   9 +
 drivers/phy/qualcomm/Makefile                 |   1 +
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 259 ++++++++++++++++++
 drivers/phy/qualcomm/phy-qcom-snps-eusb2.c    |  19 +-
 9 files changed, 357 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml
 create mode 100644 drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
Signature · 7 lines
2.34.1


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

PATCH v4 1/7 dt-bindings: phy: Add qcom,snps-eusb2-repeater schema file

The SM8550 SoC uses Synopsis eUSB2 repeater found in PM8550b. Add a dt-binding schema for the new driver.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* made this patch the first one in the series to fix the binding check for the 2nd patch.
* dropped the compatible for pmic in the example. This is due to the dependency between this patch and the next one.

 .../phy/qcom,snps-eusb2-repeater.yaml         | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml new file +48 -0
new file mode 100644
index 000000000000..54afab7e21fb
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,snps-eusb2-repeater.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Synopsis eUSB2 to USB 2.0 repeater
+
+maintainers:
+  - Abel Vesa <[email protected]>
+
+properties:
+  compatible:
+    const: qcom,pm8550b-eusb2-repeater
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  vdd18-supply: true
+
+  vdd3-supply: true
+
+required:
+  - compatible
+  - reg
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/spmi/spmi.h>
+
+    pmic@7 {
+      reg = <0x7 SPMI_USID>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pm8550b_eusb2_repeater: phy@fd00 {
+        compatible = "qcom,pm8550b-eusb2-repeater";
+        reg = <0xfd00>;
+        #phy-cells = <0>;
+      };
+    };
+...
Signature · 7 lines
2.34.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Reviewed-by on v4 1/7
#2 lore raw

Re: [PATCH v4 1/7] dt-bindings: phy: Add qcom,snps-eusb2-repeater schema file

Quoted 26 lines · Abel Vesa

The SM8550 SoC uses Synopsis eUSB2 repeater found in PM8550b. Add a dt-binding schema for the new driver.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* made this patch the first one in the series to fix the binding check for the 2nd patch.
* dropped the compatible for pmic in the example. This is due to the dependency between this patch and the next one.

 .../phy/qcom,snps-eusb2-repeater.yaml         | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml new file +1 -0
new file mode 100644
index 000000000000..54afab7e21fb
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)

Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml line 11

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-repeater.yaml new file +10 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,snps-eusb2-repeater.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Synopsis eUSB2 to USB 2.0 repeater
+
+maintainers:
+  - Abel Vesa <[email protected]>
+

It would be really nice to have here "description:" with few words what this repeater is and what it does.

Anyway:

Best regards,
Krzysztof

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author
#3 lore raw

PATCH v4 2/7 dt-bindings: mfd: qcom,spmi-pmic: Add pattern property for phy

In reply to Abel Vesa

The phy pattern property will be used for providing eUSB2 repeater functionality. This will be modelled as a Qualcomm PHY driver.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* made this the second patch rather than the first in the series

 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml +4 -0
index adf88245c409..1e6fadec1301 100644
@@ -135,6 +135,10 @@ patternProperties:
     type: object
     $ref: /schemas/pinctrl/qcom,pmic-gpio.yaml#
 
+  "phy@[0-9a-f]+$":
+    type: object
+    $ref: /schemas/phy/qcom,snps-eusb2-repeater.yaml#
+
   "pon@[0-9a-f]+$":
     type: object
     $ref: /schemas/power/reset/qcom,pon.yaml#
Signature · 7 lines
2.34.1


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

PATCH v4 3/7 dt-bindings: phy: qcom,snps-eusb2-phy: Add phys property for the repeater

In reply to Abel Vesa

The phys property is used for allowing the eusb2 to interface with the repeater, which is modelled as a phy driver.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* dropped the phy-names property and changed the commit message accordingly

 .../devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml         | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml +5 -0
index de72577e34a4..c53bab107b6d 100644
@@ -33,6 +33,11 @@ properties:
   resets:
     maxItems: 1
 
+  phys:
+    maxItems: 1
+    description:
+      Phandle to eUSB2 to USB 2.0 repeater
+
   vdd-supply:
     description:
       Phandle to 0.88V regulator supply to PHY digital circuit.
Signature · 7 lines
2.34.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Acked-by on v4 3/7
#5 lore raw

Re: [PATCH v4 3/7] dt-bindings: phy: qcom,snps-eusb2-phy: Add phys property for the repeater

Quoted 4 lines · Abel Vesa

The phys property is used for allowing the eusb2 to interface with the repeater, which is modelled as a phy driver.

Best regards,
Krzysztof

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author
#6 lore raw

PATCH v4 4/7 phy: qcom: Add QCOM SNPS eUSB2 repeater driver

In reply to Abel Vesa

PM8550B contains a eUSB2 repeater used for making the eUSB2 from SM8550 USB 2.0 compliant. This can be modelled SW-wise as a Phy. So add a new phy driver for it.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* fixed all indentation issues and dropped a few blank lines to pass checkpatch
* dropped shift defines as they were not used
* dropped the repeater_mode as it was not used
* dropped the of_node_get and of_node_put for of_node
* dropped the comment related to regulators in eusb2_repeater_cfg, like Vinod suggested
* dropped the initialization of ret in eusb2_repeater_init

 drivers/phy/qualcomm/Kconfig                  |   9 +
 drivers/phy/qualcomm/Makefile                 |   1 +
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 259 ++++++++++++++++++
 3 files changed, 269 insertions(+)
 create mode 100644 drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
drivers/phy/qualcomm/Kconfig +9 -0
index 513322cdf83c..4850d48f31fa 100644
@@ -121,6 +121,15 @@ config PHY_QCOM_SNPS_EUSB2
 	  chipsets. The PHY is paired with a Synopsys DWC3 USB controller
 	  on Qualcomm SOCs.
 
+config PHY_QCOM_EUSB2_REPEATER
+	tristate "Qualcomm SNPS eUSB2 Repeater Driver"
+	depends on OF && (ARCH_QCOM || COMPILE_TEST)
+	select GENERIC_PHY
+	help
+	  Enable support for the USB high-speed SNPS eUSB2 repeater on Qualcomm
+	  PMICs. The repeater is paired with a Synopsys eUSB2 Phy
+	  on Qualcomm SOCs.
+
 config PHY_QCOM_USB_HS
 	tristate "Qualcomm USB HS PHY module"
 	depends on USB_ULPI_BUS
drivers/phy/qualcomm/Makefile +1 -0
index b2c01665622b..de3dc9ccf067 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_PHY_QCOM_QMP_USB)		+= phy-qcom-qmp-usb.o
 
 obj-$(CONFIG_PHY_QCOM_QUSB2)		+= phy-qcom-qusb2.o
 obj-$(CONFIG_PHY_QCOM_SNPS_EUSB2)	+= phy-qcom-snps-eusb2.o
+obj-$(CONFIG_PHY_QCOM_EUSB2_REPEATER)	+= phy-qcom-eusb2-repeater.o
 obj-$(CONFIG_PHY_QCOM_USB_HS) 		+= phy-qcom-usb-hs.o
 obj-$(CONFIG_PHY_QCOM_USB_HSIC) 	+= phy-qcom-usb-hsic.o
 obj-$(CONFIG_PHY_QCOM_USB_HS_28NM)	+= phy-qcom-usb-hs-28nm.o
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c new file +259 -0

259 lines not on this page · raw message

Signature · 7 lines
2.34.1


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

PATCH v4 5/7 phy: qcom: phy-qcom-snps-eusb2: Add support for eUSB2 repeater

In reply to Abel Vesa

From: Neil Armstrong <[email protected]>

For USB 2.0 compliance, eUSB2 needs a repeater. The PHY needs to initialize and reset it. So add repeater support

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* none

 drivers/phy/qualcomm/phy-qcom-snps-eusb2.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-snps-eusb2.c +18 -1
index 23ec162cc3bd..703e2f23ea00 100644
@@ -128,6 +128,8 @@ struct qcom_snps_eusb2_hsphy {
 	struct regulator_bulk_data vregs[EUSB2_NUM_VREGS];
 
 	enum phy_mode mode;
+
+	struct phy *repeater;
 };
 
 static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode)
@@ -136,7 +138,7 @@ static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int
 
 	phy->mode = mode;
 
-	return 0;
+	return phy_set_mode_ext(phy->repeater, mode, submode);
 }
 
 static void qcom_snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset,
@@ -235,6 +237,12 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p)
 	if (ret)
 		return ret;
 
+	ret = phy_init(phy->repeater);
+	if (ret) {
+		dev_err(&p->dev, "repeater init failed. %d\n", ret);
+		goto disable_vreg;
+	}
+
 	ret = clk_prepare_enable(phy->ref_clk);
 	if (ret) {
 		dev_err(&p->dev, "failed to enable ref clock, %d\n", ret);
@@ -342,6 +350,8 @@ static int qcom_snps_eusb2_hsphy_exit(struct phy *p)
 
 	regulator_bulk_disable(ARRAY_SIZE(phy->vregs), phy->vregs);
 
+	phy_exit(phy->repeater);
+
 	return 0;
 }
 
@@ -355,6 +365,7 @@ static const struct phy_ops qcom_snps_eusb2_hsphy_ops = {
 static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
 	struct qcom_snps_eusb2_hsphy *phy;
 	struct phy_provider *phy_provider;
 	struct phy *generic_phy;
@@ -386,6 +397,12 @@ static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret,
 				     "failed to get regulator supplies\n");
+
+	phy->repeater = devm_of_phy_get_by_index(dev, np, 0);
+	if (IS_ERR(phy->repeater))
+		return dev_err_probe(dev, PTR_ERR(phy->repeater),
+				     "failed to get repeater\n");
+
 	generic_phy = devm_phy_create(dev, NULL, &qcom_snps_eusb2_hsphy_ops);
 	if (IS_ERR(generic_phy)) {
 		dev_err(dev, "failed to create phy %d\n", ret);
Signature · 7 lines
2.34.1


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

PATCH v4 6/7 arm64: dts: qcom: pm8550b: Add eUSB2 repeater node

In reply to Abel Vesa

From: Neil Armstrong <[email protected]>

Add nodes for the eUSB2 repeater found on the pm8550b SPMI PMIC.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* none

 arch/arm64/boot/dts/qcom/pm8550b.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8550b.dtsi +6 -0
index 16bcfb64d735..72609f31c890 100644
@@ -55,5 +55,11 @@ pm8550b_gpios: gpio@8800 {
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8550b_eusb2_repeater: phy@fd00 {
+			compatible = "qcom,pm8550b-eusb2-repeater";
+			reg = <0xfd00>;
+			#phy-cells = <0>;
+		};
 	};
 };
Signature · 7 lines
2.34.1


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

PATCH v4 7/7 arm64: dts: qcom: sm8550-mtp: Add eUSB2 repeater node

In reply to Abel Vesa

Add the PMIC eUSB2 repeater node and add the usb-repeater property to the eUSB2 PHY to allow it to be controlled by the PHY driver.

---

The v3 (rfc) is here:
https://lore.kernel.org/all/[email protected]/

Changes since v3:
* Dropped the phy-names property from usb_1_hsphy, like Dmitry suggested

 arch/arm64/boot/dts/qcom/sm8550-mtp.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/qcom/sm8550-mtp.dts +7 -0
index 56aab7cafcbc..6b6ec0fe5e5e 100644
@@ -457,6 +457,11 @@ sdc2_card_det_n: sdc2-card-det-state {
 	};
 };
 
+&pm8550b_eusb2_repeater {
+	vdd18-supply = <&vreg_l15b_1p8>;
+	vdd3-supply = <&vreg_l5b_3p1>;
+};
+
 &qupv3_id_0 {
 	status = "okay";
 };
@@ -563,6 +568,8 @@ &usb_1_hsphy {
 	vdd-supply = <&vreg_l1e_0p88>;
 	vdda12-supply = <&vreg_l3e_1p2>;
 
+	phys = <&pm8550b_eusb2_repeater>;
+
 	status = "okay";
 };
 
Signature · 7 lines
2.34.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy