Add JH7110 USB driver support
Subsystems (9)
Minda Chen
maintainerv2 cover Add JH7110 USB driver support
This patchset adds USB driver 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] and patch [2]:
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
This patchset is base on v6.3-rc1
patch 1 is usb phy dt-binding document.
patch 2 is the glue layer of Cadence USB3 and USB phy setting. USB controller IP is Cadence USB3. patch 3 is USB device tree configuration.
previous version
---
v1: https://patchwork.kernel.org/project/linux-usb/patch/[email protected]/
changes
v2
1. (patch 1) dt-binding check test pass and no warning. The document example is the same as dts config.
2. (patch 2) using dev_err_probe and syscon_regmap_lookup_by_phandle_args function. Some formats changes
3. (patch 3) dts nodes sorted by the address after @
Minda Chen (3):
dt-bindings: phy: Add StarFive JH7110 USB dt-binding
usb: cdns3: add StarFive JH7110 USB glue layer
dts: usb: add StarFive JH7110 USB dts configuration.
.../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++ MAINTAINERS | 7 + .../jh7110-starfive-visionfive-2.dtsi | 6 + arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 ++ drivers/usb/cdns3/Kconfig | 11 + drivers/usb/cdns3/Makefile | 1 + drivers/usb/cdns3/cdns3-starfive.c | 374 ++++++++++++++++++ 7 files changed, 595 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
base-commit: 8ca09d5fa3549d142c2080a72a4c70ce389163cd
prerequisite-patch-id: 0e6d1df3ba9aecd925a0c604b9d91f7143be88ca
prerequisite-patch-id: ac150a8c622e858e088df8121093d448df49c245
prerequisite-patch-id: 044263ef2fb9f1e5a586edbf85d5f67814a28430
prerequisite-patch-id: 74390c129b92fb35a7088e2e5c869632c4cb3d06
prerequisite-patch-id: de93ebec041625e940f195403069b46ec17fc99c
prerequisite-patch-id: 1b2d0982b18da060c82134f05bf3ce16425bac8d
prerequisite-patch-id: 090ba4b78d47bc19204916e76fdbc70021785388
prerequisite-patch-id: a5d9e0f7d4f8163f566678894cf693015119f2d9
prerequisite-patch-id: f01a78c30f6f1970b4db7758c339bd4e5c882b16
prerequisite-patch-id: 417736eb958e1158c60a5ed74bc2350394321a80
prerequisite-patch-id: ff9fe0b043a5f7f74a1f6af5cebc4793c6f14ce7
prerequisite-patch-id: 290602062703e666191c20ca02f2840471a6bf4f
prerequisite-patch-id: f0b29adbb18edffbfeec7292c5f33e2bbeb30945
prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f
prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9
prerequisite-patch-id: dbb0c0151b8bdf093e6ce79fd2fe3f60791a6e0b
prerequisite-patch-id: ea9a6d0313dd3936c8de0239dc2072c3360a2f6b
prerequisite-patch-id: d57e95d31686772abc4c4d5aa1cadc344dc293cd
prerequisite-patch-id: 27197d69922ad1f33a193dfe0a8cc2b27d67982d
prerequisite-patch-id: f9ce88e490c2473c3c94ad63fa26bc91829ce2cc
prerequisite-patch-id: 7acbc9c924e802712d3574dd74a6b3576089f78c
prerequisite-patch-id: b9b8fda5e8cd2dd4c9101ec03f4c8fb8e8caa573
prerequisite-patch-id: 63a6de4511f1a7ae974551e7097af9bb91db1b0d
prerequisite-patch-id: aaff99c0bdd1604048d0713b44084ad4604816e1
Signature · 7 lines
2.17.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Minda Chen
maintainerPATCH v2 3/3 dts: usb: add StarFive JH7110 USB dts configuration.
USB phy dts configuration. Also includes Cadence USB subnode configuration.
--- .../jh7110-starfive-visionfive-2.dtsi | 6 +++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 44 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6 -0
@@ -236,3 +236,9 @@ }; }; }; + +&usb0 { + starfive,usb2-only; + dr_mode = "peripheral"; + status = "okay"; +};
arch/riscv/boot/dts/starfive/jh7110.dtsi +38 -0
@@ -362,6 +362,44 @@ status = "disabled"; }; + usb0: usbphy@10200000 { + compatible = "starfive,jh7110-usb"; + reg = <0x0 0x10210000 0x0 0x1000>, + <0x0 0x10200000 0x0 0x1000>; + reg-names = "usb3", "usb2"; + clocks = <&syscrg JH7110_SYSCLK_USB_125M>, + <&stgcrg JH7110_STGCLK_USB0_APP_125>, + <&stgcrg JH7110_STGCLK_USB0_LPM>, + <&stgcrg JH7110_STGCLK_USB0_STB>, + <&stgcrg JH7110_STGCLK_USB0_APB>, + <&stgcrg JH7110_STGCLK_USB0_AXI>, + <&stgcrg JH7110_STGCLK_USB0_UTMI_APB>; + clock-names = "usb_125m", "usb0_app_125", "usb0_lpm", + "usb0_stb", "usb0_apb", "usb0_axi", "usb0_utmi_apb"; + resets = <&stgcrg JH7110_STGRST_USB0_PWRUP>, + <&stgcrg JH7110_STGRST_USB0_APB>, + <&stgcrg JH7110_STGRST_USB0_AXI>, + <&stgcrg JH7110_STGRST_USB0_UTMI_APB>; + starfive,stg-syscon = <&stg_syscon 0x4 0xc4 0x148 0x1f4>; + starfive,sys-syscon = <&sys_syscon 0x18>; + status = "disabled"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + usbdrd_cdns3: usb@10100000 { + compatible = "cdns,usb3"; + 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"; + phy-names = "cdns3,usb3-phy", "cnds3,usb2-phy"; + maximum-speed = "super-speed"; + }; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;
Signature · 7 lines
2.17.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Minda Chen
maintainerPATCH v2 2/3 usb: cdns3: add StarFive JH7110 USB glue layer
In reply to Minda ChenThere is a Cadence USB3 core for JH7110 SoCs, the cdns core is the child for this glue layer device.
--- MAINTAINERS | 7 + drivers/usb/cdns3/Kconfig | 11 + drivers/usb/cdns3/Makefile | 1 + drivers/usb/cdns3/cdns3-starfive.c | 374 +++++++++++++++++++++++++++++ 4 files changed, 393 insertions(+) create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
MAINTAINERS +7 -0
@@ -19970,6 +19970,13 @@ M: William Qiu <[email protected]> S: Supported F: Documentation/devicetree/bindings/soc/starfive/jh7110-syscon.yaml +STARFIVE JH71X0 USB PHY DRIVERS +M: Emil Renner Berthing <[email protected]> +M: Minda Chen <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/phy/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
@@ -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
@@ -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 +374 -0
374 lines not on this page · raw message
Signature · 7 lines
2.17.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Minda Chen
maintainerPATCH v2 1/3 dt-bindings: phy: Add StarFive JH7110 USB dt-binding
In reply to Minda ChenAdd StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.
--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +158 -0
@@ -0,0 +1,158 @@ +# 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 and 3.0 PHY + +maintainers: + - Minda Chen<[email protected]> + +properties: + compatible: + items: + - const: starfive,jh7110-usb + + reg: + maxItems: 2 + + reg-names: + items: + - const: usb3 + - const: usb2 + + clocks: + items: + - description: usb 125m clock + - description: app 125m clock + - description: lpm clock + - description: stb clock + - description: apb clock + - description: axi clock + - description: utmi apb clock + + clock-names: + items: + - const: usb_125m + - const: usb0_app_125 + - const: usb0_lpm + - const: usb0_stb + - const: usb0_apb + - const: usb0_axi + - const: usb0_utmi_apb + + resets: + items: + - description: USB0_PWRUP reset + - description: USB0_APB reset + - description: USB0_AXI reset + - description: USB0_UTMI_APB reset + + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller sys_syscon node. + - description: offset of SYS_SYSCONSAIF__SYSCFG register for USB. + description: + The phandle to System Register Controller syscon node and the offset + of SYS_SYSCONSAIF__SYSCFG register for USB. + + starfive,stg-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller stg_syscon node. + - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register3 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. Total 4 regsisters offset + for USB. + + dr_mode: + description: PHY mode. + enum: + - host + - peripheral + - otg + + "#address-cells": + maximum: 2 + + "#size-cells": + maximum: 2 + + ranges: true + + starfive,usb2-only: + type: boolean + description: Set USB using usb 2.0 phy. Supprt USB 2.0 only + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - starfive,sys-syscon + - starfive,stg-syscon + - dr_mode + - "#address-cells" + - "#size-cells" + - ranges + +patternProperties: + "^usb@[0-9a-f]+$": + type: object + description: | + usbphy node should have '1' usb controller subnode. + It could be Cadence USB3 DRD controller. + Cadence USB3 should follow the bindings specified in + Documentation/devicetree/bindings/usb/cdns,usb3.yaml + +additionalProperties: false + +examples: + - | + usbphy@10200000 { + compatible = "starfive,jh7110-usb"; + reg = <0x10210000 0x1000>, + <0x10200000 0x1000>; + reg-names = "usb3", "usb2"; + clocks = <&syscrg 95>, + <&stgcrg 6>, + <&stgcrg 4>, + <&stgcrg 5>, + <&stgcrg 1>, + <&stgcrg 3>, + <&stgcrg 2>; + clock-names = "usb_125m", "usb0_app_125", "usb0_lpm", + "usb0_stb", "usb0_apb", "usb0_axi", "usb0_utmi_apb"; + resets = <&stgcrg 10>, + <&stgcrg 8>, + <&stgcrg 7>, + <&stgcrg 9>; + starfive,stg-syscon = <&stg_syscon 0x4 0xc4 0x148 0x1f4>; + starfive,sys-syscon = <&sys_syscon 0x18>; + dr_mode = "host"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + usb@10100000 { + compatible = "cdns,usb3"; + reg = <0x10100000 0x10000>, + <0x10110000 0x10000>, + <0x10120000 0x10000>; + reg-names = "otg", "xhci", "dev"; + interrupts = <100>, <108>, <110>; + interrupt-names = "host", "peripheral", "otg"; + phy-names = "cdns3,usb3-phy", "cnds3,usb2-phy"; + maximum-speed = "super-speed"; + }; + };
Signature · 7 lines
2.17.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
Quoted 9 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.example.dtb: usb@10100000: phy-names:1: 'anyOf' conditional failed, one must be fixed:
'cdns3,usb2-phy' was expected
'cdns3,usb3-phy' was expected
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.example.dtb: usb@10100000: 'phys' is a dependency of 'phy-names'
From schema: /usr/local/lib/python3.10/dist-packages/dtschema/schemas/phy/phy-consumer.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
In reply to Minda ChenDocumentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Quoted 14 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yamlDocumentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +0
-0
Filename should match the compatible. The filename seems more correct than the compatible...
Quoted 6 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +5
-0@@ -0,0 +1,158 @@ +# 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#
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ +title: StarFive USB 2.0 and 3.0 PHY + +maintainers: + - Minda Chen<[email protected]> + +properties: + compatible: + items: + - const: starfive,jh7110-usb
What's the USB controller called?
Quoted 18 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +18
-0+ + reg: + maxItems: 2 + + reg-names: + items: + - const: usb3 + - const: usb2 + + clocks: + items: + - description: usb 125m clock + - description: app 125m clock + - description: lpm clock + - description: stb clock + - description: apb clock + - description: axi clock + - description: utmi apb clock
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ + clock-names: + items: + - const: usb_125m + - const: usb0_app_125 + - const: usb0_lpm + - const: usb0_stb + - const: usb0_apb + - const: usb0_axi + - const: usb0_utmi_apb
usb_ and usb0_ is redundant, drop.
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 55
Quoted 12 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +12
-0+ + resets: + items: + - description: USB0_PWRUP reset + - description: USB0_APB reset + - description: USB0_AXI reset + - description: USB0_UTMI_APB reset + + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items:
Are there multiple entries of phandle+offset because this says there are. You want '- items:' here to limit it to 1 phandle+offset.
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ - description: phandle to System Register Controller sys_syscon node. + - description: offset of SYS_SYSCONSAIF__SYSCFG register for USB. + description: + The phandle to System Register Controller syscon node and the offset + of SYS_SYSCONSAIF__SYSCFG register for USB. + + starfive,stg-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items:
Same here.
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 76
Quoted 11 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +11
-0+ - description: phandle to System Register Controller stg_syscon node. + - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register3 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. Total 4 regsisters offset + for USB. + + dr_mode:
Usually this belongs in the controller node.
Quoted 7 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +7
-0+ description: PHY mode. + enum: + - host + - peripheral + - otg + + "#address-cells":
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 93
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ maximum: 2 + + "#size-cells": + maximum: 2 + + ranges: true + + starfive,usb2-only: + type: boolean + description: Set USB using usb 2.0 phy. Supprt USB 2.0 only
The 'maximum-speed' property in the controller should be enough. Why is this needed.
Being a PHY, you are missing #phy-cells.
Quoted 13 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +13
-0+ +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - starfive,sys-syscon + - starfive,stg-syscon + - dr_mode + - "#address-cells" + - "#size-cells"
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 116
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ - ranges + +patternProperties: + "^usb@[0-9a-f]+$": + type: object + description: | + usbphy node should have '1' usb controller subnode. + It could be Cadence USB3 DRD controller. + Cadence USB3 should follow the bindings specified in + Documentation/devicetree/bindings/usb/cdns,usb3.yaml
Why is the controller a child of the phy?
Quoted 22 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +22
-0+ +additionalProperties: false + +examples: + - | + usbphy@10200000 { + compatible = "starfive,jh7110-usb"; + reg = <0x10210000 0x1000>, + <0x10200000 0x1000>; + reg-names = "usb3", "usb2"; + clocks = <&syscrg 95>, + <&stgcrg 6>, + <&stgcrg 4>, + <&stgcrg 5>, + <&stgcrg 1>, + <&stgcrg 3>, + <&stgcrg 2>; + clock-names = "usb_125m", "usb0_app_125", "usb0_lpm", + "usb0_stb", "usb0_apb", "usb0_axi", "usb0_utmi_apb"; + resets = <&stgcrg 10>, + <&stgcrg 8>, + <&stgcrg 7>,
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 148
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ <&stgcrg 9>; + starfive,stg-syscon = <&stg_syscon 0x4 0xc4 0x148 0x1f4>; + starfive,sys-syscon = <&sys_syscon 0x18>; + dr_mode = "host"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + usb@10100000 { + compatible = "cdns,usb3";
This needs a platform specific compatible.
Quoted 13 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ reg = <0x10100000 0x10000>, + <0x10110000 0x10000>, + <0x10120000 0x10000>; + reg-names = "otg", "xhci", "dev"; + interrupts = <100>, <108>, <110>; + interrupt-names = "host", "peripheral", "otg"; + phy-names = "cdns3,usb3-phy", "cnds3,usb2-phy"; + maximum-speed = "super-speed"; + }; + };Signature · 1 line
2.17.1
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Minda Chen
maintainerRe: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
In reply to Rob HerringQuoted 36 lines · Rob Herring
Quoted 9 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.example.dtb: usb@10100000: phy-names:1: 'anyOf' conditional failed, one must be fixed:
'cdns3,usb2-phy' was expected
'cdns3,usb3-phy' was expected
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.example.dtb: usb@10100000: 'phys' is a dependency of 'phy-names'
From schema:/usr/local/lib/python3.10/dist-packages/dtschema/schemas/phy/phy-consumer.yamldoc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
Quoted 6 lines
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that
DT_SCHEMA_FILEScan be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
I am sorry about this, I just run dtbs_check, not dt_binding_check. Next version I will fix it.
Minda Chen
maintainerRe: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
In reply to Rob HerringQuoted 10 lines · Rob Herring
Quoted 9 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
Quoted 5 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +0
-0Filename should match the compatible. The filename seems more correct than the compatible...
[1] jh7110 USB dts configure is similar to Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml But we have PHY (10200000). So I will add Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml as a wrap level.
starfive,jh7110-usb-phy.yaml contains only phy setting.
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +9
-0@@ -0,0 +1,158 @@ +# 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 and 3.0 PHY + +maintainers:
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 15
Quoted 6 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +6
-0+ - Minda Chen<[email protected]> + +properties: + compatible: + items: + - const: starfive,jh7110-usbWhat's the USB controller called?
I will change to "starfive,jh7110-usb-phy"
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +22
-0+ + reg: + maxItems: 2 + + reg-names: + items: + - const: usb3 + - const: usb2 + + clocks: + items: + - description: usb 125m clock + - description: app 125m clock + - description: lpm clock + - description: stb clock + - description: apb clock + - description: axi clock + - description: utmi apb clock + + clock-names: + items: + - const: usb_125m
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 43
Quoted 6 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +6
-0+ - const: usb0_app_125 + - const: usb0_lpm + - const: usb0_stb + - const: usb0_apb + - const: usb0_axi + - const: usb0_utmi_apb
usb_andusb0_is redundant, drop.
ok
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +4
-0+ + resets: + items: + - description: USB0_PWRUP reset
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 55
Quoted 8 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +8
-0+ - description: USB0_APB reset + - description: USB0_AXI reset + - description: USB0_UTMI_APB reset + + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items:
ok
Quoted 14 lines
Are there multiple entries of phandle+offset because this says there are. You want '- items:' here to limit it to 1 phandle+offset.
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ - description: phandle to System Register Controller sys_syscon node. + - description: offset of SYS_SYSCONSAIF__SYSCFG register for USB. + description: + The phandle to System Register Controller syscon node and the offset + of SYS_SYSCONSAIF__SYSCFG register for USB. + + starfive,stg-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items:
Quoted 2 lines
Same here.
ok
Quoted 12 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 76
Quoted 11 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +11
-0+ - description: phandle to System Register Controller stg_syscon node. + - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register3 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. Total 4 regsisters offset + for USB. + + dr_mode:
Quoted 2 lines
Usually this belongs in the controller node.
cdns3 usb controller IP default set to host mode. If cdns3 usb controller "dr_mode" set to "peripheral", cdns3 controller can't be registered.
in driver/usb/cdns3/core.c
132 } else if (cdns->dr_mode != dr_mode) {
133 dev_err(dev, "Incorrect DRD configuration\n");
134 return -EINVAL;
135 }
If dr_mode is not set in int wrap level, peripheral mode can not be work.
And I see other USB PHY contain dr-mode setting.
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +12
-0+ description: PHY mode. + enum: + - host + - peripheral + - otg + + "#address-cells": + maximum: 2 + + "#size-cells": + maximum: 2 +
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 93
Quoted 5 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +5
-0+ ranges: true + + starfive,usb2-only: + type: boolean + description: Set USB using usb 2.0 phy. Supprt USB 2.0 onlyThe 'maximum-speed' property in the controller should be enough. Why is this needed.
maybe I can delete this setting.
Quoted 2 lines
Being a PHY, you are missing #phy-cells.
ok
Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +17
-0+ +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - starfive,sys-syscon + - starfive,stg-syscon + - dr_mode + - "#address-cells" + - "#size-cells" + - ranges + +patternProperties: + "^usb@[0-9a-f]+$":
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 116
Quoted 6 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +6
-0+ type: object + description: | + usbphy node should have '1' usb controller subnode. + It could be Cadence USB3 DRD controller. + Cadence USB3 should follow the bindings specified in + Documentation/devicetree/bindings/usb/cdns,usb3.yamlWhy is the controller a child of the phy?
same as [1]. I will change this .
Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +26
-0+ +additionalProperties: false + +examples: + - | + usbphy@10200000 { + compatible = "starfive,jh7110-usb"; + reg = <0x10210000 0x1000>, + <0x10200000 0x1000>; + reg-names = "usb3", "usb2"; + clocks = <&syscrg 95>, + <&stgcrg 6>, + <&stgcrg 4>, + <&stgcrg 5>, + <&stgcrg 1>, + <&stgcrg 3>, + <&stgcrg 2>; + clock-names = "usb_125m", "usb0_app_125", "usb0_lpm", + "usb0_stb", "usb0_apb", "usb0_axi", "usb0_utmi_apb"; + resets = <&stgcrg 10>, + <&stgcrg 8>, + <&stgcrg 7>, + <&stgcrg 9>; + starfive,stg-syscon = <&stg_syscon 0x4 0xc4 0x148 0x1f4>; + starfive,sys-syscon = <&sys_syscon 0x18>; + dr_mode = "host";
Quoted 9 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 148
Quoted 6 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +6
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges; + + usb@10100000 { + compatible = "cdns,usb3";This needs a platform specific compatible.
same as [1]
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ reg = <0x10100000 0x10000>, + <0x10110000 0x10000>, + <0x10120000 0x10000>; + reg-names = "otg", "xhci", "dev"; + interrupts = <100>, <108>, <110>; + interrupt-names = "host", "peripheral", "otg"; + phy-names = "cdns3,usb3-phy", "cnds3,usb2-phy"; + maximum-speed = "super-speed"; + }; + };Signature · 1 line
2.17.1
Re: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
In reply to Minda ChenQuoted 2 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.
Subject: drop second/last, redundant "binding". The "dt-bindings" prefix is already stating that these are bindings.
Quoted 13 lines
Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yamlDocumentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +0
-0
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0@@ -0,0 +1,158 @@ +# 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 and 3.0 PHY + +maintainers: + - Minda Chen<[email protected]>
Missing space
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 14
Quoted 4 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +4
-0+ +properties: + compatible: + items:
Drop items, it's just one item.
Quoted 85 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +85
-0+ - const: starfive,jh7110-usb + + reg: + maxItems: 2 + + reg-names: + items: + - const: usb3 + - const: usb2 + + clocks: + items: + - description: usb 125m clock + - description: app 125m clock + - description: lpm clock + - description: stb clock + - description: apb clock + - description: axi clock + - description: utmi apb clock + + clock-names: + items: + - const: usb_125m + - const: usb0_app_125 + - const: usb0_lpm + - const: usb0_stb + - const: usb0_apb + - const: usb0_axi + - const: usb0_utmi_apb + + resets: + items: + - description: USB0_PWRUP reset + - description: USB0_APB reset + - description: USB0_AXI reset + - description: USB0_UTMI_APB reset + + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller sys_syscon node. + - description: offset of SYS_SYSCONSAIF__SYSCFG register for USB. + description: + The phandle to System Register Controller syscon node and the offset + of SYS_SYSCONSAIF__SYSCFG register for USB. + + starfive,stg-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller stg_syscon node. + - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register3 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. Total 4 regsisters offset + for USB. + + dr_mode: + description: PHY mode. + enum: + - host + - peripheral + - otg + + "#address-cells": + maximum: 2 + + "#size-cells": + maximum: 2 + + ranges: true + + starfive,usb2-only: + type: boolean + description: Set USB using usb 2.0 phy. Supprt USB 2.0 only + +required: + - compatible + - reg + - reg-names + - clocks
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 109
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ - clock-names + - resets + - starfive,sys-syscon + - starfive,stg-syscon + - dr_mode + - "#address-cells" + - "#size-cells" + - ranges + +patternProperties:
This goes before required block
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 116
Quoted 7 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +7
-0+ "^usb@[0-9a-f]+$": + type: object + description: | + usbphy node should have '1' usb controller subnode. + It could be Cadence USB3 DRD controller. + Cadence USB3 should follow the bindings specified in + Documentation/devicetree/bindings/usb/cdns,usb3.yaml
$ref instead of free form text
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Minda Chen
maintainerRe: [PATCH v2 1/3] dt-bindings: phy: Add StarFive JH7110 USB dt-binding
Quoted 147 lines · Krzysztof Kozlowski
Quoted 2 lines · Minda Chen
Add StarFive JH7110 SoC USB 3.0 phy dt-binding.
USB controller is cadence USB 3.0 IP.Subject: drop second/last, redundant "binding". The "dt-bindings" prefix is already stating that these are bindings.
Quoted 13 lines
Signed-off-by Minda Chen <[email protected]>--- .../bindings/phy/starfive,jh7110-usb-phy.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yamlDocumentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +0
-0Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0@@ -0,0 +1,158 @@ +# 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 and 3.0 PHY + +maintainers: + - Minda Chen<[email protected]>Missing space
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 14
Quoted 4 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +4
-0+ +properties: + compatible: + items:Drop items, it's just one item.
Quoted 85 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +85
-0+ - const: starfive,jh7110-usb + + reg: + maxItems: 2 + + reg-names: + items: + - const: usb3 + - const: usb2 + + clocks: + items: + - description: usb 125m clock + - description: app 125m clock + - description: lpm clock + - description: stb clock + - description: apb clock + - description: axi clock + - description: utmi apb clock + + clock-names: + items: + - const: usb_125m + - const: usb0_app_125 + - const: usb0_lpm + - const: usb0_stb + - const: usb0_apb + - const: usb0_axi + - const: usb0_utmi_apb + + resets: + items: + - description: USB0_PWRUP reset + - description: USB0_APB reset + - description: USB0_AXI reset + - description: USB0_UTMI_APB reset + + starfive,sys-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller sys_syscon node. + - description: offset of SYS_SYSCONSAIF__SYSCFG register for USB. + description: + The phandle to System Register Controller syscon node and the offset + of SYS_SYSCONSAIF__SYSCFG register for USB. + + starfive,stg-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + items: + - description: phandle to System Register Controller stg_syscon node. + - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for USB. + - description: register3 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. Total 4 regsisters offset + for USB. + + dr_mode: + description: PHY mode. + enum: + - host + - peripheral + - otg + + "#address-cells": + maximum: 2 + + "#size-cells": + maximum: 2 + + ranges: true + + starfive,usb2-only: + type: boolean + description: Set USB using usb 2.0 phy. Supprt USB 2.0 only + +required: + - compatible + - reg + - reg-names + - clocksDocumentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 109
Quoted 10 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +10
-0+ - clock-names + - resets + - starfive,sys-syscon + - starfive,stg-syscon + - dr_mode + - "#address-cells" + - "#size-cells" + - ranges + +patternProperties:This goes before required block
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml line 116
Quoted 7 lines
Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml new file +7
-0+ "^usb@[0-9a-f]+$": + type: object + description: | + usbphy node should have '1' usb controller subnode. + It could be Cadence USB3 DRD controller. + Cadence USB3 should follow the bindings specified in + Documentation/devicetree/bindings/usb/cdns,usb3.yaml
Quoted 3 lines
$ref instead of free form text
ok, thanks. Next version I will follow the comments to change.
Quoted 3 lines
Best regards,
Krzysztof