Skip to contentSkip to conversation

Add JH7110 USB and USB PHY driver support

PATCH Superseded Minda Chen 3 participants 20 messages Apr 6, 2023 – Apr 19, 2023

Subsystems (9)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Minda Chen

author maintainer
#0 lore raw

v4 cover Add JH7110 USB and USB PHY driver support

This patchset adds USB driver and USB PHY for the StarFive JH7110 SoC. USB work mode is peripheral and using USB 2.0 PHY in VisionFive 2 board. The patch has been tested on the VisionFive 2 board.

This patchset should be applied after the patchset [1], [2] and[3]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is usb phy dt-binding document.
patch 2 is Pcie PHY dt-binding document.
patch 3 is USB 2.0 PHY driver.
patch 4 is PCIe PHY driver.
patch 5 is usb dt-binding document.
patch 6 is the wrapper module driver of Cadence USB3. USB controller IP is Cadence USB3. patch 7 is USB device tree configuration.

previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v2: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v3: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

changes
v4:
1. (patch 1) split PCIe PHY dt-binding doc to patch 2.
2. (patch 2) PCIe PHY add stg and sys con configuration to dt-binding doc.
3. (patch 3)
- split PCIe PHY driver to patch 4.
- replace dr_mode to phy mode in jh7110_usb2_phy.
4. (patch 4)
- Makefile and Kconfig sorted by alphabet sequence.
- Add PCIe PHY stg and syscon PHY connection configuration for USB 3.0.
5. (patch 5)
- commit message changed.
- merge wrapper dts node and cdns3 node in example.
- Add interrupts, reg, phy and dr_mode in property.
- Add reset-name in property example.
6. (patch 6)
- For dts node is merged, Using platform_device_alloc and platform_device_add to generate cadence sub device.
- IOMEM and IRQ resource are passed to Cadence sub device.
- Add PHY ops process for PHY dts setting can not be passed to Cadence USB driver.
- remove the stg and sys USB 3.0 PHY configuration.
- Change the suspend clock reset and clock enable sequence.
- Get all reset and clock resources before enable them in cdns_clk_rst_init.
- commit message changed.
7. (patch 7)
- merge wrapper dts node and cdns3 node in usb dts.
- move the stg and sys USB 3.0 PHY confiuration to
PCIe PHY dts node.
- commit message changed.
- Add reset-names dts.

v3:
1. Add patch 1 - 4. Add USB PHY driver and dt-binding doc. USB PHY codes are moved to patch 3 and patch 4.
2. (patch 5)
- USB wrapper module dts document is moved to usb directory.
- Remove the 'dr_mode' and 'starfive,usb2-only' setting.
- Some dts format changes. dts binding check pass.
3. (patch 6)
- Remove the PHY codes.
- Search 'dr_mode' and phy setting from Cadence subnode.
4. (patch 7)
- Add USB PHY dts configurion.
- 'dr_mode' is moved to Cadence controller submode.

v2:
1. (patch 5) dt-binding changes. The document example is the same as dts config.
2. (patch 6) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 7) dts nodes sorted by the address after @

Minda Chen (7):
dt-bindings: phy: Add StarFive JH7110 USB document
dt-bindings: phy: Add StarFive JH7110 PCIe document
phy: starfive: add JH7110 USB 2.0 PHY driver.
phy: starfive: add JH7110 PCIE 2.0 PHY driver.
dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas
usb: cdns3: add StarFive JH7110 USB driver.
riscv: dts: starfive: add USB dts configuration for JH7110

 .../phy/starfive,jh7110-pcie-phy.yaml         |  58 +++
 .../bindings/phy/starfive,jh7110-usb-phy.yaml |  50 +++
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 +++++++
 MAINTAINERS                                   |  16 +
 .../jh7110-starfive-visionfive-2.dtsi         |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  44 ++
 drivers/phy/starfive/Kconfig                  |  22 +
 drivers/phy/starfive/Makefile                 |   2 +
 drivers/phy/starfive/phy-jh7110-pcie.c        | 197 +++++++++
 drivers/phy/starfive/phy-jh7110-usb.c         | 161 ++++++++
 drivers/usb/cdns3/Kconfig                     |  11 +
 drivers/usb/cdns3/Makefile                    |   1 +
 drivers/usb/cdns3/cdns3-starfive.c            | 378 ++++++++++++++++++
 drivers/usb/cdns3/core.h                      |   3 +
 14 files changed, 1086 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7
prerequisite-patch-id: bb939c0c7c26b08addfccd890f9d3974b6eaec53
prerequisite-patch-id: 8a6f135bcabdad4a4bfb21f0c6a0ffd2bb57efe7
prerequisite-patch-id: c2366f993a9d85e28c06d8d09f064dd5e8b29a61
prerequisite-patch-id: 50d53a21f91f4087fc80b6f1f72864adfb0002b9
prerequisite-patch-id: 0df3703af91c30f1ca2c47f5609012f2d7200028
prerequisite-patch-id: 89f049f951e5acf75aab92541992f816fd0acc0d
prerequisite-patch-id: 551fae54377090044c3612fca9740a9b359abdd2
prerequisite-patch-id: c7fdf904f398d478f0ed6d57eb878982bc73329d
prerequisite-patch-id: 1b2d0982b18da060c82134f05bf3ce16425bac8d
prerequisite-patch-id: 090ba4b78d47bc19204916e76fdbc70021785388
prerequisite-patch-id: a5d9e0f7d4f8163f566678894cf693015119f2d9
prerequisite-patch-id: 4637a8fa2334a45fa6b64351f4e9e28d3e2d60d3
prerequisite-patch-id: 32647ec60a3b614e1c59ec8e54cb511ae832c22f
prerequisite-patch-id: aa06658ecf89c92d0dfdd6a4ba6d9e6e67532971
prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f
prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9
prerequisite-patch-id: dbb0c0151b8bdf093e6ce79fd2fe3f60791a6e0b
prerequisite-patch-id: e7773c977a7b37692e9792b21cc4f17fa58f9215
prerequisite-patch-id: d57e95d31686772abc4c4d5aa1cadc344dc293cd
prerequisite-patch-id: 9f911969d0a550648493952c99096d26e05d4d83
prerequisite-patch-id: 41eddeabff082d08a76d8da523f90da4b5218d28
prerequisite-patch-id: 2ddada18ab6ea5cd1da14212aaf59632f5203d40
prerequisite-patch-id: 398744c61913c76a35754de867c4f820ca7a8d99
prerequisite-patch-id: 1a2c49c1cf81607f062f35898457037d86598cf9
prerequisite-patch-id: f59269382164b5d642a5e10443ca447f5caa595c
prerequisite-patch-id: 1babe83d6bf999bad17584dc595480f9070a5369
prerequisite-patch-id: d95ea69f88a048ef702dceed0f2edee31e6fdfd2
prerequisite-patch-id: 77be3d122d66df813f13088141ce27b21107a341
prerequisite-patch-id: 9fbb7ad1dd258bb8ff5946c4a0e59de4bfd82a04
prerequisite-patch-id: a02411a8fe009acc0888e4a7d60233c9ee5a1e71
prerequisite-patch-id: 6f6984916dffd0cc66aa733c9b6bd3a55495a50c
prerequisite-patch-id: 584c256c9acb52ee2773d0c81c3f4977fc18155a
prerequisite-patch-id: b37ac15032973e1fcd918f157c82a0606775c9e9
prerequisite-patch-id: 999c243dca89d56d452aa52ea3e181358b5c1d80
prerequisite-patch-id: ca653566085079839fb3dc1e722effafbc8109a4
prerequisite-patch-id: 2fe72c216673efe690db54cbf500ba7f15e6247a
prerequisite-patch-id: 776afb78743657e4a6bfebd2cd8a44c5c9017ee2
prerequisite-patch-id: c9b92e6d1531d0a9fb122d9d038cc3d9df380e0f

Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v4 1/7 dt-bindings: phy: Add StarFive JH7110 USB document

Add StarFive JH7110 SoC USB 2.0 PHY dt-binding.

---
 .../bindings/phy/starfive,jh7110-usb-phy.yaml | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +50 -0
new file mode 100644
index 000000000000..80604dfe01f0
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/starfive,jh7110-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive USB 2.0 PHY
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-usb-phy
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  clocks:
+    items:
+      - description: usb 125m clock
+      - description: app 125m clock
+
+  clock-names:
+    items:
+      - const: 125m
+      - const: app_125
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    phy@10200000 {
+      compatible = "starfive,jh7110-usb-phy";
+      reg = <0x10200000 0x10000>;
+      clocks = <&syscrg 95>,
+               <&stgcrg 6>;
+      clock-names = "125m", "app_125";
+      #phy-cells = <0>;
+    };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v4 1/7] dt-bindings: phy: Add StarFive JH7110 USB document

Quoted 1 line · Minda Chen

Add StarFive JH7110 SoC USB 2.0 PHY dt-binding.

Not much improvements in the subject. I asked to drop, not replace document with document.

"Add StarFive JH7110 USB PHY"

Quoted 13 lines
---
 .../bindings/phy/starfive,jh7110-usb-phy.yaml | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +0 -0
new file mode 100644
index 000000000000..80604dfe01f0

Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +7 -0
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/starfive,jh7110-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive USB 2.0 PHY

Missing model name.

Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 11

Quoted 4 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +4 -0
+
+maintainers:
+  - Minda Chen <[email protected]>
+

Best regards,
Krzysztof

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

PATCH v4 2/7 dt-bindings: phy: Add StarFive JH7110 PCIe document

In reply to Minda Chen

Add StarFive JH7110 SoC PCIe 2.0 PHY dt-binding. PCIe PHY0 (phy@10210000) can be used as USB 3.0 PHY.

---
 .../phy/starfive,jh7110-pcie-phy.yaml         | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +58 -0
new file mode 100644
index 000000000000..1b868f75ddae
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/starfive,jh7110-pcie-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive PCIe 2.0 PHY
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie-phy
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  starfive,sys-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller sys_syscon node.
+        - description: PHY connect offset of SYS_SYSCONSAIF__SYSCFG register for USB PHY.
+    description:
+      The phandle to System Register Controller syscon node and the PHY connect offset
+      of SYS_SYSCONSAIF__SYSCFG register. Connect PHY to USB3 controller.
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: PHY mode offset of STG_SYSCONSAIF__SYSCFG register.
+        - description: PHY enable for USB offset of STG_SYSCONSAIF__SYSCFG register.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe PHY. Total 2 regsisters offset.
+
+required:
+  - compatible
+  - reg
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    phy@10210000 {
+      compatible = "starfive,jh7110-pcie-phy";
+      reg = <0x10210000 0x10000>;
+      #phy-cells = <0>;
+      starfive,sys-syscon = <&sys_syscon 0x18>;
+      starfive,stg-syscon = <&stg_syscon 0x148 0x1f4>;
+    };
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH v4 2/7] dt-bindings: phy: Add StarFive JH7110 PCIe document

Quoted 2 lines · Minda Chen

Add StarFive JH7110 SoC PCIe 2.0 PHY dt-binding. PCIe PHY0 (phy@10210000) can be used as USB 3.0 PHY.

Subject: drop second/last, redundant "document". The "dt-bindings" prefix is already stating that this is documentation.

Quoted 13 lines
---
 .../phy/starfive,jh7110-pcie-phy.yaml         | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +0 -0
new file mode 100644
index 000000000000..1b868f75ddae

Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +7 -0
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/starfive,jh7110-pcie-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive PCIe 2.0 PHY

JH7110

Unless you plan to add here more compatibles, but then use enum for compatible, not const.

Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +10 -0
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie-phy
+
+  reg:
+    maxItems: 1

Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +10 -0
+
+  "#phy-cells":
+    const: 0
+
+  starfive,sys-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller sys_syscon node.
+        - description: PHY connect offset of SYS_SYSCONSAIF__SYSCFG register for USB PHY.

No improvements here.

Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml line 38

Quoted 11 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml new file +11 -0
+    description:
+      The phandle to System Register Controller syscon node and the PHY connect offset
+      of SYS_SYSCONSAIF__SYSCFG register. Connect PHY to USB3 controller.
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: PHY mode offset of STG_SYSCONSAIF__SYSCFG register.
+        - description: PHY enable for USB offset of STG_SYSCONSAIF__SYSCFG register.

No improvements.

Best regards,
Krzysztof

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

PATCH v4 3/7 phy: starfive: add JH7110 USB 2.0 PHY driver.

In reply to Minda Chen

Add Starfive JH7110 SoC USB 2.0 PHY driver support. USB 2.0 PHY default connect to Cadence USB controller.

---
 MAINTAINERS                           |   7 ++
 drivers/phy/starfive/Kconfig          |  11 ++
 drivers/phy/starfive/Makefile         |   1 +
 drivers/phy/starfive/phy-jh7110-usb.c | 161 ++++++++++++++++++++++++++
 4 files changed, 180 insertions(+)
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
MAINTAINERS +7 -0
index 1aef5ba46d71..9da352084403 100644
@@ -19968,6 +19968,13 @@ M:	William Qiu <[email protected]>
 S:	Supported
 F:	Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
 
+STARFIVE JH71X0 USB PHY DRIVER
+M:	Emil Renner Berthing <[email protected]>
+M:	Minda Chen <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
+F:	drivers/phy/starfive/phy-jh7110-usb.c
+
 STATIC BRANCH/CALL
 M:	Peter Zijlstra <[email protected]>
 M:	Josh Poimboeuf <[email protected]>
drivers/phy/starfive/Kconfig +11 -0
index f989b8ff8bcb..2c013c390dee 100644
@@ -11,3 +11,14 @@ config PHY_STARFIVE_DPHY_RX
 	  Choose this option if you have a StarFive D-PHY in your
 	  system. If M is selected, the module will be called
 	  phy-starfive-dphy-rx.
+
+config PHY_STARFIVE_JH7110_USB
+	tristate "Starfive JH7110 USB 2.0 PHY support"
+	depends on USB_SUPPORT
+	select GENERIC_PHY
+	select USB_PHY
+	help
+	  Enable this to support the StarFive USB 2.0 PHY,
+	  used with the Cadence USB controller.
+	  If M is selected, the module will be called
+	  phy-jh7110-usb.ko.
drivers/phy/starfive/Makefile +1 -0
index 7ec576cb30ae..176443852f4d 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_PHY_STARFIVE_DPHY_RX)      += phy-starfive-dphy-rx.o
+obj-$(CONFIG_PHY_STARFIVE_JH7110_USB)	+= phy-jh7110-usb.o
drivers/phy/starfive/phy-jh7110-usb.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#6 lore raw

PATCH v4 4/7 phy: starfive: add JH7110 PCIE 2.0 PHY driver.

In reply to Minda Chen

Add Starfive JH7110 SoC PCIe 2.0 driver support.
PCIe 2.0 PHY default connect to PCIe controller.
But pcie0 PHY can connect to USB 3.0 controlller.

---
 MAINTAINERS                            |   4 +-
 drivers/phy/starfive/Kconfig           |  11 ++
 drivers/phy/starfive/Makefile          |   1 +
 drivers/phy/starfive/phy-jh7110-pcie.c | 197 +++++++++++++++++++++++++
 4 files changed, 212 insertions(+), 1 deletion(-)
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
MAINTAINERS +3 -1
index 9da352084403..d98b70d62fd4 100644
@@ -19968,11 +19968,13 @@ M:	William Qiu <[email protected]>
 S:	Supported
 F:	Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
 
-STARFIVE JH71X0 USB PHY DRIVER
+STARFIVE JH71X0 PCIE AND USB PHY DRIVER
 M:	Emil Renner Berthing <[email protected]>
 M:	Minda Chen <[email protected]>
 S:	Supported
+F:	Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
+F:	drivers/phy/starfive/phy-jh7110-pcie.c
 F:	drivers/phy/starfive/phy-jh7110-usb.c
 
 STATIC BRANCH/CALL
drivers/phy/starfive/Kconfig +11 -0
index 2c013c390dee..c21c21d284a6 100644
@@ -12,6 +12,17 @@ config PHY_STARFIVE_DPHY_RX
 	  system. If M is selected, the module will be called
 	  phy-starfive-dphy-rx.
 
+config PHY_STARFIVE_JH7110_PCIE
+	tristate "Starfive JH7110 PCIE 2.0/USB 3.0 PHY support"
+	depends on USB_SUPPORT
+	select GENERIC_PHY
+	select USB_PHY
+	help
+	  Enable this to support the StarFive PCIe 2.0 PHY,
+	  or used as USB 3.0 PHY.
+	  If M is selected, the module will be called
+	  phy-jh7110-pcie.ko.
+
 config PHY_STARFIVE_JH7110_USB
 	tristate "Starfive JH7110 USB 2.0 PHY support"
 	depends on USB_SUPPORT
drivers/phy/starfive/Makefile +1 -0
index 176443852f4d..03a55aad53a2 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_PHY_STARFIVE_DPHY_RX)      += phy-starfive-dphy-rx.o
+obj-$(CONFIG_PHY_STARFIVE_JH7110_PCIE)	+= phy-jh7110-pcie.o
 obj-$(CONFIG_PHY_STARFIVE_JH7110_USB)	+= phy-jh7110-usb.o
drivers/phy/starfive/phy-jh7110-pcie.c new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#7 lore raw

PATCH v4 5/7 dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas

In reply to Minda Chen

StarFive JH7110 platforms USB have a wrapper module around the Cadence USBSS-DRD controller. Add binding information doc for that.

---
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 ++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +136 -0
new file mode 100644
index 000000000000..c8b30b583854
@@ -0,0 +1,136 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/starfive,jh7110-usb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 wrapper module for the Cadence USBSS-DRD controller
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-usb
+
+  reg:
+    items:
+      - description: OTG controller registers
+      - description: XHCI Host controller registers
+      - description: DEVICE controller registers
+
+  reg-names:
+    items:
+      - const: otg
+      - const: xhci
+      - const: dev
+
+  interrupts:
+    items:
+      - description: XHCI host controller interrupt
+      - description: Device controller interrupt
+      - description: OTG/DRD controller interrupt
+
+  interrupt-names:
+    items:
+      - const: host
+      - const: peripheral
+      - const: otg
+
+  clocks:
+    items:
+      - description: lpm clock
+      - description: stb clock
+      - description: apb clock
+      - description: axi clock
+      - description: utmi apb clock
+
+  clock-names:
+    items:
+      - const: lpm
+      - const: stb
+      - const: apb
+      - const: axi
+      - const: utmi_apb
+
+  resets:
+    items:
+      - description: PWRUP reset
+      - description: APB clock reset
+      - description: AXI clock reset
+      - description: UTMI_APB clock reset
+
+  reset-names:
+    items:
+      - const: pwrup
+      - const: apb
+      - const: axi
+      - const: utmi
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register offset of STG_SYSCONSAIF__SYSCFG register for USB.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for USB.
+
+  dr_mode:
+    enum: [host, otg, peripheral]
+
+  phys:
+    minItems: 1
+    maxItems: 2
+
+  phy-names:
+    minItems: 1
+    maxItems: 2
+    items:
+      anyOf:
+        - const: usb2-phy
+        - const: usb3-phy
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - interrupt-names
+  - clocks
+  - resets
+  - starfive,stg-syscon
+  - dr_mode
+
+additionalProperties: false
+
+examples:
+  - |
+    bus {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      usb@10100000 {
+        compatible = "starfive,jh7110-usb";
+        reg = <0x0 0x10100000 0x0 0x10000>,
+              <0x0 0x10110000 0x0 0x10000>,
+              <0x0 0x10120000 0x0 0x10000>;
+        reg-names = "otg", "xhci", "dev";
+        interrupts = <100>, <108>, <110>;
+        interrupt-names = "host", "peripheral", "otg";
+        clocks = <&syscrg 4>,
+                 <&stgcrg 5>,
+                 <&stgcrg 1>,
+                 <&stgcrg 3>,
+                 <&stgcrg 2>;
+        clock-names = "lpm", "stb", "apb", "axi", "utmi_apb";
+        resets = <&stgcrg 10>,
+                 <&stgcrg 8>,
+                 <&stgcrg 7>,
+                 <&stgcrg 9>;
+        reset-names = "pwrup", "apb", "axi", "utmi";
+        starfive,stg-syscon = <&stg_syscon 0x4>;
+        dr_mode = "host";
+      };
+    };
Signature · 1 line
2.17.1
#8 lore raw

Re: [PATCH v4 5/7] dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas

Quoted 3 lines · Minda Chen

StarFive JH7110 platforms USB have a wrapper module around the Cadence USBSS-DRD controller. Add binding information doc for that.

That's one of the most redundant subjects I saw. You basically used four words for one meaning. These are not exactly synonyms, but they all are either imprecise or meaning the same.

Subject: drop second/last, redundant "Bindings YAML schemas". The "dt-bindings" prefix is already stating that these are bindings.

Quoted 14 lines
---
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 ++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +0 -0
new file mode 100644
index 000000000000..c8b30b583854

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +7 -0
@@ -0,0 +1,136 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/starfive,jh7110-usb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 wrapper module for the Cadence USBSS-DRD controller

What do you wrap here? Are you sure this is a wrapper? I think this is just USB controller?

Quoted 56 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +56 -0
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-usb
+
+  reg:
+    items:
+      - description: OTG controller registers
+      - description: XHCI Host controller registers
+      - description: DEVICE controller registers
+
+  reg-names:
+    items:
+      - const: otg
+      - const: xhci
+      - const: dev
+
+  interrupts:
+    items:
+      - description: XHCI host controller interrupt
+      - description: Device controller interrupt
+      - description: OTG/DRD controller interrupt
+
+  interrupt-names:
+    items:
+      - const: host
+      - const: peripheral
+      - const: otg
+
+  clocks:
+    items:
+      - description: lpm clock
+      - description: stb clock
+      - description: apb clock
+      - description: axi clock
+      - description: utmi apb clock
+
+  clock-names:
+    items:
+      - const: lpm
+      - const: stb
+      - const: apb
+      - const: axi
+      - const: utmi_apb
+
+  resets:
+    items:
+      - description: PWRUP reset
+      - description: APB clock reset
+      - description: AXI clock reset
+      - description: UTMI_APB clock reset
+
+  reset-names:

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 73

Quoted 10 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +10 -0
+    items:
+      - const: pwrup
+      - const: apb
+      - const: axi
+      - const: utmi
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:

Same problem as for other patches.

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 79

Quoted 6 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +6 -0
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register offset of STG_SYSCONSAIF__SYSCFG register for USB.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for USB.
+

Best regards,
Krzysztof

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

Re: [PATCH v4 5/7] dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas

Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Minda Chen

StarFive JH7110 platforms USB have a wrapper module around the Cadence USBSS-DRD controller. Add binding information doc for that.

Quoted 8 lines

That's one of the most redundant subjects I saw. You basically used four words for one meaning. These are not exactly synonyms, but they all are either imprecise or meaning the same.

Subject: drop second/last, redundant "Bindings YAML schemas". The "dt-bindings" prefix is already stating that these are bindings.

ok

Quoted 9 lines
Quoted 9 lines
---
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 ++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
Quoted 17 lines

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +7 -0
new file mode 100644
index 000000000000..c8b30b583854
@@ -0,0 +1,136 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/starfive,jh7110-usb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 wrapper module for the Cadence USBSS-DRD controller

What do you wrap here? Are you sure this is a wrapper? I think this is just USB controller?

Since the previous version is wrapper module. I forgot change this. I will change to "StarFive JH7110 Cadence USBSS-DRD SoC controller"

Quoted 60 lines
Quoted 60 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +60 -0
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh7110-usb
+
+  reg:
+    items:
+      - description: OTG controller registers
+      - description: XHCI Host controller registers
+      - description: DEVICE controller registers
+
+  reg-names:
+    items:
+      - const: otg
+      - const: xhci
+      - const: dev
+
+  interrupts:
+    items:
+      - description: XHCI host controller interrupt
+      - description: Device controller interrupt
+      - description: OTG/DRD controller interrupt
+
+  interrupt-names:
+    items:
+      - const: host
+      - const: peripheral
+      - const: otg
+
+  clocks:
+    items:
+      - description: lpm clock
+      - description: stb clock
+      - description: apb clock
+      - description: axi clock
+      - description: utmi apb clock
+
+  clock-names:
+    items:
+      - const: lpm
+      - const: stb
+      - const: apb
+      - const: axi
+      - const: utmi_apb
+
+  resets:
+    items:
+      - description: PWRUP reset
+      - description: APB clock reset
+      - description: AXI clock reset
+      - description: UTMI_APB clock reset
+
+  reset-names:
+    items:
+      - const: pwrup
+      - const: apb
+      - const: axi
Quoted 9 lines

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 73

Quoted 6 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +6 -0
+      - const: utmi
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:

Same problem as for other patches.

I am sorry about this. I should change this in this version. PCIe PHY dt-binding doc will be also changed.

Quoted 11 lines

Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml line 79

Quoted 6 lines
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml new file +6 -0
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register offset of STG_SYSCONSAIF__SYSCFG register for USB.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for USB.
+

Best regards,
Krzysztof

author maintainer
#10 lore raw

PATCH v4 6/7 usb: cdns3: add StarFive JH7110 USB driver.

In reply to Minda Chen

Adds Specific Glue layer to support USB peripherals on StarFive JH7110 SoC.
There is a Cadence USB3 core for JH7110 SoCs, the cdns core is the child of this USB wrapper module device.

---
 MAINTAINERS                        |   7 +
 drivers/usb/cdns3/Kconfig          |  11 +
 drivers/usb/cdns3/Makefile         |   1 +
 drivers/usb/cdns3/cdns3-starfive.c | 378 +++++++++++++++++++++++++++++
 drivers/usb/cdns3/core.h           |   3 +
 5 files changed, 400 insertions(+)
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
MAINTAINERS +7 -0
index d98b70d62fd4..0610bbf921bb 100644
@@ -19977,6 +19977,13 @@ F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 F:	drivers/phy/starfive/phy-jh7110-pcie.c
 F:	drivers/phy/starfive/phy-jh7110-usb.c
 
+STARFIVE JH71X0 USB DRIVERS
+M:	Emil Renner Berthing <[email protected]>
+M:	Minda Chen <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
+F:	drivers/usb/cdns3/cdns3-starfive.c
+
 STATIC BRANCH/CALL
 M:	Peter Zijlstra <[email protected]>
 M:	Josh Poimboeuf <[email protected]>
drivers/usb/cdns3/Kconfig +11 -0
index b98ca0a1352a..0a514b591527 100644
@@ -78,6 +78,17 @@ config USB_CDNS3_IMX
 
 	  For example, imx8qm and imx8qxp.
 
+config USB_CDNS3_STARFIVE
+	tristate "Cadence USB3 support on StarFive SoC platforms"
+	depends on ARCH_STARFIVE || COMPILE_TEST
+	help
+	  Say 'Y' or 'M' here if you are building for StarFive SoCs
+	  platforms that contain Cadence USB3 controller core.
+
+	  e.g. JH7110.
+
+	  If you choose to build this driver as module it will
+	  be dynamically linked and module will be called cdns3-starfive.ko
 endif
 
 if USB_CDNS_SUPPORT
drivers/usb/cdns3/Makefile +1 -0
index 61edb2f89276..48dfae75b5aa 100644
@@ -24,6 +24,7 @@ endif
 obj-$(CONFIG_USB_CDNS3_PCI_WRAP)		+= cdns3-pci-wrap.o
 obj-$(CONFIG_USB_CDNS3_TI)			+= cdns3-ti.o
 obj-$(CONFIG_USB_CDNS3_IMX)			+= cdns3-imx.o
+obj-$(CONFIG_USB_CDNS3_STARFIVE)		+= cdns3-starfive.o
 
 cdnsp-udc-pci-y					:= cdnsp-pci.o
 
drivers/usb/cdns3/cdns3-starfive.c new file +378 -0

378 lines not on this page · raw message

drivers/usb/cdns3/core.h +3 -0
index 2d332a788871..8d44ab504898 100644
@@ -38,6 +38,9 @@ struct cdns_role_driver {
 };
 
 #define CDNS_XHCI_RESOURCES_NUM	2
+#define CDNS_IOMEM_RESOURCES_NUM	3
+#define CDNS_IRQ_RESOURCES_NUM		4
+#define CDNS_RESOURCES_NUM	(CDNS_IOMEM_RESOURCES_NUM + CDNS_IRQ_RESOURCES_NUM)
 
 struct cdns3_platform_data {
 	int (*platform_suspend)(struct device *dev,
Signature · 1 line
2.17.1
maintainer
#11 lore raw

Re: [PATCH v4 6/7] usb: cdns3: add StarFive JH7110 USB driver.

Quoted 330 lines · Minda Chen

Adds Specific Glue layer to support USB peripherals on StarFive JH7110 SoC.
There is a Cadence USB3 core for JH7110 SoCs, the cdns core is the child of this USB wrapper module device.

---
 MAINTAINERS                        |   7 +
 drivers/usb/cdns3/Kconfig          |  11 +
 drivers/usb/cdns3/Makefile         |   1 +
 drivers/usb/cdns3/cdns3-starfive.c | 378 +++++++++++++++++++++++++++++
 drivers/usb/cdns3/core.h           |   3 +
 5 files changed, 400 insertions(+)
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
MAINTAINERS +7 -0
index d98b70d62fd4..0610bbf921bb 100644
@@ -19977,6 +19977,13 @@ F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 F:	drivers/phy/starfive/phy-jh7110-pcie.c
 F:	drivers/phy/starfive/phy-jh7110-usb.c
 
+STARFIVE JH71X0 USB DRIVERS
+M:	Emil Renner Berthing <[email protected]>
+M:	Minda Chen <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
+F:	drivers/usb/cdns3/cdns3-starfive.c
+
 STATIC BRANCH/CALL
 M:	Peter Zijlstra <[email protected]>
 M:	Josh Poimboeuf <[email protected]>
drivers/usb/cdns3/Kconfig +11 -0
index b98ca0a1352a..0a514b591527 100644
@@ -78,6 +78,17 @@ config USB_CDNS3_IMX
 
 	  For example, imx8qm and imx8qxp.
 
+config USB_CDNS3_STARFIVE
+	tristate "Cadence USB3 support on StarFive SoC platforms"
+	depends on ARCH_STARFIVE || COMPILE_TEST
+	help
+	  Say 'Y' or 'M' here if you are building for StarFive SoCs
+	  platforms that contain Cadence USB3 controller core.
+
+	  e.g. JH7110.
+
+	  If you choose to build this driver as module it will
+	  be dynamically linked and module will be called cdns3-starfive.ko
 endif
 
 if USB_CDNS_SUPPORT
drivers/usb/cdns3/Makefile +1 -0
index 61edb2f89276..48dfae75b5aa 100644
@@ -24,6 +24,7 @@ endif
 obj-$(CONFIG_USB_CDNS3_PCI_WRAP)		+= cdns3-pci-wrap.o
 obj-$(CONFIG_USB_CDNS3_TI)			+= cdns3-ti.o
 obj-$(CONFIG_USB_CDNS3_IMX)			+= cdns3-imx.o
+obj-$(CONFIG_USB_CDNS3_STARFIVE)		+= cdns3-starfive.o
 
 cdnsp-udc-pci-y					:= cdnsp-pci.o
 
drivers/usb/cdns3/cdns3-starfive.c new file +257 -0
new file mode 100644
index 000000000000..925209a97bf9
@@ -0,0 +1,378 @@
+// SPDX-License-Identifier: GPL-2.0
+/**
+ * cdns3-starfive.c - StarFive specific Glue layer for Cadence USB Controller
+ *
+ * Copyright (C) 2022 Starfive, Inc.
+ * Author:	Yanhong Wang <[email protected]>
+ * Author:	Mason Huo <[email protected]>
+ * Author:	Minda Chen <[email protected]>
+ */
+
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/mfd/syscon.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <linux/usb/otg.h>
+#include "core.h"
+
+#define USB_STRAP_HOST			BIT(17)
+#define USB_STRAP_DEVICE		BIT(18)
+#define USB_STRAP_MASK			GENMASK(18, 16)
+
+#define USB_SUSPENDM_HOST		BIT(19)
+#define USB_SUSPENDM_MASK		BIT(19)
+#define CDNS_IRQ_WAKEUP_INDEX		3
+
+struct cdns_starfive {
+	struct device *dev;
+	struct phy *usb2_phy;
+	struct phy *usb3_phy;
+	struct regmap *stg_syscon;
+	struct reset_control *resets;
+	struct clk_bulk_data *clks;
+	int num_clks;
+	enum phy_mode phy_mode;
+	u32 stg_usb_mode;
+};
+
+static int set_phy_power_on(struct cdns_starfive *data)
+{
+	int ret;
+
+	ret = phy_power_on(data->usb2_phy);
+	if (ret)
+		return ret;
+
+	ret = phy_power_on(data->usb3_phy);
+	if (ret)
+		phy_power_off(data->usb2_phy);
+
+	return ret;
+}
+
+static void set_phy_power_off(struct cdns_starfive *data)
+{
+	phy_power_off(data->usb3_phy);
+	phy_power_off(data->usb2_phy);
+}
+
+static void cdns_mode_init(struct platform_device *pdev,
+				struct cdns_starfive *data)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(&pdev->dev);
+
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		regmap_update_bits(data->stg_syscon,
+			data->stg_usb_mode,
+			USB_STRAP_MASK,
+			USB_STRAP_HOST);
+		regmap_update_bits(data->stg_syscon,
+			data->stg_usb_mode,
+			USB_SUSPENDM_MASK,
+			USB_SUSPENDM_HOST);
+		data->phy_mode = PHY_MODE_USB_HOST;
+		break;
+
+	case USB_DR_MODE_PERIPHERAL:
+		regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
+			USB_STRAP_MASK, USB_STRAP_DEVICE);
+		regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
+			USB_SUSPENDM_MASK, 0);
+		data->phy_mode = PHY_MODE_USB_DEVICE;
+		break;
+
+	case USB_DR_MODE_OTG:
+		data->phy_mode = PHY_MODE_USB_OTG;
+	default:
+		break;
+	}
+}
+
+static int cdns_clk_rst_init(struct cdns_starfive *data)
+{
+	int ret;
+
+	data->num_clks = devm_clk_bulk_get_all(data->dev, &data->clks);
+	if (data->num_clks < 0)
+		return dev_err_probe(data->dev, -ENODEV,
+			"Failed to get clocks\n");
+
+	data->resets = devm_reset_control_array_get_exclusive(data->dev);
+	if (IS_ERR(data->resets)) {
+		return dev_err_probe(data->dev, PTR_ERR(data->resets),
+			"Failed to get resets");
+	}
+
+	ret = clk_bulk_prepare_enable(data->num_clks, data->clks);
+	if (ret)
+		return dev_err_probe(data->dev, ret,
+			"failed to enable clocks\n");
+
+	ret = reset_control_deassert(data->resets);
+	if (ret) {
+		ret = dev_err_probe(data->dev, ret,
+			"failed to reset clocks\n");
+		goto err_clk_init;
+	}
+
+	return ret;
+
+err_clk_init:
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+	return ret;
+}
+
+static int cdns3_starfive_phy_init(struct device *dev, struct cdns_starfive *data)
+{
+	int ret;
+
+	ret = phy_init(data->usb2_phy);
+	if (ret)
+		return ret;
+
+	ret = phy_init(data->usb3_phy);
+	if (ret)
+		goto err_phy3_init;
+
+	ret = set_phy_power_on(data);
+	if (ret)
+		goto err_phy_power_on;
+
+	phy_set_mode(data->usb2_phy, data->phy_mode);
+	phy_set_mode(data->usb3_phy, data->phy_mode);
+
+	return 0;
+
+err_phy_power_on:
+	phy_exit(data->usb3_phy);
+err_phy3_init:
+	phy_exit(data->usb2_phy);
+	return ret;
+}
+
+static int cdns3_starfive_platform_device_add(struct platform_device *pdev,
+		struct cdns_starfive *data)
+{
+	struct platform_device *cdns3;
+	struct resource	cdns_res[CDNS_RESOURCES_NUM], *res;
+	struct device *dev = &pdev->dev;
+	const char *reg_name[CDNS_IOMEM_RESOURCES_NUM] = {"otg", "xhci", "dev"};
+	const char *irq_name[CDNS_IRQ_RESOURCES_NUM] = {"host", "peripheral", "otg", "wakeup"};
+	int i, ret, res_idx = 0;
+
+	cdns3 = platform_device_alloc("cdns-usb3", PLATFORM_DEVID_AUTO);
+	if (!cdns3)
+		return dev_err_probe(dev, -ENOMEM,
+			"couldn't alloc cdns3 usb device\n");
+
+	cdns3->dev.parent = dev;
+	memset(cdns_res, 0, sizeof(cdns_res));
+
+	for (i = 0; i < CDNS_IOMEM_RESOURCES_NUM; i++) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, reg_name[i]);
+		if (!res) {
+			ret = dev_err_probe(dev,
+				-ENXIO, "couldn't get %s reg resource\n", reg_name[i]);
+			goto free_memory;
+		}
+		cdns_res[res_idx] = *res;
+		res_idx++;
+	}
+
+	for (i = 0; i < CDNS_IRQ_RESOURCES_NUM; i++) {
+		if (i == CDNS_IRQ_WAKEUP_INDEX) {
+			ret = platform_get_irq_byname_optional(pdev, irq_name[i]);
+			if (ret < 0)
+				continue;
+		} else {
+			ret = platform_get_irq_byname(pdev, irq_name[i]);
+			if (ret < 0) {
+				dev_err(dev, "couldn't get %s irq\n", irq_name[i]);
+				goto free_memory;
+			}
+		}
+		cdns_res[res_idx].start = ret;
+		cdns_res[res_idx].end = ret;
+		cdns_res[res_idx].flags = IORESOURCE_IRQ;
+		cdns_res[res_idx].name = irq_name[i];
+		res_idx++;
+	}
+
+	ret = platform_device_add_resources(cdns3, cdns_res, res_idx);
+	if (ret) {
+		dev_err(dev, "couldn't add res to cdns3 device\n");
+		goto free_memory;
+	}
+
+	ret = platform_device_add(cdns3);
+	if (ret) {
+		dev_err(dev, "failed to register cdns3 device\n");
+		goto free_memory;
+	}
+
+	return ret;
+free_memory:
+	platform_device_put(cdns3);
+	return ret;
+}
+
+static int cdns_starfive_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cdns_starfive *data;
+	unsigned int args;
+	int ret;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, data);
+
+	data->dev = dev;
+
+	data->stg_syscon = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
+		"starfive,stg-syscon", 1, &args);
+
+	if (IS_ERR(data->stg_syscon))
+		return dev_err_probe(dev, PTR_ERR(data->stg_syscon),
+			"Failed to parse starfive,stg-syscon\n");
+
+	data->stg_usb_mode = args;
+
+	cdns_mode_init(pdev, data);
+
+	ret = cdns_clk_rst_init(data);
+	if (ret)
+		return ret;
+

drivers/usb/cdns3/cdns3-starfive.c line 267

Quoted 10 lines
drivers/usb/cdns3/cdns3-starfive.c new file +10 -0
+	data->usb2_phy = devm_phy_optional_get(dev, "usb2-phy");
+	if (IS_ERR(data->usb2_phy))
+		return dev_err_probe(dev, PTR_ERR(data->usb2_phy),
+			"Failed to parse usb2 phy\n");
+
+	data->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
+	if (IS_ERR(data->usb3_phy))
+		return dev_err_probe(dev, PTR_ERR(data->usb3_phy),
+			"Failed to parse usb3 phy\n");
+

You may not change the comment for if above functions are failed, there is not opposite functions for clk and reset.

Others are okay for me.

Peter

Quoted 128 lines
drivers/usb/cdns3/cdns3-starfive.c new file +111 -0
+	cdns3_starfive_phy_init(dev, data);
+
+	ret = cdns3_starfive_platform_device_add(pdev, data);
+	if (ret) {
+		set_phy_power_off(data);
+		phy_exit(data->usb3_phy);
+		phy_exit(data->usb2_phy);
+		reset_control_assert(data->resets);
+		clk_bulk_disable_unprepare(data->num_clks, data->clks);
+		return dev_err_probe(dev, ret, "Failed to create children\n");
+	}
+
+	device_set_wakeup_capable(dev, true);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
+	dev_info(dev, "usb mode %d probe success\n", data->phy_mode);
+
+	return 0;
+}
+
+static int cdns_starfive_remove_core(struct device *dev, void *c)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	platform_device_unregister(pdev);
+
+	return 0;
+}
+
+static int cdns_starfive_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+
+	pm_runtime_get_sync(dev);
+	device_for_each_child(dev, NULL, cdns_starfive_remove_core);
+
+	set_phy_power_off(data);
+	phy_exit(data->usb2_phy);
+	phy_exit(data->usb3_phy);
+
+	reset_control_assert(data->resets);
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+	pm_runtime_disable(dev);
+	pm_runtime_put_noidle(dev);
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int cdns_starfive_resume(struct device *dev)
+{
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+	int ret;
+
+	ret = clk_bulk_prepare_enable(data->num_clks, data->clks);
+	if (ret)
+		return ret;
+
+	ret = reset_control_deassert(data->resets);
+	if (ret)
+		return ret;
+
+	ret = cdns3_starfive_phy_init(dev, data);
+
+	return ret;
+}
+
+static int cdns_starfive_suspend(struct device *dev)
+{
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+
+	set_phy_power_off(data);
+	phy_exit(data->usb2_phy);
+	phy_exit(data->usb3_phy);
+	reset_control_assert(data->resets);
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+
+	return 0;
+}
+#endif
+
+static const struct dev_pm_ops cdns_starfive_pm_ops = {
+	SET_RUNTIME_PM_OPS(cdns_starfive_suspend, cdns_starfive_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(cdns_starfive_suspend, cdns_starfive_resume)
+};
+
+static const struct of_device_id cdns_starfive_of_match[] = {
+	{ .compatible = "starfive,jh7110-usb", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, cdns_starfive_of_match);
+
+static struct platform_driver cdns_starfive_driver = {
+	.probe		= cdns_starfive_probe,
+	.remove		= cdns_starfive_remove,
+	.driver		= {
+		.name	= "cdns3-starfive",
+		.of_match_table	= cdns_starfive_of_match,
+		.pm	= &cdns_starfive_pm_ops,
+	},
+};
+module_platform_driver(cdns_starfive_driver);
+
+MODULE_ALIAS("platform:cdns3-starfive");
+MODULE_AUTHOR("YanHong Wang <[email protected]>");
+MODULE_AUTHOR("Mason Huo <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Cadence USB3 StarFive Glue Layer");
drivers/usb/cdns3/core.h +3 -0
index 2d332a788871..8d44ab504898 100644
@@ -38,6 +38,9 @@ struct cdns_role_driver {
 };
 
 #define CDNS_XHCI_RESOURCES_NUM	2
+#define CDNS_IOMEM_RESOURCES_NUM	3
+#define CDNS_IRQ_RESOURCES_NUM		4
+#define CDNS_RESOURCES_NUM	(CDNS_IOMEM_RESOURCES_NUM + CDNS_IRQ_RESOURCES_NUM)
 
 struct cdns3_platform_data {
 	int (*platform_suspend)(struct device *dev,
Signature · 1 line
2.17.1
Signature · 7 lines
Thanks,
Peter Chen

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

Re: [PATCH v4 6/7] usb: cdns3: add StarFive JH7110 USB driver.

Quoted 345 lines · Peter Chen
Quoted 330 lines · Minda Chen

Adds Specific Glue layer to support USB peripherals on StarFive JH7110 SoC.
There is a Cadence USB3 core for JH7110 SoCs, the cdns core is the child of this USB wrapper module device.

---
 MAINTAINERS                        |   7 +
 drivers/usb/cdns3/Kconfig          |  11 +
 drivers/usb/cdns3/Makefile         |   1 +
 drivers/usb/cdns3/cdns3-starfive.c | 378 +++++++++++++++++++++++++++++
 drivers/usb/cdns3/core.h           |   3 +
 5 files changed, 400 insertions(+)
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
MAINTAINERS +7 -0
index d98b70d62fd4..0610bbf921bb 100644
@@ -19977,6 +19977,13 @@ F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 F:	drivers/phy/starfive/phy-jh7110-pcie.c
 F:	drivers/phy/starfive/phy-jh7110-usb.c
 
+STARFIVE JH71X0 USB DRIVERS
+M:	Emil Renner Berthing <[email protected]>
+M:	Minda Chen <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
+F:	drivers/usb/cdns3/cdns3-starfive.c
+
 STATIC BRANCH/CALL
 M:	Peter Zijlstra <[email protected]>
 M:	Josh Poimboeuf <[email protected]>
drivers/usb/cdns3/Kconfig +11 -0
index b98ca0a1352a..0a514b591527 100644
@@ -78,6 +78,17 @@ config USB_CDNS3_IMX
 
 	  For example, imx8qm and imx8qxp.
 
+config USB_CDNS3_STARFIVE
+	tristate "Cadence USB3 support on StarFive SoC platforms"
+	depends on ARCH_STARFIVE || COMPILE_TEST
+	help
+	  Say 'Y' or 'M' here if you are building for StarFive SoCs
+	  platforms that contain Cadence USB3 controller core.
+
+	  e.g. JH7110.
+
+	  If you choose to build this driver as module it will
+	  be dynamically linked and module will be called cdns3-starfive.ko
 endif
 
 if USB_CDNS_SUPPORT
drivers/usb/cdns3/Makefile +1 -0
index 61edb2f89276..48dfae75b5aa 100644
@@ -24,6 +24,7 @@ endif
 obj-$(CONFIG_USB_CDNS3_PCI_WRAP)		+= cdns3-pci-wrap.o
 obj-$(CONFIG_USB_CDNS3_TI)			+= cdns3-ti.o
 obj-$(CONFIG_USB_CDNS3_IMX)			+= cdns3-imx.o
+obj-$(CONFIG_USB_CDNS3_STARFIVE)		+= cdns3-starfive.o
 
 cdnsp-udc-pci-y					:= cdnsp-pci.o
 
drivers/usb/cdns3/cdns3-starfive.c new file +257 -0
new file mode 100644
index 000000000000..925209a97bf9
@@ -0,0 +1,378 @@
+// SPDX-License-Identifier: GPL-2.0
+/**
+ * cdns3-starfive.c - StarFive specific Glue layer for Cadence USB Controller
+ *
+ * Copyright (C) 2022 Starfive, Inc.
+ * Author:	Yanhong Wang <[email protected]>
+ * Author:	Mason Huo <[email protected]>
+ * Author:	Minda Chen <[email protected]>
+ */
+
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/mfd/syscon.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <linux/usb/otg.h>
+#include "core.h"
+
+#define USB_STRAP_HOST			BIT(17)
+#define USB_STRAP_DEVICE		BIT(18)
+#define USB_STRAP_MASK			GENMASK(18, 16)
+
+#define USB_SUSPENDM_HOST		BIT(19)
+#define USB_SUSPENDM_MASK		BIT(19)
+#define CDNS_IRQ_WAKEUP_INDEX		3
+
+struct cdns_starfive {
+	struct device *dev;
+	struct phy *usb2_phy;
+	struct phy *usb3_phy;
+	struct regmap *stg_syscon;
+	struct reset_control *resets;
+	struct clk_bulk_data *clks;
+	int num_clks;
+	enum phy_mode phy_mode;
+	u32 stg_usb_mode;
+};
+
+static int set_phy_power_on(struct cdns_starfive *data)
+{
+	int ret;
+
+	ret = phy_power_on(data->usb2_phy);
+	if (ret)
+		return ret;
+
+	ret = phy_power_on(data->usb3_phy);
+	if (ret)
+		phy_power_off(data->usb2_phy);
+
+	return ret;
+}
+
+static void set_phy_power_off(struct cdns_starfive *data)
+{
+	phy_power_off(data->usb3_phy);
+	phy_power_off(data->usb2_phy);
+}
+
+static void cdns_mode_init(struct platform_device *pdev,
+				struct cdns_starfive *data)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(&pdev->dev);
+
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		regmap_update_bits(data->stg_syscon,
+			data->stg_usb_mode,
+			USB_STRAP_MASK,
+			USB_STRAP_HOST);
+		regmap_update_bits(data->stg_syscon,
+			data->stg_usb_mode,
+			USB_SUSPENDM_MASK,
+			USB_SUSPENDM_HOST);
+		data->phy_mode = PHY_MODE_USB_HOST;
+		break;
+
+	case USB_DR_MODE_PERIPHERAL:
+		regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
+			USB_STRAP_MASK, USB_STRAP_DEVICE);
+		regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
+			USB_SUSPENDM_MASK, 0);
+		data->phy_mode = PHY_MODE_USB_DEVICE;
+		break;
+
+	case USB_DR_MODE_OTG:
+		data->phy_mode = PHY_MODE_USB_OTG;
+	default:
+		break;
+	}
+}
+
+static int cdns_clk_rst_init(struct cdns_starfive *data)
+{
+	int ret;
+
+	data->num_clks = devm_clk_bulk_get_all(data->dev, &data->clks);
+	if (data->num_clks < 0)
+		return dev_err_probe(data->dev, -ENODEV,
+			"Failed to get clocks\n");
+
+	data->resets = devm_reset_control_array_get_exclusive(data->dev);
+	if (IS_ERR(data->resets)) {
+		return dev_err_probe(data->dev, PTR_ERR(data->resets),
+			"Failed to get resets");
+	}
+
+	ret = clk_bulk_prepare_enable(data->num_clks, data->clks);
+	if (ret)
+		return dev_err_probe(data->dev, ret,
+			"failed to enable clocks\n");
+
+	ret = reset_control_deassert(data->resets);
+	if (ret) {
+		ret = dev_err_probe(data->dev, ret,
+			"failed to reset clocks\n");
+		goto err_clk_init;
+	}
+
+	return ret;
+
+err_clk_init:
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+	return ret;
+}
+
+static int cdns3_starfive_phy_init(struct device *dev, struct cdns_starfive *data)
+{
+	int ret;
+
+	ret = phy_init(data->usb2_phy);
+	if (ret)
+		return ret;
+
+	ret = phy_init(data->usb3_phy);
+	if (ret)
+		goto err_phy3_init;
+
+	ret = set_phy_power_on(data);
+	if (ret)
+		goto err_phy_power_on;
+
+	phy_set_mode(data->usb2_phy, data->phy_mode);
+	phy_set_mode(data->usb3_phy, data->phy_mode);
+
+	return 0;
+
+err_phy_power_on:
+	phy_exit(data->usb3_phy);
+err_phy3_init:
+	phy_exit(data->usb2_phy);
+	return ret;
+}
+
+static int cdns3_starfive_platform_device_add(struct platform_device *pdev,
+		struct cdns_starfive *data)
+{
+	struct platform_device *cdns3;
+	struct resource	cdns_res[CDNS_RESOURCES_NUM], *res;
+	struct device *dev = &pdev->dev;
+	const char *reg_name[CDNS_IOMEM_RESOURCES_NUM] = {"otg", "xhci", "dev"};
+	const char *irq_name[CDNS_IRQ_RESOURCES_NUM] = {"host", "peripheral", "otg", "wakeup"};
+	int i, ret, res_idx = 0;
+
+	cdns3 = platform_device_alloc("cdns-usb3", PLATFORM_DEVID_AUTO);
+	if (!cdns3)
+		return dev_err_probe(dev, -ENOMEM,
+			"couldn't alloc cdns3 usb device\n");
+
+	cdns3->dev.parent = dev;
+	memset(cdns_res, 0, sizeof(cdns_res));
+
+	for (i = 0; i < CDNS_IOMEM_RESOURCES_NUM; i++) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, reg_name[i]);
+		if (!res) {
+			ret = dev_err_probe(dev,
+				-ENXIO, "couldn't get %s reg resource\n", reg_name[i]);
+			goto free_memory;
+		}
+		cdns_res[res_idx] = *res;
+		res_idx++;
+	}
+
+	for (i = 0; i < CDNS_IRQ_RESOURCES_NUM; i++) {
+		if (i == CDNS_IRQ_WAKEUP_INDEX) {
+			ret = platform_get_irq_byname_optional(pdev, irq_name[i]);
+			if (ret < 0)
+				continue;
+		} else {
+			ret = platform_get_irq_byname(pdev, irq_name[i]);
+			if (ret < 0) {
+				dev_err(dev, "couldn't get %s irq\n", irq_name[i]);
+				goto free_memory;
+			}
+		}
+		cdns_res[res_idx].start = ret;
+		cdns_res[res_idx].end = ret;
+		cdns_res[res_idx].flags = IORESOURCE_IRQ;
+		cdns_res[res_idx].name = irq_name[i];
+		res_idx++;
+	}
+
+	ret = platform_device_add_resources(cdns3, cdns_res, res_idx);
+	if (ret) {
+		dev_err(dev, "couldn't add res to cdns3 device\n");
+		goto free_memory;
+	}
+
+	ret = platform_device_add(cdns3);
+	if (ret) {
+		dev_err(dev, "failed to register cdns3 device\n");
+		goto free_memory;
+	}
+
+	return ret;
+free_memory:
+	platform_device_put(cdns3);
+	return ret;
+}
+
+static int cdns_starfive_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cdns_starfive *data;
+	unsigned int args;
+	int ret;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, data);
+
+	data->dev = dev;
+
+	data->stg_syscon = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
+		"starfive,stg-syscon", 1, &args);
+
+	if (IS_ERR(data->stg_syscon))
+		return dev_err_probe(dev, PTR_ERR(data->stg_syscon),
+			"Failed to parse starfive,stg-syscon\n");
+
+	data->stg_usb_mode = args;
+
+	cdns_mode_init(pdev, data);
+
+	ret = cdns_clk_rst_init(data);
+	if (ret)
+		return ret;
+

drivers/usb/cdns3/cdns3-starfive.c line 267

Quoted 10 lines
drivers/usb/cdns3/cdns3-starfive.c new file +10 -0
+	data->usb2_phy = devm_phy_optional_get(dev, "usb2-phy");
+	if (IS_ERR(data->usb2_phy))
+		return dev_err_probe(dev, PTR_ERR(data->usb2_phy),
+			"Failed to parse usb2 phy\n");
+
+	data->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
+	if (IS_ERR(data->usb3_phy))
+		return dev_err_probe(dev, PTR_ERR(data->usb3_phy),
+			"Failed to parse usb3 phy\n");
+

You may not change the comment for if above functions are failed, there is not opposite functions for clk and reset.

Quoted 4 lines

Others are okay for me.

Peter

OK, I will change this. Thank you very much.

Quoted 129 lines
Quoted 128 lines
drivers/usb/cdns3/cdns3-starfive.c new file +111 -0
+	cdns3_starfive_phy_init(dev, data);
+
+	ret = cdns3_starfive_platform_device_add(pdev, data);
+	if (ret) {
+		set_phy_power_off(data);
+		phy_exit(data->usb3_phy);
+		phy_exit(data->usb2_phy);
+		reset_control_assert(data->resets);
+		clk_bulk_disable_unprepare(data->num_clks, data->clks);
+		return dev_err_probe(dev, ret, "Failed to create children\n");
+	}
+
+	device_set_wakeup_capable(dev, true);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
+	dev_info(dev, "usb mode %d probe success\n", data->phy_mode);
+
+	return 0;
+}
+
+static int cdns_starfive_remove_core(struct device *dev, void *c)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	platform_device_unregister(pdev);
+
+	return 0;
+}
+
+static int cdns_starfive_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+
+	pm_runtime_get_sync(dev);
+	device_for_each_child(dev, NULL, cdns_starfive_remove_core);
+
+	set_phy_power_off(data);
+	phy_exit(data->usb2_phy);
+	phy_exit(data->usb3_phy);
+
+	reset_control_assert(data->resets);
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+	pm_runtime_disable(dev);
+	pm_runtime_put_noidle(dev);
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int cdns_starfive_resume(struct device *dev)
+{
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+	int ret;
+
+	ret = clk_bulk_prepare_enable(data->num_clks, data->clks);
+	if (ret)
+		return ret;
+
+	ret = reset_control_deassert(data->resets);
+	if (ret)
+		return ret;
+
+	ret = cdns3_starfive_phy_init(dev, data);
+
+	return ret;
+}
+
+static int cdns_starfive_suspend(struct device *dev)
+{
+	struct cdns_starfive *data = dev_get_drvdata(dev);
+
+	set_phy_power_off(data);
+	phy_exit(data->usb2_phy);
+	phy_exit(data->usb3_phy);
+	reset_control_assert(data->resets);
+	clk_bulk_disable_unprepare(data->num_clks, data->clks);
+
+	return 0;
+}
+#endif
+
+static const struct dev_pm_ops cdns_starfive_pm_ops = {
+	SET_RUNTIME_PM_OPS(cdns_starfive_suspend, cdns_starfive_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(cdns_starfive_suspend, cdns_starfive_resume)
+};
+
+static const struct of_device_id cdns_starfive_of_match[] = {
+	{ .compatible = "starfive,jh7110-usb", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, cdns_starfive_of_match);
+
+static struct platform_driver cdns_starfive_driver = {
+	.probe		= cdns_starfive_probe,
+	.remove		= cdns_starfive_remove,
+	.driver		= {
+		.name	= "cdns3-starfive",
+		.of_match_table	= cdns_starfive_of_match,
+		.pm	= &cdns_starfive_pm_ops,
+	},
+};
+module_platform_driver(cdns_starfive_driver);
+
+MODULE_ALIAS("platform:cdns3-starfive");
+MODULE_AUTHOR("YanHong Wang <[email protected]>");
+MODULE_AUTHOR("Mason Huo <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Cadence USB3 StarFive Glue Layer");
drivers/usb/cdns3/core.h +3 -0
index 2d332a788871..8d44ab504898 100644
@@ -38,6 +38,9 @@ struct cdns_role_driver {
 };
 
 #define CDNS_XHCI_RESOURCES_NUM	2
+#define CDNS_IOMEM_RESOURCES_NUM	3
+#define CDNS_IRQ_RESOURCES_NUM		4
+#define CDNS_RESOURCES_NUM	(CDNS_IOMEM_RESOURCES_NUM + CDNS_IRQ_RESOURCES_NUM)
 
 struct cdns3_platform_data {
 	int (*platform_suspend)(struct device *dev,
Signature · 1 line
2.17.1
author maintainer
#13 lore raw

PATCH v4 7/7 riscv: dts: starfive: add USB dts configuration for JH7110

In reply to Minda Chen

Add USB wrapper layer and Cadence USB3 controller dts configuration for StarFive JH7110 SoC and VisionFive2 Board.
USB controller connect to PHY, The PHY dts configuration are also added.

---
 .../jh7110-starfive-visionfive-2.dtsi         |  7 +++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      | 44 +++++++++++++++++++
 2 files changed, 51 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +7 -0
index 1155b97b593d..cf0a66faf5d3 100644
@@ -221,3 +221,10 @@
 	pinctrl-0 = <&uart0_pins>;
 	status = "okay";
 };
+
+&usb0 {
+	phys = <&usbphy0>;
+	phy-names = "usb2-phy";
+	dr_mode = "peripheral";
+	status = "okay";
+};
arch/riscv/boot/dts/starfive/jh7110.dtsi +44 -0

50 lines not on this page · raw message

Signature · 1 line
2.17.1
#14 lore raw
In reply to Minda Chen
Quoted 19 lines · Minda Chen

This patchset adds USB driver and USB PHY for the StarFive JH7110 SoC. USB work mode is peripheral and using USB 2.0 PHY in VisionFive 2 board. The patch has been tested on the VisionFive 2 board.

This patchset should be applied after the patchset [1], [2] and[3]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is usb phy dt-binding document.
patch 2 is Pcie PHY dt-binding document.
patch 3 is USB 2.0 PHY driver.
patch 4 is PCIe PHY driver.
patch 5 is usb dt-binding document.
patch 6 is the wrapper module driver of Cadence USB3. USB controller IP is Cadence USB3. patch 7 is USB device tree configuration.

Quoted 4 lines

previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v2: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

This is v2.

Quoted 88 lines

v3: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

changes
v4:
1. (patch 1) split PCIe PHY dt-binding doc to patch 2.
2. (patch 2) PCIe PHY add stg and sys con configuration to dt-binding doc.
3. (patch 3)
- split PCIe PHY driver to patch 4.
- replace dr_mode to phy mode in jh7110_usb2_phy.
4. (patch 4)
- Makefile and Kconfig sorted by alphabet sequence.
- Add PCIe PHY stg and syscon PHY connection configuration for USB 3.0.
5. (patch 5)
- commit message changed.
- merge wrapper dts node and cdns3 node in example.
- Add interrupts, reg, phy and dr_mode in property.
- Add reset-name in property example.
6. (patch 6)
- For dts node is merged, Using platform_device_alloc and platform_device_add to generate cadence sub device.
- IOMEM and IRQ resource are passed to Cadence sub device.
- Add PHY ops process for PHY dts setting can not be passed to Cadence USB driver.
- remove the stg and sys USB 3.0 PHY configuration.
- Change the suspend clock reset and clock enable sequence.
- Get all reset and clock resources before enable them in cdns_clk_rst_init.
- commit message changed.
7. (patch 7)
- merge wrapper dts node and cdns3 node in usb dts.
- move the stg and sys USB 3.0 PHY confiuration to
PCIe PHY dts node.
- commit message changed.
- Add reset-names dts.

v3:
1. Add patch 1 - 4. Add USB PHY driver and dt-binding doc. USB PHY codes are moved to patch 3 and patch 4.
2. (patch 5)
- USB wrapper module dts document is moved to usb directory.
- Remove the 'dr_mode' and 'starfive,usb2-only' setting.
- Some dts format changes. dts binding check pass.
3. (patch 6)
- Remove the PHY codes.
- Search 'dr_mode' and phy setting from Cadence subnode.
4. (patch 7)
- Add USB PHY dts configurion.
- 'dr_mode' is moved to Cadence controller submode.

v2:
1. (patch 5) dt-binding changes. The document example is the same as dts config.
2. (patch 6) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 7) dts nodes sorted by the address after @

Minda Chen (7):
dt-bindings: phy: Add StarFive JH7110 USB document
dt-bindings: phy: Add StarFive JH7110 PCIe document
phy: starfive: add JH7110 USB 2.0 PHY driver.
phy: starfive: add JH7110 PCIE 2.0 PHY driver.
dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas
usb: cdns3: add StarFive JH7110 USB driver.
riscv: dts: starfive: add USB dts configuration for JH7110

 .../phy/starfive,jh7110-pcie-phy.yaml         |  58 +++
 .../bindings/phy/starfive,jh7110-usb-phy.yaml |  50 +++
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 +++++++
 MAINTAINERS                                   |  16 +
 .../jh7110-starfive-visionfive-2.dtsi         |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  44 ++
 drivers/phy/starfive/Kconfig                  |  22 +
 drivers/phy/starfive/Makefile                 |   2 +
 drivers/phy/starfive/phy-jh7110-pcie.c        | 197 +++++++++
 drivers/phy/starfive/phy-jh7110-usb.c         | 161 ++++++++
 drivers/usb/cdns3/Kconfig                     |  11 +
 drivers/usb/cdns3/Makefile                    |   1 +
 drivers/usb/cdns3/cdns3-starfive.c            | 378 ++++++++++++++++++
 drivers/usb/cdns3/core.h                      |   3 +
 14 files changed, 1086 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
Quoted 3 lines

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

What commits do you reference? How are they helpful?

Best regards,
Krzysztof

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author maintainer
#15 lore raw
Quoted 115 lines · Krzysztof Kozlowski
Quoted 19 lines · Minda Chen

This patchset adds USB driver and USB PHY for the StarFive JH7110 SoC. USB work mode is peripheral and using USB 2.0 PHY in VisionFive 2 board. The patch has been tested on the VisionFive 2 board.

This patchset should be applied after the patchset [1], [2] and[3]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is usb phy dt-binding document.
patch 2 is Pcie PHY dt-binding document.
patch 3 is USB 2.0 PHY driver.
patch 4 is PCIe PHY driver.
patch 5 is usb dt-binding document.
patch 6 is the wrapper module driver of Cadence USB3. USB controller IP is Cadence USB3. patch 7 is USB device tree configuration.

Quoted 4 lines

previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v2: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

This is v2.

Quoted 88 lines

v3: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

changes
v4:
1. (patch 1) split PCIe PHY dt-binding doc to patch 2.
2. (patch 2) PCIe PHY add stg and sys con configuration to dt-binding doc.
3. (patch 3)
- split PCIe PHY driver to patch 4.
- replace dr_mode to phy mode in jh7110_usb2_phy.
4. (patch 4)
- Makefile and Kconfig sorted by alphabet sequence.
- Add PCIe PHY stg and syscon PHY connection configuration for USB 3.0.
5. (patch 5)
- commit message changed.
- merge wrapper dts node and cdns3 node in example.
- Add interrupts, reg, phy and dr_mode in property.
- Add reset-name in property example.
6. (patch 6)
- For dts node is merged, Using platform_device_alloc and platform_device_add to generate cadence sub device.
- IOMEM and IRQ resource are passed to Cadence sub device.
- Add PHY ops process for PHY dts setting can not be passed to Cadence USB driver.
- remove the stg and sys USB 3.0 PHY configuration.
- Change the suspend clock reset and clock enable sequence.
- Get all reset and clock resources before enable them in cdns_clk_rst_init.
- commit message changed.
7. (patch 7)
- merge wrapper dts node and cdns3 node in usb dts.
- move the stg and sys USB 3.0 PHY confiuration to
PCIe PHY dts node.
- commit message changed.
- Add reset-names dts.

v3:
1. Add patch 1 - 4. Add USB PHY driver and dt-binding doc. USB PHY codes are moved to patch 3 and patch 4.
2. (patch 5)
- USB wrapper module dts document is moved to usb directory.
- Remove the 'dr_mode' and 'starfive,usb2-only' setting.
- Some dts format changes. dts binding check pass.
3. (patch 6)
- Remove the PHY codes.
- Search 'dr_mode' and phy setting from Cadence subnode.
4. (patch 7)
- Add USB PHY dts configurion.
- 'dr_mode' is moved to Cadence controller submode.

v2:
1. (patch 5) dt-binding changes. The document example is the same as dts config.
2. (patch 6) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 7) dts nodes sorted by the address after @

Minda Chen (7):
dt-bindings: phy: Add StarFive JH7110 USB document
dt-bindings: phy: Add StarFive JH7110 PCIe document
phy: starfive: add JH7110 USB 2.0 PHY driver.
phy: starfive: add JH7110 PCIE 2.0 PHY driver.
dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas
usb: cdns3: add StarFive JH7110 USB driver.
riscv: dts: starfive: add USB dts configuration for JH7110

 .../phy/starfive,jh7110-pcie-phy.yaml         |  58 +++
 .../bindings/phy/starfive,jh7110-usb-phy.yaml |  50 +++
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 +++++++
 MAINTAINERS                                   |  16 +
 .../jh7110-starfive-visionfive-2.dtsi         |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  44 ++
 drivers/phy/starfive/Kconfig                  |  22 +
 drivers/phy/starfive/Makefile                 |   2 +
 drivers/phy/starfive/phy-jh7110-pcie.c        | 197 +++++++++
 drivers/phy/starfive/phy-jh7110-usb.c         | 161 ++++++++
 drivers/usb/cdns3/Kconfig                     |  11 +
 drivers/usb/cdns3/Makefile                    |   1 +
 drivers/usb/cdns3/cdns3-starfive.c            | 378 ++++++++++++++++++
 drivers/usb/cdns3/core.h                      |   3 +
 14 files changed, 1086 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
Quoted 8 lines
Quoted 3 lines

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

What commits do you reference? How are they helpful?

I use "git format-patch --base=(commit) to generate patchset. Maybe I set the wrong base commit.

Quoted 4 lines

Best regards,
Krzysztof

#16 lore raw
Quoted 122 lines · Minda Chen
Quoted 119 lines · Krzysztof Kozlowski
Quoted 19 lines · Minda Chen

This patchset adds USB driver and USB PHY for the StarFive JH7110 SoC. USB work mode is peripheral and using USB 2.0 PHY in VisionFive 2 board. The patch has been tested on the VisionFive 2 board.

This patchset should be applied after the patchset [1], [2] and[3]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is usb phy dt-binding document.
patch 2 is Pcie PHY dt-binding document.
patch 3 is USB 2.0 PHY driver.
patch 4 is PCIe PHY driver.
patch 5 is usb dt-binding document.
patch 6 is the wrapper module driver of Cadence USB3. USB controller IP is Cadence USB3. patch 7 is USB device tree configuration.

Quoted 4 lines

previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v2: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

This is v2.

Quoted 91 lines

v3: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

changes
v4:
1. (patch 1) split PCIe PHY dt-binding doc to patch 2.
2. (patch 2) PCIe PHY add stg and sys con configuration to dt-binding doc.
3. (patch 3)
- split PCIe PHY driver to patch 4.
- replace dr_mode to phy mode in jh7110_usb2_phy.
4. (patch 4)
- Makefile and Kconfig sorted by alphabet sequence.
- Add PCIe PHY stg and syscon PHY connection configuration for USB 3.0.
5. (patch 5)
- commit message changed.
- merge wrapper dts node and cdns3 node in example.
- Add interrupts, reg, phy and dr_mode in property.
- Add reset-name in property example.
6. (patch 6)
- For dts node is merged, Using platform_device_alloc and platform_device_add to generate cadence sub device.
- IOMEM and IRQ resource are passed to Cadence sub device.
- Add PHY ops process for PHY dts setting can not be passed to Cadence USB driver.
- remove the stg and sys USB 3.0 PHY configuration.
- Change the suspend clock reset and clock enable sequence.
- Get all reset and clock resources before enable them in cdns_clk_rst_init.
- commit message changed.
7. (patch 7)
- merge wrapper dts node and cdns3 node in usb dts.
- move the stg and sys USB 3.0 PHY confiuration to
PCIe PHY dts node.
- commit message changed.
- Add reset-names dts.

v3:
1. Add patch 1 - 4. Add USB PHY driver and dt-binding doc. USB PHY codes are moved to patch 3 and patch 4.
2. (patch 5)
- USB wrapper module dts document is moved to usb directory.
- Remove the 'dr_mode' and 'starfive,usb2-only' setting.
- Some dts format changes. dts binding check pass.
3. (patch 6)
- Remove the PHY codes.
- Search 'dr_mode' and phy setting from Cadence subnode.
4. (patch 7)
- Add USB PHY dts configurion.
- 'dr_mode' is moved to Cadence controller submode.

v2:
1. (patch 5) dt-binding changes. The document example is the same as dts config.
2. (patch 6) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 7) dts nodes sorted by the address after @

Minda Chen (7):
dt-bindings: phy: Add StarFive JH7110 USB document
dt-bindings: phy: Add StarFive JH7110 PCIe document
phy: starfive: add JH7110 USB 2.0 PHY driver.
phy: starfive: add JH7110 PCIE 2.0 PHY driver.
dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas
usb: cdns3: add StarFive JH7110 USB driver.
riscv: dts: starfive: add USB dts configuration for JH7110

 .../phy/starfive,jh7110-pcie-phy.yaml         |  58 +++
 .../bindings/phy/starfive,jh7110-usb-phy.yaml |  50 +++
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 +++++++
 MAINTAINERS                                   |  16 +
 .../jh7110-starfive-visionfive-2.dtsi         |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  44 ++
 drivers/phy/starfive/Kconfig                  |  22 +
 drivers/phy/starfive/Makefile                 |   2 +
 drivers/phy/starfive/phy-jh7110-pcie.c        | 197 +++++++++
 drivers/phy/starfive/phy-jh7110-usb.c         | 161 ++++++++
 drivers/usb/cdns3/Kconfig                     |  11 +
 drivers/usb/cdns3/Makefile                    |   1 +
 drivers/usb/cdns3/cdns3-starfive.c            | 378 ++++++++++++++++++
 drivers/usb/cdns3/core.h                      |   3 +
 14 files changed, 1086 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

Quoted 6 lines
Quoted 4 lines

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

What commits do you reference? How are they helpful?

I use "git format-patch --base=(commit) to generate patchset. Maybe I set the wrong base commit.

How are they helpful if these are private commits?

Best regards,
Krzysztof

author maintainer
#17 lore raw
Quoted 125 lines · Krzysztof Kozlowski
Quoted 124 lines · Minda Chen
Quoted 121 lines · Krzysztof Kozlowski
Quoted 19 lines · Minda Chen

This patchset adds USB driver and USB PHY for the StarFive JH7110 SoC. USB work mode is peripheral and using USB 2.0 PHY in VisionFive 2 board. The patch has been tested on the VisionFive 2 board.

This patchset should be applied after the patchset [1], [2] and[3]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is usb phy dt-binding document.
patch 2 is Pcie PHY dt-binding document.
patch 3 is USB 2.0 PHY driver.
patch 4 is PCIe PHY driver.
patch 5 is usb dt-binding document.
patch 6 is the wrapper module driver of Cadence USB3. USB controller IP is Cadence USB3. patch 7 is USB device tree configuration.

Quoted 4 lines

previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
v2: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

This is v2.

Quoted 88 lines

v3: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

changes
v4:
1. (patch 1) split PCIe PHY dt-binding doc to patch 2.
2. (patch 2) PCIe PHY add stg and sys con configuration to dt-binding doc.
3. (patch 3)
- split PCIe PHY driver to patch 4.
- replace dr_mode to phy mode in jh7110_usb2_phy.
4. (patch 4)
- Makefile and Kconfig sorted by alphabet sequence.
- Add PCIe PHY stg and syscon PHY connection configuration for USB 3.0.
5. (patch 5)
- commit message changed.
- merge wrapper dts node and cdns3 node in example.
- Add interrupts, reg, phy and dr_mode in property.
- Add reset-name in property example.
6. (patch 6)
- For dts node is merged, Using platform_device_alloc and platform_device_add to generate cadence sub device.
- IOMEM and IRQ resource are passed to Cadence sub device.
- Add PHY ops process for PHY dts setting can not be passed to Cadence USB driver.
- remove the stg and sys USB 3.0 PHY configuration.
- Change the suspend clock reset and clock enable sequence.
- Get all reset and clock resources before enable them in cdns_clk_rst_init.
- commit message changed.
7. (patch 7)
- merge wrapper dts node and cdns3 node in usb dts.
- move the stg and sys USB 3.0 PHY confiuration to
PCIe PHY dts node.
- commit message changed.
- Add reset-names dts.

v3:
1. Add patch 1 - 4. Add USB PHY driver and dt-binding doc. USB PHY codes are moved to patch 3 and patch 4.
2. (patch 5)
- USB wrapper module dts document is moved to usb directory.
- Remove the 'dr_mode' and 'starfive,usb2-only' setting.
- Some dts format changes. dts binding check pass.
3. (patch 6)
- Remove the PHY codes.
- Search 'dr_mode' and phy setting from Cadence subnode.
4. (patch 7)
- Add USB PHY dts configurion.
- 'dr_mode' is moved to Cadence controller submode.

v2:
1. (patch 5) dt-binding changes. The document example is the same as dts config.
2. (patch 6) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 7) dts nodes sorted by the address after @

Minda Chen (7):
dt-bindings: phy: Add StarFive JH7110 USB document
dt-bindings: phy: Add StarFive JH7110 PCIe document
phy: starfive: add JH7110 USB 2.0 PHY driver.
phy: starfive: add JH7110 PCIE 2.0 PHY driver.
dt-bindings: usb: Add StarFive JH7110 USB Bindings YAML schemas
usb: cdns3: add StarFive JH7110 USB driver.
riscv: dts: starfive: add USB dts configuration for JH7110

 .../phy/starfive,jh7110-pcie-phy.yaml         |  58 +++
 .../bindings/phy/starfive,jh7110-usb-phy.yaml |  50 +++
 .../bindings/usb/starfive,jh7110-usb.yaml     | 136 +++++++
 MAINTAINERS                                   |  16 +
 .../jh7110-starfive-visionfive-2.dtsi         |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  44 ++
 drivers/phy/starfive/Kconfig                  |  22 +
 drivers/phy/starfive/Makefile                 |   2 +
 drivers/phy/starfive/phy-jh7110-pcie.c        | 197 +++++++++
 drivers/phy/starfive/phy-jh7110-usb.c         | 161 ++++++++
 drivers/usb/cdns3/Kconfig                     |  11 +
 drivers/usb/cdns3/Makefile                    |   1 +
 drivers/usb/cdns3/cdns3-starfive.c            | 378 ++++++++++++++++++
 drivers/usb/cdns3/core.h                      |   3 +
 14 files changed, 1086 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 create mode 100644 Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml
 create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
 create mode 100644 drivers/phy/starfive/phy-jh7110-usb.c
 create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
Quoted 3 lines

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

What commits do you reference? How are they helpful?

I use "git format-patch --base=(commit) to generate patchset. Maybe I set the wrong base commit.

How are they helpful if these are private commits?

Quoted 1 line

Best regards,

Krzysztof

base-commit is not private commits.
I should set base commit 197b6b60ae7bc51dd0814953c562833143b292aa. This is 6.3-rc4 commit. But I set 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35. This is 6.3-rc4's previous commit.

#18 lore raw
Quoted 13 lines · Minda Chen
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

What commits do you reference? How are they helpful?

I use "git format-patch --base=(commit) to generate patchset. Maybe I set the wrong base commit.

Quoted 7 lines
Quoted 4 lines

How are they helpful if these are private commits?

Quoted 1 line

Best regards,

Krzysztof

base-commit is not private commits.
I should set base commit 197b6b60ae7bc51dd0814953c562833143b292aa. This is 6.3-rc4 commit. But I set 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35. This is 6.3-rc4's previous commit.

You missed the point. I am not talking about base commit. I am talking about your prerequisites, which are useless. What can we do with such SHA?

Best regards,
Krzysztof

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author maintainer
#19 lore raw
Quoted 22 lines · Krzysztof Kozlowski
Quoted 13 lines · Minda Chen
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

base-commit: 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35
prerequisite-patch-id: 24a6e3442ed1f5454ffb4a514cfd768436a87090
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7

fatal: bad object 55390537360f25c8b9cbfdc30b73ade004f436f7

What commits do you reference? How are they helpful?

I use "git format-patch --base=(commit) to generate patchset. Maybe I set the wrong base commit.

Quoted 7 lines
Quoted 4 lines

How are they helpful if these are private commits?

Quoted 1 line

Best regards,

Krzysztof

base-commit is not private commits.
I should set base commit 197b6b60ae7bc51dd0814953c562833143b292aa. This is 6.3-rc4 commit. But I set 0ec57cfa721fbd36b4c4c0d9ccc5d78a78f7fa35. This is 6.3-rc4's previous commit.

Quoted 6 lines

You missed the point. I am not talking about base commit. I am talking about your prerequisites, which are useless. What can we do with such SHA?

Best regards,
Krzysztof

OK, I will delete them