Skip to contentSkip to conversation

Hikey960/970 Enable USB and PCI on such boards

PATCH Superseded Mauro Carvalho Chehab 2 participants 12 messages Nov 16, 2021 – Dec 7, 2021

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

cover Hikey960/970 Enable USB and PCI on such boards

Hi Wei/Rob,

Now that all USB and PCI/PHY drivers/patches were upstreamed, the only remaining bits for USB to work on both HiKey 960 and HiKey 970 and for PCI to work on HiKey 970 are the devicetree logic.

Those patches add them.

Please apply.

Regards,
Mauro

John Stultz (1):
arm64: dts: HiSilicon: Add usb mux hub for HiKey 960

Manivannan Sadhasivam (1):
arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller
hardware

Mauro Carvalho Chehab (2):
arm64: dts: HiSilicon: Add support for HiKey 970 USB3 PHY
arm64: dts: HiSilicon: Add usb mux hub for HiKey 970

Yu Chen (1):
dt-bindings: misc: add schema for USB hub on Kirin devices

 .../bindings/misc/hisilicon,hikey-usb.yaml    |  87 ++++++++++
 .../boot/dts/hisilicon/hi3660-hikey960.dts    |  35 +++-
 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 106 ++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3670.dtsi     | 163 ++++++++++++++++++
 4 files changed, 389 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon,hikey-usb.yaml
Signature · 8 lines
2.33.1



_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 1/5 dt-bindings: misc: add schema for USB hub on Kirin devices

From: Yu Chen <[email protected]>

This patch adds binding documentation to support USB HUB and USB data role switch of HiSilicon HiKey960 and HiKey970 boards.

[mchehab: updated OF schema and added HiKey970 example]

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../bindings/misc/hisilicon,hikey-usb.yaml    | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon,hikey-usb.yaml
Documentation/devicetree/bindings/misc/hisilicon,hikey-usb.yaml new file +87 -0
new file mode 100644
index 000000000000..761ab686121a
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/hisilicon,hikey-usb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HiKey960/970 onboard USB GPIO Hub
+
+maintainers:
+  - John Stultz <[email protected]>
+
+description: |
+  Supports the onboard USB GPIO hubs found on HiKey960/970.
+  Such hubs require a power supply for the USB I/O. Depending on the
+  exact hub model, after USB I/O is powered up, a reset should be needed.
+
+  It also acts as a role-switch intermediary to detect the state of
+  the USB-C port, to switch the hub into dual-role USB-C or host mode,
+  which enables and powers up the onboard USB-A host ports.
+
+  Schematics about such hubs can be found here:
+    https://github.com/96boards/documentation/raw/master/consumer/hikey/hikey960/hardware-docs/HiKey960_Schematics.pdf
+    https://www.96boards.org/documentation/consumer/hikey/hikey970/hardware-docs/files/hikey970-schematics.pdf
+
+properties:
+  compatible:
+    enum:
+      - hisilicon,usbhub
+
+  typec-vbus-gpios:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: phandle to the typec-vbus gpio
+
+  otg-switch-gpios:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: phandle to the otg-switch gpio
+
+  hub-reset-en-gpios:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: phandle to the hub reset gpio
+
+  usb-role-switch:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Support role switch.
+
+  hub-vdd-supply:
+    description: regulator for hub power
+
+  port:
+    description: |
+      describe hadware connections between USB endpoints.
+      Two ports are supported: the first being the endpoint that will
+      be notified by this driver, and the second being the endpoint
+      that notifies this driver of a role switch.
+
+required:
+  - compatible
+  - hub-vdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    usb-hub {
+        compatible = "hisilicon,usbhub";
+        typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+        otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+        hub-reset-en-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
+        hub-vdd-supply = <&usb_hub_vdd>;
+        usb-role-switch;
+        port {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            usb_ep0: endpoint@0 {
+                reg = <0>;
+                remote-endpoint = <&dwc3_role_switch>;
+            };
+            usb_ep1: endpoint@1 {
+                reg = <1>;
+                remote-endpoint = <&rt1711h_ep>;
+            };
+        };
+    };
Signature · 1 line
2.33.1
#2 lore raw

PATCH 2/5 arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware

In reply to Mauro Carvalho Chehab

From: Manivannan Sadhasivam <[email protected]>

Add DTS bindings for the HiKey 970 board's PCIe hardware.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 107 ++++++++++++++++++++++
 1 file changed, 107 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +107 -0
index 636c8817df7e..225dccbcb064 100644
@@ -176,6 +176,12 @@ sctrl: sctrl@fff0a000 {
 			#clock-cells = <1>;
 		};
 
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3670-pmctrl", "syscon";
+			reg = <0x0 0xfff31000 0x0 0x1000>;
+			#clock-cells = <1>;
+		};
+
 		iomcu: iomcu@ffd7e000 {
 			compatible = "hisilicon,hi3670-iomcu", "syscon";
 			reg = <0x0 0xffd7e000 0x0 0x1000>;
@@ -659,6 +665,107 @@ gpio28: gpio@fff1d000 {
 			clock-names = "apb_pclk";
 		};
 
+		pcie_phy: pcie-phy@fc000000 {
+			compatible = "hisilicon,hi970-pcie-phy";
+			reg = <0x0 0xfc000000 0x0 0x80000>;
+
+			phy-supply = <&ldo33>;
+
+			clocks = <&crg_ctrl HI3670_CLK_GATE_PCIEPHY_REF>,
+				 <&crg_ctrl HI3670_CLK_GATE_PCIEAUX>,
+				 <&crg_ctrl HI3670_PCLK_GATE_PCIE_PHY>,
+				 <&crg_ctrl HI3670_PCLK_GATE_PCIE_SYS>,
+				 <&crg_ctrl HI3670_ACLK_GATE_PCIE>;
+			clock-names = "phy_ref", "aux",
+				      "apb_phy", "apb_sys",
+				      "aclk";
+
+			/* vboost iboost pre post main */
+			hisilicon,eye-diagram-param = <0xffffffff 0xffffffff
+						       0xffffffff 0xffffffff
+						       0xffffffff>;
+
+			#phy-cells = <0>;
+		};
+
+		pcie@f4000000 {
+			compatible = "hisilicon,kirin970-pcie";
+			reg = <0x0 0xf4000000 0x0 0x1000000>,
+			      <0x0 0xfc180000 0x0 0x1000>,
+			      <0x0 0xf5000000 0x0 0x2000>;
+			reg-names = "dbi", "apb", "config";
+			#address-cells = <3>;
+			#size-cells = <2>;
+			device_type = "pci";
+			phys = <&pcie_phy>;
+			ranges = <0x02000000 0x0 0x00000000
+				  0x0 0xf6000000
+				  0x0 0x02000000>;
+			num-lanes = <1>;
+			#interrupt-cells = <1>;
+			interrupts = <GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "msi";
+			interrupt-map-mask = <0 0 0 7>;
+			interrupt-map = <0x0 0 0 1
+					 &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
+					<0x0 0 0 2
+					 &gic GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>,
+					<0x0 0 0 3
+					 &gic GIC_SPI 284 IRQ_TYPE_LEVEL_HIGH>,
+					<0x0 0 0 4
+					 &gic GIC_SPI 285 IRQ_TYPE_LEVEL_HIGH>;
+			reset-gpios = <&gpio7 0 0>;
+			hisilicon,clken-gpios = <&gpio27 3 0>, <&gpio17 0 0>,
+						<&gpio20 6 0>;
+			pcie@0,0 { // Lane 0: PCIe switch: Bus 1, Device 0
+				reg = <0 0 0 0 0>;
+				compatible = "pciclass,0604";
+				device_type = "pci";
+				#address-cells = <3>;
+				#size-cells = <2>;
+				ranges;
+
+				pcie@0,0 { // Lane 0: upstream
+					reg = <0 0 0 0 0>;
+					compatible = "pciclass,0604";
+					device_type = "pci";
+					#address-cells = <3>;
+					#size-cells = <2>;
+					ranges;
+
+					pcie@1,0 { // Lane 4: M.2
+						reg = <0x0800 0 0 0 0>;
+						compatible = "pciclass,0604";
+						device_type = "pci";
+						reset-gpios = <&gpio3 1 0>;
+						#address-cells = <3>;
+						#size-cells = <2>;
+						ranges;
+					};
+
+					pcie@5,0 { // Lane 5: Mini PCIe
+						reg = <0x2800 0 0 0 0>;
+						compatible = "pciclass,0604";
+						device_type = "pci";
+						reset-gpios = <&gpio27 4 0 >;
+						#address-cells = <3>;
+						#size-cells = <2>;
+						ranges;
+					};
+
+					pcie@7,0 { // Lane 6: Ethernet
+						reg = <0x3800 0 0 0 0>;
+						compatible = "pciclass,0604";
+						device_type = "pci";
+						reset-gpios = <&gpio25 2 0 >;
+						#address-cells = <3>;
+						#size-cells = <2>;
+						ranges;
+					};
+				};
+			};
+		};
+
 		/* UFS */
 		ufs: ufs@ff3c0000 {
 			compatible = "hisilicon,hi3670-ufs", "jedec,ufs-2.1";
Signature · 1 line
2.33.1
maintainer
#3 lore raw

Re: [PATCH 2/5] arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware

Hi Mauro,

Quoted 20 lines · Mauro Carvalho Chehab

From: Manivannan Sadhasivam <[email protected]>

Add DTS bindings for the HiKey 970 board's PCIe hardware.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 107 ++++++++++++++++++++++
 1 file changed, 107 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +0 -0
index 636c8817df7e..225dccbcb064 100644

arch/arm64/boot/dts/hisilicon/hi3670.dtsi sctrl: sctrl@fff0a000 { · line 180

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +2 -0
@@ -176,6 +176,12 @@ sctrl: sctrl@fff0a000 {
 			#clock-cells = <1>;
 		};
 
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3670-pmctrl", "syscon";

The "hi3670-pmctrl" is not documented in the devicetree binding documents yet. Could we remove this part this time?
Thanks!

Best Regards,
Wei

#4 lore raw

PATCH 1/1 bindings: clock: hi3670-clock.txt: add pmctrl compatible

Add a compatible for the Power Management domain controller, which is needed in order to control power for the PCI devices on HiKey 970.

---
 Documentation/devicetree/bindings/clock/hi3670-clock.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/hi3670-clock.txt +1 -0
index 66f3697eca78..8e9f12a3ba5b 100644
@@ -15,6 +15,7 @@ Required Properties:
 	- "hisilicon,hi3670-iomcu"
 	- "hisilicon,hi3670-media1-crg"
 	- "hisilicon,hi3670-media2-crg"
+	- "hisilicon,hi3670-pmctrl"
 
 - reg: physical base address of the controller and length of memory mapped
   region.
Signature · 1 line
2.33.1
#5 lore raw

Re: [PATCH 2/5] arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware

In reply to Wei Xu

Em Tue, 7 Dec 2021 16:09:16 +0800
Wei Xu <[email protected]> escreveu:

Quoted 26 lines

Hi Mauro,

Quoted 23 lines · Mauro Carvalho Chehab

From: Manivannan Sadhasivam <[email protected]>

Add DTS bindings for the HiKey 970 board's PCIe hardware.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 107 ++++++++++++++++++++++
 1 file changed, 107 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +0 -0
index 636c8817df7e..225dccbcb064 100644
@@ -176,6 +176,12 @@ sctrl: sctrl@fff0a000 {
 			#clock-cells = <1>;
 		};
 
Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3670.dtsi sctrl: sctrl@fff0a000 { · line 180

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +2 -0
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3670-pmctrl", "syscon";  

The "hi3670-pmctrl" is not documented in the devicetree binding documents yet. Could we remove this part this time?

Without that, the PCI PHY won't work.

IMO, the best would be to just add this compatible to hi3670-clock, where it belongs.

Just sent a patch.

Regards,
Mauro

maintainer
#6 lore raw

Re: [PATCH 2/5] arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware

Hi Mauro,

Quoted 35 lines · Mauro Carvalho Chehab

Em Tue, 7 Dec 2021 16:09:16 +0800
Wei Xu <[email protected]> escreveu:

Quoted 26 lines

Hi Mauro,

Quoted 23 lines · Mauro Carvalho Chehab

From: Manivannan Sadhasivam <[email protected]>

Add DTS bindings for the HiKey 970 board's PCIe hardware.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 107 ++++++++++++++++++++++
 1 file changed, 107 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +0 -0
index 636c8817df7e..225dccbcb064 100644
@@ -176,6 +176,12 @@ sctrl: sctrl@fff0a000 {
 			#clock-cells = <1>;
 		};
 
Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3670.dtsi sctrl: sctrl@fff0a000 { · line 180

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +2 -0
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3670-pmctrl", "syscon";  

The "hi3670-pmctrl" is not documented in the devicetree binding documents yet. Could we remove this part this time?

Quoted 6 lines

Without that, the PCI PHY won't work.

IMO, the best would be to just add this compatible to hi3670-clock, where it belongs.

Just sent a patch.

Got it.
Thanks!

Best Regards,
Wei

Quoted 6 lines

Regards,
Mauro

.

#7 lore raw

PATCH 3/5 arm64: dts: HiSilicon: Add support for HiKey 970 USB3 PHY

In reply to Mauro Carvalho Chehab

Add the USB3 bindings for Kirin 970 phy and HiKey 970 board.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 83 +++++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3670.dtsi     | 56 +++++++++++++
 2 files changed, 139 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts +83 -0
index 7c32f5fd5cc5..60594db07041 100644
@@ -430,3 +430,86 @@ &uart6 {
 	label = "LS-UART1";
 	status = "okay";
 };
+
+&usb_phy {
+	phy-supply = <&ldo17>;
+};
+
+&i2c1 {
+	status = "okay";
+
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";
+		reg = <0x4e>;
+		status = "okay";
+		interrupt-parent = <&gpio27>;
+		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_cfg_func>;
+
+		usb_con: connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			data-role = "dual";
+			power-role = "dual";
+			try-power-role = "sink";
+			source-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
+			sink-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)
+				PDO_VAR(5000, 5000, 1000)>;
+			op-sink-microwatt = <10000000>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				port@1 {
+					reg = <1>;
+					usb_con_ss: endpoint {
+						remote-endpoint = <&dwc3_ss>;
+					};
+				};
+			};
+		};
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&hikey_usb_ep1>;
+			};
+		};
+	};
+};
+
+&i2c2 {
+	/* USB HUB is on this bus at address 0x44 */
+	status = "okay";
+};
+
+&dwc3 { /* USB */
+	dr_mode = "otg";
+	maximum-speed = "super-speed";
+	phy_type = "utmi";
+	snps,dis-del-phy-power-chg-quirk;
+	snps,dis_u2_susphy_quirk;
+	snps,dis_u3_susphy_quirk;
+	snps,tx_de_emphasis_quirk;
+	snps,tx_de_emphasis = <1>;
+	snps,dis-split-quirk;
+	snps,gctl-reset-quirk;
+	usb-role-switch;
+	role-switch-default-mode = "host";
+	port {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		dwc3_role_switch: endpoint@0 {
+			reg = <0>;
+			remote-endpoint = <&hikey_usb_ep0>;
+		};
+
+		dwc3_ss: endpoint@1 {
+			reg = <1>;
+			remote-endpoint = <&usb_con_ss>;
+		};
+	};
+};
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +56 -0

67 lines not on this page · raw message

Signature · 1 line
2.33.1
maintainer
#8 lore raw

Re: [PATCH 3/5] arm64: dts: HiSilicon: Add support for HiKey 970 USB3 PHY

Hi Mauro,

Quoted 133 lines · Mauro Carvalho Chehab

Add the USB3 bindings for Kirin 970 phy and HiKey 970 board.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 83 +++++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3670.dtsi     | 56 +++++++++++++
 2 files changed, 139 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts +83 -0
index 7c32f5fd5cc5..60594db07041 100644
@@ -430,3 +430,86 @@ &uart6 {
 	label = "LS-UART1";
 	status = "okay";
 };
+
+&usb_phy {
+	phy-supply = <&ldo17>;
+};
+
+&i2c1 {
+	status = "okay";
+
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";
+		reg = <0x4e>;
+		status = "okay";
+		interrupt-parent = <&gpio27>;
+		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_cfg_func>;
+
+		usb_con: connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			data-role = "dual";
+			power-role = "dual";
+			try-power-role = "sink";
+			source-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
+			sink-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)
+				PDO_VAR(5000, 5000, 1000)>;
+			op-sink-microwatt = <10000000>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				port@1 {
+					reg = <1>;
+					usb_con_ss: endpoint {
+						remote-endpoint = <&dwc3_ss>;
+					};
+				};
+			};
+		};
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&hikey_usb_ep1>;
+			};
+		};
+	};
+};
+
+&i2c2 {
+	/* USB HUB is on this bus at address 0x44 */
+	status = "okay";
+};
+
+&dwc3 { /* USB */
+	dr_mode = "otg";
+	maximum-speed = "super-speed";
+	phy_type = "utmi";
+	snps,dis-del-phy-power-chg-quirk;
+	snps,dis_u2_susphy_quirk;
+	snps,dis_u3_susphy_quirk;
+	snps,tx_de_emphasis_quirk;
+	snps,tx_de_emphasis = <1>;
+	snps,dis-split-quirk;
+	snps,gctl-reset-quirk;
+	usb-role-switch;
+	role-switch-default-mode = "host";
+	port {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		dwc3_role_switch: endpoint@0 {
+			reg = <0>;
+			remote-endpoint = <&hikey_usb_ep0>;
+		};
+
+		dwc3_ss: endpoint@1 {
+			reg = <1>;
+			remote-endpoint = <&usb_con_ss>;
+		};
+	};
+};
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +15 -0
index 225dccbcb064..b47654b50139 100644
@@ -8,6 +8,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/hi3670-clock.h>
+#include <dt-bindings/usb/pd.h>
 
 / {
 	compatible = "hisilicon,hi3670";
@@ -892,5 +893,60 @@ i2c4: i2c@fdf0d000 {
 			pinctrl-0 = <&i2c4_pmx_func &i2c4_cfg_func>;
 			status = "disabled";
 		};
+
+		usb3_otg_bc: usb3_otg_bc@ff200000 {
+			compatible = "syscon", "simple-mfd";
+			reg = <0x0 0xff200000 0x0 0x1000>;
+
+			usb_phy: usbphy {
+				compatible = "hisilicon,hi3670-usb-phy";
+				#phy-cells = <0>;
+				hisilicon,pericrg-syscon = <&crg_ctrl>;
+				hisilicon,pctrl-syscon = <&pctrl>;
+				hisilicon,sctrl-syscon = <&sctrl>;
+				hisilicon,eye-diagram-param = <0xFDFEE4>;
+				hisilicon,tx-vboost-lvl = <0x5>;
+			};

arch/arm64/boot/dts/hisilicon/hi3670.dtsi i2c4: i2c@fdf0d000 { · line 919

Quoted 10 lines
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +10 -0
+		};
+
+		usb31_misc_rst: usb31_misc_rst_controller {
+			compatible = "hisilicon,hi3660-reset";
+			#reset-cells = <2>;
+			hisi,rst-syscon = <&usb3_otg_bc>;
+		};
+
+		usb3: hisi_dwc3 {
+			compatible = "hisilicon,hi3670-dwc3";

Could you please also add a binding document for the "hi3670-dwc3"? The driver part has added the compatible string as you pointed out before. Thanks!

Best Regards,
Wei

#9 lore raw

Re: [PATCH 3/5] arm64: dts: HiSilicon: Add support for HiKey 970 USB3 PHY

Em Tue, 7 Dec 2021 16:50:49 +0800
Wei Xu <[email protected]> escreveu:

Quoted 141 lines

Hi Mauro,

Quoted 138 lines · Mauro Carvalho Chehab

Add the USB3 bindings for Kirin 970 phy and HiKey 970 board.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 83 +++++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3670.dtsi     | 56 +++++++++++++
 2 files changed, 139 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts +83 -0
index 7c32f5fd5cc5..60594db07041 100644
@@ -430,3 +430,86 @@ &uart6 {
 	label = "LS-UART1";
 	status = "okay";
 };
+
+&usb_phy {
+	phy-supply = <&ldo17>;
+};
+
+&i2c1 {
+	status = "okay";
+
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";
+		reg = <0x4e>;
+		status = "okay";
+		interrupt-parent = <&gpio27>;
+		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_cfg_func>;
+
+		usb_con: connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			data-role = "dual";
+			power-role = "dual";
+			try-power-role = "sink";
+			source-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
+			sink-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)
+				PDO_VAR(5000, 5000, 1000)>;
+			op-sink-microwatt = <10000000>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				port@1 {
+					reg = <1>;
+					usb_con_ss: endpoint {
+						remote-endpoint = <&dwc3_ss>;
+					};
+				};
+			};
+		};
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&hikey_usb_ep1>;
+			};
+		};
+	};
+};
+
+&i2c2 {
+	/* USB HUB is on this bus at address 0x44 */
+	status = "okay";
+};
+
+&dwc3 { /* USB */
+	dr_mode = "otg";
+	maximum-speed = "super-speed";
+	phy_type = "utmi";
+	snps,dis-del-phy-power-chg-quirk;
+	snps,dis_u2_susphy_quirk;
+	snps,dis_u3_susphy_quirk;
+	snps,tx_de_emphasis_quirk;
+	snps,tx_de_emphasis = <1>;
+	snps,dis-split-quirk;
+	snps,gctl-reset-quirk;
+	usb-role-switch;
+	role-switch-default-mode = "host";
+	port {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		dwc3_role_switch: endpoint@0 {
+			reg = <0>;
+			remote-endpoint = <&hikey_usb_ep0>;
+		};
+
+		dwc3_ss: endpoint@1 {
+			reg = <1>;
+			remote-endpoint = <&usb_con_ss>;
+		};
+	};
+};
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +20 -0
index 225dccbcb064..b47654b50139 100644
@@ -8,6 +8,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/hi3670-clock.h>
+#include <dt-bindings/usb/pd.h>
 
 / {
 	compatible = "hisilicon,hi3670";
@@ -892,5 +893,60 @@ i2c4: i2c@fdf0d000 {
 			pinctrl-0 = <&i2c4_pmx_func &i2c4_cfg_func>;
 			status = "disabled";
 		};
+
+		usb3_otg_bc: usb3_otg_bc@ff200000 {
+			compatible = "syscon", "simple-mfd";
+			reg = <0x0 0xff200000 0x0 0x1000>;
+
+			usb_phy: usbphy {
+				compatible = "hisilicon,hi3670-usb-phy";
+				#phy-cells = <0>;
+				hisilicon,pericrg-syscon = <&crg_ctrl>;
+				hisilicon,pctrl-syscon = <&pctrl>;
+				hisilicon,sctrl-syscon = <&sctrl>;
+				hisilicon,eye-diagram-param = <0xFDFEE4>;
+				hisilicon,tx-vboost-lvl = <0x5>;
+			};
+		};
+
+		usb31_misc_rst: usb31_misc_rst_controller {
+			compatible = "hisilicon,hi3660-reset";
+			#reset-cells = <2>;
Quoted 8 lines

arch/arm64/boot/dts/hisilicon/hi3670.dtsi i2c4: i2c@fdf0d000 { · line 919

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3670.dtsi +5 -0
+			hisi,rst-syscon = <&usb3_otg_bc>;
+		};
+
+		usb3: hisi_dwc3 {
+			compatible = "hisilicon,hi3670-dwc3";  

Could you please also add a binding document for the "hi3670-dwc3"? The driver part has added the compatible string as you pointed out before.

Just sent a patch adding a compatible for it:

	https://lore.kernel.org/all/fec9df1a99ad8639f23edc24cdcc3ec78ea31575.1638881845.git.mchehab+huawei@kernel.org/T/#u

This is basically a DWC3 driver, using drivers/usb/dwc3/dwc3-of-simple.c to setup the needed clocks and reset pins to make DWC3 IP available.

Thanks,
Mauro

#10 lore raw

PATCH 4/5 arm64: dts: HiSilicon: Add usb mux hub for HiKey 970

In reply to Mauro Carvalho Chehab

Add dt bindings for HiKey 970 USB HUB. Such board comes with an integrated USB HUB provided via a TI TUSB8041 4-port USB 3.0 hub.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts +23 -0
index 60594db07041..95ca49f1e455 100644
@@ -53,6 +53,29 @@ wlan_en: wlan-en-1-8v {
 		startup-delay-us = <70000>;
 		enable-active-high;
 	};
+
+	usb-hub {
+		compatible = "hisilicon,usbhub";
+		typec-vbus-gpios = <&gpio26 1 0>;
+		otg-switch-gpios = <&gpio4 2 0>;
+		hub-reset-en-gpios = <&gpio0 3 0>;
+		hub-vdd-supply = <&ldo17>;
+		usb-role-switch;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep0: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch>;
+			};
+			hikey_usb_ep1: endpoint@1 {
+				reg = <1>;
+				remote-endpoint = <&rt1711h_ep>;
+			};
+		};
+	};
 };
 
 /*
Signature · 1 line
2.33.1
#11 lore raw

PATCH 5/5 arm64: dts: HiSilicon: Add usb mux hub for HiKey 960

In reply to Mauro Carvalho Chehab

From: John Stultz <[email protected]>

Add dt bindings for HiKey 960 USB HUB. Such board comes with an integrated USB HUB provided via a Microchip USB5734 4-port high-speed hub controller.

[mchehab: modified it to adapt to the merged DT schema]

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/5] at: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/hisilicon/hi3660-hikey960.dts    | 35 +++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +33 -2
index f68580dc87d8..135501e57f86 100644
@@ -197,6 +197,37 @@ optee {
 			method = "smc";
 		};
 	};
+
+	usb_hub_vdd: usb_hub_vdd {
+		compatible = "regulator-fixed";
+		regulator-name = "hub-vdd";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio5 6 0>;
+		enable-active-high;
+	};
+
+	usb-hub {
+		compatible = "hisilicon,usbhub";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd-supply = <&usb_hub_vdd>;
+		usb-role-switch;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep0: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch>;
+			};
+			hikey_usb_ep1: endpoint@1 {
+				reg = <1>;
+				remote-endpoint = <&rt1711h_ep>;
+			};
+		};
+	};
 };
 
 /*
@@ -564,7 +595,7 @@ port {
 
 			rt1711h_ep: endpoint@0 {
 				reg = <0>;
-				remote-endpoint = <&dwc3_role_switch>;
+				remote-endpoint = <&hikey_usb_ep1>;
 			};
 		};
 	};
@@ -686,7 +717,7 @@ port {
 		#size-cells = <0>;
 		dwc3_role_switch: endpoint@0 {
 			reg = <0>;
-			remote-endpoint = <&rt1711h_ep>;
+			remote-endpoint = <&hikey_usb_ep0>;
 		};
 
 		dwc3_ss: endpoint@1 {
Signature · 1 line
2.33.1