Skip to contentSkip to conversation

add NXP imx8mp usb support

PATCH Superseded Li Jun 4 participants 15 messages Sep 22, 2020 – Oct 2, 2020

Subsystems (5)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Li Jun

author
#0 lore raw

v3 cover add NXP imx8mp usb support

NXP imx8MPlus integrates 2 indentical dwc3 3.30b IP with additional wakeup logic to support low power, this wakeup logic has a separated interrupt which can generate events with suspend clock(32K); due to SoC integration limitation, a few quriks required, instead of create new properties flags, introduce platform data and pass it from glue layer to dwc3 core, those xhci private data can further pass to xhci-plat.

changes for v3:
- Add dwc3 core related clocks into dwc3 core node, and glue layer driver only handle the clocks(hsio and suspend) for glue block, this is to match real HW.
- Change to use property "xhci-64bit-support-disable" to disable 64bit DMA as imx8mp USB integration actully can't support it, so remove platform data in v2.
- Some changes of imx8mp usb driver binding doc to address comments from Rob

Changes for v2:
- Drop the 2 patches for new property("snps,xhci-dis-64bit-support-quirk") introduction, as suggested, imply by SoC compatible string, this is done by introduce dwc3 core platform data and pass the xhci_plat_priv to xhci-plat for those xhci quirks, so a new patch added:
[1/5] usb: dwc3: add platform data to dwc3 core device to pass data. this patch is based on Peter's one patch which is also in review:
https://patchwork.kernel.org/patch/11640945/
- dts change, use the USB power function of TRL logic instead of a always-on regulator to control vbus on/off.
- Some changes to address Peter's command on patch [2/5].

Li Jun (6):
dt-bindings: usb: xhci: add property to disable xhci 64bit support
usb: host: xhci-plat: add support of XHCI_NO_64BIT_SUPPORT via
property
dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings
usb: dwc3: add imx8mp dwc3 glue layer driver
arm64: dtsi: imx8mp: add usb nodes
arm64: dts: imx8mp-evk: enable usb1 as host mode

 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   |  99 ++++++
 Documentation/devicetree/bindings/usb/usb-xhci.txt |   3 +
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts       |  21 ++
 arch/arm64/boot/dts/freescale/imx8mp.dtsi          |  88 +++++
 drivers/usb/dwc3/Kconfig                           |  10 +
 drivers/usb/dwc3/Makefile                          |   1 +
 drivers/usb/dwc3/dwc3-imx8mp.c                     | 363 +++++++++++++++++++++
 drivers/usb/host/xhci-plat.c                       |   4 +
 8 files changed, 589 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml
 create mode 100644 drivers/usb/dwc3/dwc3-imx8mp.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 1/6 dt-bindings: usb: xhci: add property to disable xhci 64bit support

Add a property "xhci-64bit-support-disable" to disable xhci 64bit address dma, some SoC integration may not support 64bit DMA but the AC64 bit (bit 0) of HCCPARAMS1 is kept to be 1.

---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.txt +3 -0
index 0c5cff8..26446fb 100644
@@ -28,6 +28,9 @@ Optional properties:
   - quirk-broken-port-ped: set if the controller has broken port disable mechanism
   - imod-interval-ns: default interrupt moderation interval is 5000ns
   - phys : see usb-hcd.yaml in the current directory
+  - xhci-64bit-support-disable: set if the AC64 bit (bit 0) of HCCPARAMS1 is
+    set to be 1, but the controller actually can't handle 64-bit address
+    due to SoC integration.
 
 additionally the properties from usb-hcd.yaml (in the current directory) are
 supported.
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH v3 1/6] dt-bindings: usb: xhci: add property to disable xhci 64bit support

Quoted 3 lines · Li Jun

Add a property "xhci-64bit-support-disable" to disable xhci 64bit address dma, some SoC integration may not support 64bit DMA but the AC64 bit (bit 0) of HCCPARAMS1 is kept to be 1.

Use 'dma-ranges' for this.

Quoted 22 lines
---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.txt +3 -0
index 0c5cff8..26446fb 100644
@@ -28,6 +28,9 @@ Optional properties:
   - quirk-broken-port-ped: set if the controller has broken port disable mechanism
   - imod-interval-ns: default interrupt moderation interval is 5000ns
   - phys : see usb-hcd.yaml in the current directory
+  - xhci-64bit-support-disable: set if the AC64 bit (bit 0) of HCCPARAMS1 is
+    set to be 1, but the controller actually can't handle 64-bit address
+    due to SoC integration.
 
 additionally the properties from usb-hcd.yaml (in the current directory) are
 supported.
Signature · 1 line
2.7.4
author
#3 lore raw

RE: [PATCH v3 1/6] dt-bindings: usb: xhci: add property to disable xhci 64bit support

Hi Rob,

Quoted 15 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Wednesday, September 30, 2020 2:11 AM
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Anson Huang <[email protected]>; Aisheng Dong <[email protected]>; Peng Fan <[email protected]>; Andy Duan <[email protected]>; Joakim Zhang <[email protected]>; Horia Geanta <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/6] dt-bindings: usb: xhci: add property to disable xhci 64bit support

Quoted 6 lines
Quoted 3 lines · Li Jun

Add a property "xhci-64bit-support-disable" to disable xhci 64bit address dma, some SoC integration may not support 64bit DMA but the AC64 bit (bit 0) of HCCPARAMS1 is kept to be 1.

Use 'dma-ranges' for this.

Thanks, sent out v4 with dma-ranges property approach.

Li Jun

Quoted 26 lines

Documentation/devicetree/bindings/usb/usb-xhci.txt Optional properties: · line 28

Quoted 13 lines
---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.txt +0 -0
index 0c5cff8..26446fb 100644
@@ -28,6 +28,9 @@ Optional properties:
   - quirk-broken-port-ped: set if the controller has broken port disable

mechanism

Documentation/devicetree/bindings/usb/usb-xhci.txt Optional properties:

Quoted 3 lines
Documentation/devicetree/bindings/usb/usb-xhci.txt +1 -0
   - imod-interval-ns: default interrupt moderation interval is 5000ns
   - phys : see usb-hcd.yaml in the current directory
+  - xhci-64bit-support-disable: set if the AC64 bit (bit 0) of HCCPARAMS1

is

Quoted 8 lines
Documentation/devicetree/bindings/usb/usb-xhci.txt +2 -0
+    set to be 1, but the controller actually can't handle 64-bit address
+    due to SoC integration.
 
 additionally the properties from usb-hcd.yaml (in the current

directory) are supported.
--
2.7.4

author
#4 lore raw

PATCH v3 2/6 usb: host: xhci-plat: add support of XHCI_NO_64BIT_SUPPORT via property

In reply to Li Jun

Some OF platforms may also have the problem AC64 bit (bit 0) of HCCPARAMS1 set to be 1 but the controller actually can't support 64-bit address when SoC integration, so enable XHCI_NO_64BIT_SUPPORT via dts property "xhci-64bit-support-disable".

---
 drivers/usb/host/xhci-plat.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-plat.c +4 -0
index 3057cfc..2b63c8b 100644
@@ -300,6 +300,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
 
 		device_property_read_u32(tmpdev, "imod-interval-ns",
 					 &xhci->imod_interval);
+
+		if (device_property_read_bool(tmpdev,
+					      "xhci-64bit-support-disable"))
+			xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 	}
 
 	hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v3 3/6 dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

In reply to Li Jun

NXP imx8mp integrates 2 dwc3 3.30b IP and add some wakeup logic to support low power mode, the glue layer is for this wakeup functionality, which has a separated interrupt, can support wakeup from U3 and connect events for host, and vbus wakeup for device.

---
 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   | 99 ++++++++++++++++++++++
 1 file changed, 99 insertions(+)
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +99 -0
new file mode 100644
index 0000000..a5d5566
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (c) 2020 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/fsl,imx8mp-dwc3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP iMX8MP Soc USB Controller
+
+maintainers:
+  - Li Jun <[email protected]>
+
+properties:
+  compatible:
+    items:
+    - const: fsl,imx8mp-dwc3
+
+  reg:
+    maxItems: 1
+    description: Address and length of the register set for the wrapper of
+      dwc3 core on the SOC.
+
+  "#address-cells":
+    enum: [ 1, 2 ]
+
+  "#size-cells":
+    enum: [ 1, 2 ]
+
+  ranges: true
+
+  interrupts:
+    maxItems: 1
+    description: The interrupt that is asserted when a wakeup event is
+      received.
+
+  clocks:
+    description:
+      A list of phandle and clock-specifier pairs for the clocks
+      listed in clock-names.
+    items:
+      - description: system hsio root clock.
+      - description: suspend clock, used for usb wakeup logic.
+
+  clock-names:
+    items:
+      - const: hsio
+      - const: suspend
+
+# Required child node:
+
+patternProperties:
+  "^dwc3@[0-9a-f]+$":
+    type: object
+    description:
+      A child node must exist to represent the core DWC3 IP block
+      The content of the node is defined in dwc3.txt.
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+  - clocks
+  - clock-names
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    usb3_0: usb@32f10100 {
+      compatible = "fsl,imx8mp-dwc3";
+      reg = <0x32f10100 0x8>;
+      clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+               <&clk IMX8MP_CLK_USB_ROOT>;
+      clock-names = "hsio", "suspend";
+      interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      ranges;
+
+      dwc3@38100000 {
+        compatible = "snps,dwc3";
+        reg = <0x38100000 0x10000>;
+        clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+                 <&clk IMX8MP_CLK_USB_CORE_REF>,
+                 <&clk IMX8MP_CLK_USB_ROOT>;
+        clock-names = "bus_early", "ref", "suspend";
+        assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+        assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+        assigned-clock-rates = <500000000>;
+        interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+        phys = <&usb3_phy0>, <&usb3_phy0>;
+        phy-names = "usb2-phy", "usb3-phy";
+      };
+    };
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH v3 3/6] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 23 lines · Li Jun

NXP imx8mp integrates 2 dwc3 3.30b IP and add some wakeup logic to support low power mode, the glue layer is for this wakeup functionality, which has a separated interrupt, can support wakeup from U3 and connect events for host, and vbus wakeup for device.

---
 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   | 99 ++++++++++++++++++++++
 1 file changed, 99 insertions(+)
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +5 -0
new file mode 100644
index 0000000..a5d5566
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (c) 2020 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/fsl,imx8mp-dwc3.yaml#

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP iMX8MP Soc USB Controller
+
+maintainers:
+  - Li Jun <[email protected]>
+
+properties:
+  compatible:
+    items:

Items are not necessary

Quoted 43 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +43 -0
+    - const: fsl,imx8mp-dwc3
+
+  reg:
+    maxItems: 1
+    description: Address and length of the register set for the wrapper of
+      dwc3 core on the SOC.
+
+  "#address-cells":
+    enum: [ 1, 2 ]
+
+  "#size-cells":
+    enum: [ 1, 2 ]
+
+  ranges: true
+
+  interrupts:
+    maxItems: 1
+    description: The interrupt that is asserted when a wakeup event is
+      received.
+
+  clocks:
+    description:
+      A list of phandle and clock-specifier pairs for the clocks
+      listed in clock-names.
+    items:
+      - description: system hsio root clock.
+      - description: suspend clock, used for usb wakeup logic.
+
+  clock-names:
+    items:
+      - const: hsio
+      - const: suspend
+
+# Required child node:
+
+patternProperties:
+  "^dwc3@[0-9a-f]+$":
+    type: object
+    description:
+      A child node must exist to represent the core DWC3 IP block
+      The content of the node is defined in dwc3.txt.
+
+required:

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +10 -0
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+  - clocks
+  - clock-names
+  - interrupts
+
+additionalProperties: false

Do you actually validate your DTS changes with this schema? They do not look like passing the validation...

Best regards,
Krzysztof

author
#7 lore raw

RE: [PATCH v3 3/6] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 123 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Tuesday, September 22, 2020 10:33 PM
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Anson Huang <[email protected]>; Aisheng Dong <[email protected]>; Peng Fan <[email protected]>; Andy Duan <[email protected]>; Joakim Zhang <[email protected]>; Horia Geanta <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 3/6] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 9 lines · Li Jun

NXP imx8mp integrates 2 dwc3 3.30b IP and add some wakeup logic to support low power mode, the glue layer is for this wakeup functionality, which has a separated interrupt, can support wakeup from U3 and connect events for host, and vbus wakeup for device.

---
 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   | 99

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

Quoted 11 lines
 1 file changed, 99 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml b/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file mode 100644
index 0000000..a5d5566

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 4

Quoted 4 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +4 -0
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright
+(c) 2020 NXP %YAML 1.2
+---
+$id:

+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

Quoted 1 line

+cetree.org%2Fschemas%2Fusb%2Ffsl%2Cimx8mp-dwc3.yaml%23&amp;data=02%7C

Quoted 1 line

+01%7Cjun.li%40nxp.com%7Ceaedeb64ec15472183d108d85f046841%7C686ea1d3bc

Quoted 1 line

+2b4c6fa92cd99c5c301635%7C0%7C0%7C637363819819667936&amp;sdata=IvFQ8l0

Quoted 3 lines

+7VXUMbG8riyITSTZb1P50oIXs%2BkAV%2FeX8ntk%3D&amp;reserved=0 +$schema:

+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

Quoted 1 line

+cetree.org%2Fmeta-schemas%2Fcore.yaml%23&amp;data=02%7C01%7Cjun.li%40

Quoted 1 line

+nxp.com%7Ceaedeb64ec15472183d108d85f046841%7C686ea1d3bc2b4c6fa92cd99c

Quoted 1 line

+5c301635%7C0%7C0%7C637363819819677934&amp;sdata=H3%2BcwgiLKBynHv4N%2F

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +10 -0
+dogBi3SwaizVHmqieJXVrErv0I%3D&amp;reserved=0
+
+title: NXP iMX8MP Soc USB Controller
+
+maintainers:
+  - Li Jun <[email protected]>
+
+properties:
+  compatible:
+    items:

Items are not necessary

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml

Quoted 5 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +5 -0
+    - const: fsl,imx8mp-dwc3
+
+  reg:
+    maxItems: 1
+    description: Address and length of the register set for the wrapper

of

Quoted 43 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +43 -0
+      dwc3 core on the SOC.
+
+  "#address-cells":
+    enum: [ 1, 2 ]
+
+  "#size-cells":
+    enum: [ 1, 2 ]
+
+  ranges: true
+
+  interrupts:
+    maxItems: 1
+    description: The interrupt that is asserted when a wakeup event is
+      received.
+
+  clocks:
+    description:
+      A list of phandle and clock-specifier pairs for the clocks
+      listed in clock-names.
+    items:
+      - description: system hsio root clock.
+      - description: suspend clock, used for usb wakeup logic.
+
+  clock-names:
+    items:
+      - const: hsio
+      - const: suspend
+
+# Required child node:
+
+patternProperties:
+  "^dwc3@[0-9a-f]+$":
+    type: object
+    description:
+      A child node must exist to represent the core DWC3 IP block
+      The content of the node is defined in dwc3.txt.
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
Quoted 8 lines

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 68

Quoted 5 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +5 -0
+  - clocks
+  - clock-names
+  - interrupts
+
+additionalProperties: false

Do you actually validate your DTS changes with this schema? They do not look like passing the validation...

I did run dt_binding_check, maybe I missed some errors as there are always some other failures, I will re-run to double check.

Li Jun

Quoted 3 lines

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v3 3/6] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 133 lines · Jun Li
Quoted 124 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Tuesday, September 22, 2020 10:33 PM
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Anson Huang <[email protected]>; Aisheng Dong <[email protected]>; Peng Fan <[email protected]>; Andy Duan <[email protected]>; Joakim Zhang <[email protected]>; Horia Geanta <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 3/6] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 9 lines · Li Jun

NXP imx8mp integrates 2 dwc3 3.30b IP and add some wakeup logic to support low power mode, the glue layer is for this wakeup functionality, which has a separated interrupt, can support wakeup from U3 and connect events for host, and vbus wakeup for device.

---
 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   | 99

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

Quoted 11 lines
 1 file changed, 99 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml b/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file mode 100644
index 0000000..a5d5566

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 4

Quoted 4 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +4 -0
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright
+(c) 2020 NXP %YAML 1.2
+---
+$id:

+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

Quoted 1 line

+cetree.org%2Fschemas%2Fusb%2Ffsl%2Cimx8mp-dwc3.yaml%23&amp;data=02%7C

Quoted 1 line

+01%7Cjun.li%40nxp.com%7Ceaedeb64ec15472183d108d85f046841%7C686ea1d3bc

Quoted 1 line

+2b4c6fa92cd99c5c301635%7C0%7C0%7C637363819819667936&amp;sdata=IvFQ8l0

Quoted 3 lines

+7VXUMbG8riyITSTZb1P50oIXs%2BkAV%2FeX8ntk%3D&amp;reserved=0 +$schema:

+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

Quoted 1 line

+cetree.org%2Fmeta-schemas%2Fcore.yaml%23&amp;data=02%7C01%7Cjun.li%40

Quoted 1 line

+nxp.com%7Ceaedeb64ec15472183d108d85f046841%7C686ea1d3bc2b4c6fa92cd99c

Quoted 1 line

+5c301635%7C0%7C0%7C637363819819677934&amp;sdata=H3%2BcwgiLKBynHv4N%2F

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +10 -0
+dogBi3SwaizVHmqieJXVrErv0I%3D&amp;reserved=0
+
+title: NXP iMX8MP Soc USB Controller
+
+maintainers:
+  - Li Jun <[email protected]>
+
+properties:
+  compatible:
+    items:

Items are not necessary

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml

Quoted 5 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +5 -0
+    - const: fsl,imx8mp-dwc3
+
+  reg:
+    maxItems: 1
+    description: Address and length of the register set for the wrapper

of

Quoted 43 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +43 -0
+      dwc3 core on the SOC.
+
+  "#address-cells":
+    enum: [ 1, 2 ]
+
+  "#size-cells":
+    enum: [ 1, 2 ]
+
+  ranges: true
+
+  interrupts:
+    maxItems: 1
+    description: The interrupt that is asserted when a wakeup event is
+      received.
+
+  clocks:
+    description:
+      A list of phandle and clock-specifier pairs for the clocks
+      listed in clock-names.
+    items:
+      - description: system hsio root clock.
+      - description: suspend clock, used for usb wakeup logic.
+
+  clock-names:
+    items:
+      - const: hsio
+      - const: suspend
+
+# Required child node:
+
+patternProperties:
+  "^dwc3@[0-9a-f]+$":
+    type: object
+    description:
+      A child node must exist to represent the core DWC3 IP block
+      The content of the node is defined in dwc3.txt.
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
Quoted 8 lines

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 68

Quoted 5 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +5 -0
+  - clocks
+  - clock-names
+  - interrupts
+
+additionalProperties: false

Do you actually validate your DTS changes with this schema? They do not look like passing the validation...

Quoted 2 lines

I did run dt_binding_check, maybe I missed some errors as there are always some other failures, I will re-run to double check.

dt_binding_check is good for the binding and example. Except this you need to run dtbs_check so your new DTS will be checked. In this case it points to missing properties in the bindings.

Best regards,
Krzysztof

author
#9 lore raw

PATCH v3 4/6 usb: dwc3: add imx8mp dwc3 glue layer driver

In reply to Li Jun

imx8mp SoC integrate dwc3 3.30b IP and has some customizations to support low power, which has a seprated wakeup irq and additional logic to wakeup usb from low power mode both for host mode and device mode.

---
 drivers/usb/dwc3/Kconfig       |  10 ++
 drivers/usb/dwc3/Makefile      |   1 +
 drivers/usb/dwc3/dwc3-imx8mp.c | 363 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 374 insertions(+)
drivers/usb/dwc3/Kconfig +10 -0
index 7a23045..2133acf 100644
@@ -139,4 +139,14 @@ config USB_DWC3_QCOM
 	  for peripheral mode support.
 	  Say 'Y' or 'M' if you have one such device.
 
+config USB_DWC3_IMX8MP
+	tristate "NXP iMX8MP Platform"
+	depends on OF && COMMON_CLK
+	depends on (ARCH_MXC && ARM64) || COMPILE_TEST
+	default USB_DWC3
+	help
+	  NXP iMX8M Plus SoC use DesignWare Core IP for USB2/3
+	  functionality.
+	  Say 'Y' or 'M' if you have one such device.
+
 endif
drivers/usb/dwc3/Makefile +1 -0
index ae86da0..2259f88 100644
@@ -51,3 +51,4 @@ obj-$(CONFIG_USB_DWC3_MESON_G12A)	+= dwc3-meson-g12a.o
 obj-$(CONFIG_USB_DWC3_OF_SIMPLE)	+= dwc3-of-simple.o
 obj-$(CONFIG_USB_DWC3_ST)		+= dwc3-st.o
 obj-$(CONFIG_USB_DWC3_QCOM)		+= dwc3-qcom.o
+obj-$(CONFIG_USB_DWC3_IMX8MP)		+= dwc3-imx8mp.o
drivers/usb/dwc3/dwc3-imx8mp.c new file +363 -0

363 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#10 lore raw

PATCH v3 5/6 arm64: dtsi: imx8mp: add usb nodes

In reply to Li Jun

imx8mp integrates 2 identical dwc3 based USB3 controllers and Synopsys phys, each instance has additional wakeup logic to support low power mode, so the glue layer need a node with dwc3 core sub node.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +88 -0
index 9de2aa1..1b7ed4c 100644
@@ -750,5 +750,93 @@
 			reg = <0x3d800000 0x400000>;
 			interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
 		};
+
+		usb3_phy0: usb-phy@381f0040 {
+			compatible = "fsl,imx8mp-usb-phy";
+			reg = <0x381f0040 0x40>;
+			clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>;
+			clock-names = "phy";
+			assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>;
+			assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
+		usb3_0: usb@32f10100 {
+			compatible = "fsl,imx8mp-dwc3";
+			reg = <0x32f10100 0x8>;
+			clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+				 <&clk IMX8MP_CLK_USB_ROOT>;
+			clock-names = "hsio", "suspend";
+			interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			status = "disabled";
+
+			usb_dwc3_0: dwc3@38100000 {
+				compatible = "snps,dwc3";
+				reg = <0x38100000 0x10000>;
+				clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+					 <&clk IMX8MP_CLK_USB_CORE_REF>,
+					 <&clk IMX8MP_CLK_USB_ROOT>;
+				clock-names = "bus_early", "ref", "suspend";
+				assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+				assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+				assigned-clock-rates = <500000000>;
+				interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&usb3_phy0>, <&usb3_phy0>;
+				phy-names = "usb2-phy", "usb3-phy";
+				snps,dis-u2-freeclk-exists-quirk;
+				xhci-64bit-support-disable;
+				status = "disabled";
+			};
+
+		};
+
+		usb3_phy1: usb-phy@382f0040 {
+			compatible = "fsl,imx8mp-usb-phy";
+			reg = <0x382f0040 0x40>;
+			clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>;
+			clock-names = "phy";
+			assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>;
+			assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
+		usb3_1: usb@32f10108 {
+			compatible = "fsl,imx8mp-dwc3";
+			reg = <0x32f10108 0x8>;
+			clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+				 <&clk IMX8MP_CLK_USB_ROOT>;
+			clock-names = "hsio", "suspend";
+			assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>;
+			assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+			assigned-clock-rates = <500000000>;
+			interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			status = "disabled";
+
+			usb_dwc3_1: dwc3@38200000 {
+				compatible = "snps,dwc3";
+				reg = <0x38200000 0x10000>;
+				clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+					 <&clk IMX8MP_CLK_USB_CORE_REF>,
+					 <&clk IMX8MP_CLK_USB_ROOT>;
+				clock-names = "bus_early", "ref", "suspend";
+				assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+				assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+				assigned-clock-rates = <500000000>;
+				interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&usb3_phy1>, <&usb3_phy1>;
+				phy-names = "usb2-phy", "usb3-phy";
+				snps,dis-u2-freeclk-exists-quirk;
+				xhci-64bit-support-disable;
+				status = "disabled";
+			};
+		};
 	};
 };
Signature · 1 line
2.7.4
#11 lore raw

Re: [PATCH v3 5/6] arm64: dtsi: imx8mp: add usb nodes

Quoted 71 lines · Li Jun

imx8mp integrates 2 identical dwc3 based USB3 controllers and Synopsys phys, each instance has additional wakeup logic to support low power mode, so the glue layer need a node with dwc3 core sub node.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +52 -0
index 9de2aa1..1b7ed4c 100644
@@ -750,5 +750,93 @@
                        reg = <0x3d800000 0x400000>;
                        interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
                };
+
+               usb3_phy0: usb-phy@381f0040 {
+                       compatible = "fsl,imx8mp-usb-phy";
+                       reg = <0x381f0040 0x40>;
+                       clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>;
+                       clock-names = "phy";
+                       assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>;
+                       assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+                       #phy-cells = <0>;
+                       status = "disabled";
+               };
+
+               usb3_0: usb@32f10100 {
+                       compatible = "fsl,imx8mp-dwc3";
+                       reg = <0x32f10100 0x8>;
+                       clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+                                <&clk IMX8MP_CLK_USB_ROOT>;
+                       clock-names = "hsio", "suspend";
+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+                       status = "disabled";
+
+                       usb_dwc3_0: dwc3@38100000 {
+                               compatible = "snps,dwc3";
+                               reg = <0x38100000 0x10000>;
+                               clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+                                        <&clk IMX8MP_CLK_USB_CORE_REF>,
+                                        <&clk IMX8MP_CLK_USB_ROOT>;
+                               clock-names = "bus_early", "ref", "suspend";
+                               assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+                               assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+                               assigned-clock-rates = <500000000>;
+                               interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+                               phys = <&usb3_phy0>, <&usb3_phy0>;
+                               phy-names = "usb2-phy", "usb3-phy";
+                               snps,dis-u2-freeclk-exists-quirk;
+                               xhci-64bit-support-disable;
+                               status = "disabled";
+                       };
+
+               };
+
+               usb3_phy1: usb-phy@382f0040 {
+                       compatible = "fsl,imx8mp-usb-phy";
+                       reg = <0x382f0040 0x40>;
+                       clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>;
+                       clock-names = "phy";
+                       assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>;
+                       assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+                       #phy-cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi line 814

Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +10 -0
+                       status = "disabled";
+               };
+
+               usb3_1: usb@32f10108 {
+                       compatible = "fsl,imx8mp-dwc3";
+                       reg = <0x32f10108 0x8>;
+                       clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+                                <&clk IMX8MP_CLK_USB_ROOT>;
+                       clock-names = "hsio", "suspend";
+                       assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>;

This does not validate against your own schema:
arch/arm64/boot/dts/freescale/imx8mp-evk.dt.yaml: usb@32f10108:
'assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' do not match any of the regexes: '^dwc3@[0-9a-f]+$', 'pinctrl-[0-9]+'

Please, stop adding new schema and DTS which from day one have warnings/violations.

It's really a lot of effort (and commits) to clean this up later.

Best regards,
Krzysztof

maintainer
#12 lore raw

Re: [PATCH v3 5/6] arm64: dtsi: imx8mp: add usb nodes

In reply to Li Jun
Quoted 14 lines · Li Jun

imx8mp integrates 2 identical dwc3 based USB3 controllers and Synopsys phys, each instance has additional wakeup logic to support low power mode, so the glue layer need a node with dwc3 core sub node.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
index 9de2aa1..1b7ed4c 100644

arch/arm64/boot/dts/freescale/imx8mp.dtsi line 814

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +7 -0
+		usb3_1: usb@32f10108 {
+			compatible = "fsl,imx8mp-dwc3";
+			reg = <0x32f10108 0x8>;
+			clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+				 <&clk IMX8MP_CLK_USB_ROOT>;
+			clock-names = "hsio", "suspend";
+			assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>;

In Linux-5.9-rc6 this clock doesn't exist anymore. Should be IMX8MP_CLK_HSIO_AXI

Quoted 14 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +14 -0
+			assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+			assigned-clock-rates = <500000000>;
+			interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			status = "disabled";
+
+			usb_dwc3_1: dwc3@38200000 {
+				compatible = "snps,dwc3";
+				reg = <0x38200000 0x10000>;
+				clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+					 <&clk IMX8MP_CLK_USB_CORE_REF>,
+					 <&clk IMX8MP_CLK_USB_ROOT>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi line 838

Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +10 -0
+				clock-names = "bus_early", "ref", "suspend";
+				assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+				assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+				assigned-clock-rates = <500000000>;
+				interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&usb3_phy1>, <&usb3_phy1>;
+				phy-names = "usb2-phy", "usb3-phy";
+				snps,dis-u2-freeclk-exists-quirk;
+				xhci-64bit-support-disable;
+				status = "disabled";

Does it make sense for a board to enable the parent node and leave this one disabled? If not you can drop this status = "disabled" here.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#13 lore raw

RE: [PATCH v3 5/6] arm64: dtsi: imx8mp: add usb nodes

Quoted 27 lines

-----Original Message-----
From: Sascha Hauer <[email protected]>
Sent: Wednesday, September 23, 2020 3:51 PM
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; Anson Huang <[email protected]>; Aisheng Dong <[email protected]>; Peng Fan <[email protected]>; Andy Duan <[email protected]>; Joakim Zhang <[email protected]>; Horia Geanta <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 5/6] arm64: dtsi: imx8mp: add usb nodes

Quoted 10 lines · Li Jun

imx8mp integrates 2 identical dwc3 based USB3 controllers and Synopsys phys, each instance has additional wakeup logic to support low power mode, so the glue layer need a node with dwc3 core sub node.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 88
+++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
Quoted 15 lines

arch/arm64/boot/dts/freescale/imx8mp.dtsi line 814

Quoted 12 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +7 -0
index 9de2aa1..1b7ed4c 100644
+		usb3_1: usb@32f10108 {
+			compatible = "fsl,imx8mp-dwc3";
+			reg = <0x32f10108 0x8>;
+			clocks = <&clk IMX8MP_CLK_HSIO_ROOT>,
+				 <&clk IMX8MP_CLK_USB_ROOT>;
+			clock-names = "hsio", "suspend";
+			assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>;

In Linux-5.9-rc6 this clock doesn't exist anymore. Should be IMX8MP_CLK_HSIO_AXI

Will change.

Quoted 20 lines
Quoted 20 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +19 -0
+			assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+			assigned-clock-rates = <500000000>;
+			interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			status = "disabled";
+
+			usb_dwc3_1: dwc3@38200000 {
+				compatible = "snps,dwc3";
+				reg = <0x38200000 0x10000>;
+				clocks = <&clk IMX8MP_CLK_HSIO_AXI>,
+					 <&clk IMX8MP_CLK_USB_CORE_REF>,
+					 <&clk IMX8MP_CLK_USB_ROOT>;
+				clock-names = "bus_early", "ref", "suspend";
+				assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+				assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>;
+				assigned-clock-rates = <500000000>;
+				interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
Quoted 8 lines

arch/arm64/boot/dts/freescale/imx8mp.dtsi line 838

Quoted 5 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +5 -0
+				phys = <&usb3_phy1>, <&usb3_phy1>;
+				phy-names = "usb2-phy", "usb3-phy";
+				snps,dis-u2-freeclk-exists-quirk;
+				xhci-64bit-support-disable;
+				status = "disabled";

Does it make sense for a board to enable the parent node and leave this one disabled? If not you can drop this status = "disabled" here.

OK, will drop it.

Thanks
Li Jun

Quoted 13 lines

Sascha

--
Pengutronix e.K. | |
Steuerwalder Str. 21 |
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pe
ngutronix.de%2F&amp;data=02%7C01%7Cjun.li%40nxp.com%7Cadbbbfe2edec4cca1 38908d85f956382%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6373644425 20571896&amp;sdata=07ku8kTQCv8lv8qdRiOcU3CX4lly3503LO4bUDIbjow%3D&amp;r eserved=0 |

31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#14 lore raw

PATCH v3 6/6 arm64: dts: imx8mp-evk: enable usb1 as host mode

In reply to Li Jun

Enable usb host port with type-A connector on imx8mp-evk board.

---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +21 -0
index 432c1a7..0cb3b16 100644
@@ -176,6 +176,21 @@
 	};
 };
 
+&usb3_phy1 {
+	status = "okay";
+};
+
+&usb3_1 {
+	status = "okay";
+};
+
+&usb_dwc3_1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb1_vbus>;
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usdhc2 {
 	assigned-clocks = <&clk IMX8MP_CLK_USDHC2>;
 	assigned-clock-rates = <400000000>;
@@ -276,6 +291,12 @@
 		>;
 	};
 
+	pinctrl_usb1_vbus: usb1grp {
+		fsl,pins = <
+			MX8MP_IOMUXC_GPIO1_IO14__HSIOMIX_usb2_OTG_PWR	0x19
+		>;
+	};
+
 	pinctrl_usdhc2: usdhc2grp {
 		fsl,pins = <
 			MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK	0x190
Signature · 1 line
2.7.4