Skip to contentSkip to conversation

phy: qualcomm: add qcom dwc3 phy

PATCH In review Ansuel Smith 3 participants 7 messages Apr 3, 2020 – Apr 15, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 phy: qualcomm: add qcom dwc3 phy

This has lost in the original push for the dwc3 qcom driver. This is needed for ipq806x SoC as without this the usb ports doesn't work at all.

---
 drivers/phy/qualcomm/Kconfig         |  12 +
 drivers/phy/qualcomm/Makefile        |   1 +
 drivers/phy/qualcomm/phy-qcom-dwc3.c | 578 +++++++++++++++++++++++++++
 3 files changed, 591 insertions(+)
 create mode 100644 drivers/phy/qualcomm/phy-qcom-dwc3.c
drivers/phy/qualcomm/Kconfig +12 -0
index e46824da29f6..3d45a9156f85 100644
@@ -91,3 +91,15 @@ config PHY_QCOM_USB_HSIC
 	select GENERIC_PHY
 	help
 	  Support for the USB HSIC ULPI compliant PHY on QCOM chipsets.
+
+config PHY_QCOM_DWC3
+	tristate "QCOM DWC3 USB PHY support"
+	depends on ARCH_QCOM
+	depends on HAS_IOMEM
+	depends on OF
+	select GENERIC_PHY
+	help
+	  This option enables support for the Synopsis PHYs present inside the
+	  Qualcomm USB3.0 DWC3 controller.  This driver supports both HS and SS
+	  PHY controllers.
+
drivers/phy/qualcomm/Makefile +1 -0
index 283251d6a5d9..04c5a8da941a 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_PHY_QCOM_UFS_14NM)		+= phy-qcom-ufs-qmp-14nm.o
 obj-$(CONFIG_PHY_QCOM_UFS_20NM)		+= phy-qcom-ufs-qmp-20nm.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_DWC3)		+= phy-qcom-dwc3.o
drivers/phy/qualcomm/phy-qcom-dwc3.c new file +578 -0

578 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 devicetree: bindings: phy: Document dwc3 qcom phy

Document dwc3 qcom phy hs and ss phy bindings needed to correctly inizialize and use usb on ipq806x SoC

---
 .../bindings/phy/qcom,dwc3-hs-usb-phy.yaml    | 65 +++++++++++++++++++
 .../bindings/phy/qcom,dwc3-ss-usb-phy.yaml    | 65 +++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml new file +65 -0
new file mode 100644
index 000000000000..0bb59e3c2ab8
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,dwc3-hs-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm DWC3 HS PHY CONTROLLER
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  DWC3 PHY nodes are defined to describe on-chip Synopsis Physical layer
+  controllers. Each DWC3 PHY controller should have its own node.
+
+properties:
+  compatible:
+    const: qcom,dwc3-hs-usb-phy
+
+  "#phy-cells":
+    const: 0
+
+  regmap:
+    maxItems: 1
+    description: phandle to usb3 dts definition
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    description: |
+      - "ref" Is required
+      - "xo"	Optional external reference clock
+    items:
+      - const: ref
+      - const: xo
+
+required:
+  - compatible
+  - "#phy-cells"
+  - regmap
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    hs_phy_0: hs_phy_0 {
+      compatible = "qcom,dwc3-hs-usb-phy";
+      regmap = <&usb3_0>;
+      clocks = <&gcc USB30_0_UTMI_CLK>;
+      clock-names = "ref";
+      #phy-cells = <0>;
+    };
+
+    usb3_0: usb3@110f8800 {
+      compatible = "qcom,dwc3", "syscon";
+      reg = <0x110f8800 0x8000>;
+
+      /* ... */
+    };
Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 2/2] devicetree: bindings: phy: Document dwc3 qcom phy

Quoted 61 lines · Ansuel Smith

Document dwc3 qcom phy hs and ss phy bindings needed to correctly inizialize and use usb on ipq806x SoC

---
 .../bindings/phy/qcom,dwc3-hs-usb-phy.yaml    | 65 +++++++++++++++++++
 .../bindings/phy/qcom,dwc3-ss-usb-phy.yaml    | 65 +++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml new file +44 -0
new file mode 100644
index 000000000000..0bb59e3c2ab8
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,dwc3-hs-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm DWC3 HS PHY CONTROLLER
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  DWC3 PHY nodes are defined to describe on-chip Synopsis Physical layer
+  controllers. Each DWC3 PHY controller should have its own node.
+
+properties:
+  compatible:
+    const: qcom,dwc3-hs-usb-phy
+
+  "#phy-cells":
+    const: 0
+
+  regmap:
+    maxItems: 1
+    description: phandle to usb3 dts definition
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    description: |
+      - "ref" Is required
+      - "xo"	Optional external reference clock
+    items:
+      - const: ref
+      - const: xo
+
+required:
+  - compatible
+  - "#phy-cells"
+  - regmap

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml line 54

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml new file +10 -0
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    hs_phy_0: hs_phy_0 {
+      compatible = "qcom,dwc3-hs-usb-phy";
+      regmap = <&usb3_0>;

If the registers for the phy are part of 'qcom,dwc3' then make this node a child of it.

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml line 64

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml new file +10 -0
+      clocks = <&gcc USB30_0_UTMI_CLK>;
+      clock-names = "ref";
+      #phy-cells = <0>;
+    };
+
+    usb3_0: usb3@110f8800 {
+      compatible = "qcom,dwc3", "syscon";
+      reg = <0x110f8800 0x8000>;
+
+      /* ... */

Incomplete examples should or will fail validation.

Quoted 1 line
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml new file +1 -0
+    };
#3 lore raw

R: [PATCH 2/2] devicetree: bindings: phy: Document dwc3 qcom phy

Quoted 75 lines · Ansuel Smith
Quoted 6 lines

Document dwc3 qcom phy hs and ss phy bindings needed to correctly inizialize and use usb on ipq806x SoC

---
 .../bindings/phy/qcom,dwc3-hs-usb-phy.yaml    | 65

+++++++++++++++++++

Quoted 1 line
 .../bindings/phy/qcom,dwc3-ss-usb-phy.yaml    | 65

+++++++++++++++++++

Quoted 2 lines
 2 files changed, 130 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml

Quoted 1 line
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml

Review

Quoted 2 lines
(quoted diff) +0 -0

phy.yaml b/Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- phy.yaml

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-

Quoted 4 lines

new file mode 100644
index 000000000000..0bb59e3c2ab8

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +0 -0

phy.yaml

Quoted 4 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +3 -0
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 13

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +10 -0
+$id: http://devicetree.org/schemas/phy/qcom,dwc3-hs-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm DWC3 HS PHY CONTROLLER
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  DWC3 PHY nodes are defined to describe on-chip Synopsis Physical

layer

Quoted 36 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +36 -0
+  controllers. Each DWC3 PHY controller should have its own node.
+
+properties:
+  compatible:
+    const: qcom,dwc3-hs-usb-phy
+
+  "#phy-cells":
+    const: 0
+
+  regmap:
+    maxItems: 1
+    description: phandle to usb3 dts definition
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    description: |
+      - "ref" Is required
+      - "xo"	Optional external reference clock
+    items:
+      - const: ref
+      - const: xo
+
+required:
+  - compatible
+  - "#phy-cells"
+  - regmap
+  - clocks
+  - clock-names
+
+examples:
+  - |
Quoted 9 lines

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 54

Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +5 -0
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    hs_phy_0: hs_phy_0 {
+      compatible = "qcom,dwc3-hs-usb-phy";
+      regmap = <&usb3_0>;

If the registers for the phy are part of 'qcom,dwc3' then make this node a child of it.

Making this node a child of qcom,dwc3 cause malfunction of the driver.

Quoted 14 lines

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 64

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +10 -0
+      clocks = <&gcc USB30_0_UTMI_CLK>;
+      clock-names = "ref";
+      #phy-cells = <0>;
+    };
+
+    usb3_0: usb3@110f8800 {
+      compatible = "qcom,dwc3", "syscon";
+      reg = <0x110f8800 0x8000>;
+
+      /* ... */

Incomplete examples should or will fail validation.

Quoted 1 line
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +1 -0
+    };
maintainer
#4 lore raw

Re: [PATCH 2/2] devicetree: bindings: phy: Document dwc3 qcom phy

Quoted 86 lines · On Wed, Apr 15, 2020 at 7:26 AM <[email protected]> wrote:
Quoted 76 lines · Ansuel Smith
Quoted 6 lines

Document dwc3 qcom phy hs and ss phy bindings needed to correctly inizialize and use usb on ipq806x SoC

---
 .../bindings/phy/qcom,dwc3-hs-usb-phy.yaml    | 65

+++++++++++++++++++

Quoted 1 line
 .../bindings/phy/qcom,dwc3-ss-usb-phy.yaml    | 65

+++++++++++++++++++

Quoted 2 lines
 2 files changed, 130 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml

Quoted 1 line
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml

Review

Quoted 2 lines
(quoted diff) +0 -0

phy.yaml b/Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- phy.yaml

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-

Quoted 4 lines

new file mode 100644
index 000000000000..0bb59e3c2ab8

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +0 -0

phy.yaml

Quoted 4 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +3 -0
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 13

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +10 -0
+$id: http://devicetree.org/schemas/phy/qcom,dwc3-hs-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm DWC3 HS PHY CONTROLLER
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  DWC3 PHY nodes are defined to describe on-chip Synopsis Physical

layer

Quoted 36 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +36 -0
+  controllers. Each DWC3 PHY controller should have its own node.
+
+properties:
+  compatible:
+    const: qcom,dwc3-hs-usb-phy
+
+  "#phy-cells":
+    const: 0
+
+  regmap:
+    maxItems: 1
+    description: phandle to usb3 dts definition
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    description: |
+      - "ref" Is required
+      - "xo"       Optional external reference clock
+    items:
+      - const: ref
+      - const: xo
+
+required:
+  - compatible
+  - "#phy-cells"
+  - regmap
+  - clocks
+  - clock-names
+
+examples:
+  - |
Quoted 9 lines

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 54

Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +5 -0
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    hs_phy_0: hs_phy_0 {
+      compatible = "qcom,dwc3-hs-usb-phy";
+      regmap = <&usb3_0>;

If the registers for the phy are part of 'qcom,dwc3' then make this node a child of it.

Quoted 1 line

Making this node a child of qcom,dwc3 cause malfunction of the driver.

Fix the driver then.

Rob

#5 lore raw

R: [PATCH 2/2] devicetree: bindings: phy: Document dwc3 qcom phy

Quoted 90 lines · On Wed, Apr 15, 2020 at 7:26 AM <[email protected]> wrote:
Quoted 10 lines
Quoted 10 lines · Ansuel Smith
Quoted 6 lines

Document dwc3 qcom phy hs and ss phy bindings needed to correctly inizialize and use usb on ipq806x SoC

---
 .../bindings/phy/qcom,dwc3-hs-usb-phy.yaml    | 65

+++++++++++++++++++

Quoted 1 line
 .../bindings/phy/qcom,dwc3-ss-usb-phy.yaml    | 65
Quoted 8 lines
Quoted 8 lines

+++++++++++++++++++

Quoted 2 lines
 2 files changed, 130 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-phy.yaml

Quoted 1 line
 create mode 100644

Documentation/devicetree/bindings/phy/qcom,dwc3-ss-usb-phy.yaml

Review

Quoted 2 lines
(quoted diff) +0 -0

usb-

Quoted 1 line
Quoted 1 line

phy.yaml b/Documentation/devicetree/bindings/phy/qcom,dwc3-hs-

usb-

Quoted 11 lines
Quoted 11 lines

phy.yaml

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb-

Quoted 4 lines

new file mode 100644
index 000000000000..0bb59e3c2ab8

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +0 -0

phy.yaml

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 4

Quoted 5 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +4 -0
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,dwc3-hs-usb-

phy.yaml#

Quoted 56 lines
Quoted 55 lines

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 13

Quoted 9 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +9 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm DWC3 HS PHY CONTROLLER
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  DWC3 PHY nodes are defined to describe on-chip Synopsis Physical

layer

Quoted 31 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +31 -0
+  controllers. Each DWC3 PHY controller should have its own node.
+
+properties:
+  compatible:
+    const: qcom,dwc3-hs-usb-phy
+
+  "#phy-cells":
+    const: 0
+
+  regmap:
+    maxItems: 1
+    description: phandle to usb3 dts definition
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    description: |
+      - "ref" Is required
+      - "xo"       Optional external reference clock
+    items:
+      - const: ref
+      - const: xo
+
+required:
+  - compatible
+  - "#phy-cells"
+  - regmap

Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- line 54

Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,dwc3-hs-usb- new file +10 -0
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    hs_phy_0: hs_phy_0 {
+      compatible = "qcom,dwc3-hs-usb-phy";
+      regmap = <&usb3_0>;

If the registers for the phy are part of 'qcom,dwc3' then make this node a child of it.

Quoted 5 lines
Quoted 1 line

Making this node a child of qcom,dwc3 cause malfunction of the driver.

Fix the driver then.

Rob

Sorry if i bother you but I checked every other usb driver that also needs phy node. I use regmap phandle here just for the fact that it's the same reg of dwc3. Others use directly the same reg and are outside their dwc3 usb node. I think I will follow this path and respin this. I really hope you are good with this.

#6 lore raw
In reply to Ansuel Smith

Hi,

Quoted 18 lines · Ansuel Smith

This has lost in the original push for the dwc3 qcom driver. This is needed for ipq806x SoC as without this the usb ports doesn't work at all.

---
 drivers/phy/qualcomm/Kconfig         |  12 +
 drivers/phy/qualcomm/Makefile        |   1 +
 drivers/phy/qualcomm/phy-qcom-dwc3.c | 578 +++++++++++++++++++++++++++
 3 files changed, 591 insertions(+)
 create mode 100644 drivers/phy/qualcomm/phy-qcom-dwc3.c
drivers/phy/qualcomm/Kconfig +0 -0
index e46824da29f6..3d45a9156f85 100644

drivers/phy/qualcomm/Kconfig config PHY_QCOM_USB_HSIC · line 95

Quoted 5 lines
drivers/phy/qualcomm/Kconfig +2 -0
@@ -91,3 +91,15 @@ config PHY_QCOM_USB_HSIC
 	select GENERIC_PHY
 	help
 	  Support for the USB HSIC ULPI compliant PHY on QCOM chipsets.
+
+config PHY_QCOM_DWC3

Please rename to PHY_QCOM_IPQ806X_USB

drivers/phy/qualcomm/Kconfig config PHY_QCOM_USB_HSIC · line 104

Quoted 9 lines
drivers/phy/qualcomm/Kconfig +9 -0
+	tristate "QCOM DWC3 USB PHY support"
+	depends on ARCH_QCOM
+	depends on HAS_IOMEM
+	depends on OF
+	select GENERIC_PHY
+	help
+	  This option enables support for the Synopsis PHYs present inside the
+	  Qualcomm USB3.0 DWC3 controller.  This driver supports both HS and SS
+	  PHY controllers.

Please mention that driver supports only IPQ806x, as it can't  be used for all QCOM phy and dwc3 controllers wrappers.

drivers/phy/qualcomm/phy-qcom-dwc3.c

Quoted 15 lines
drivers/phy/qualcomm/Kconfig +1 -0
+
drivers/phy/qualcomm/Makefile +1 -0
index 283251d6a5d9..04c5a8da941a 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_PHY_QCOM_UFS_14NM)		+= phy-qcom-ufs-qmp-14nm.o
 obj-$(CONFIG_PHY_QCOM_UFS_20NM)		+= phy-qcom-ufs-qmp-20nm.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_DWC3)		+= phy-qcom-dwc3.o
drivers/phy/qualcomm/phy-qcom-dwc3.c new file +0 -0
new file mode 100644
index 000000000000..f33da199ddde

Rename to phy-qcom-ip806x-usb.c

Please also add qcom_ipq806x_usb as prefix in the function names and structures etc.

Quoted 2 lines
drivers/phy/qualcomm/phy-qcom-dwc3.c new file +0 -0
@@ -0,0 +1,578 @@
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project