Skip to contentSkip to conversation

Add support for usb on Hikey960

PATCH In review Yu Chen 7 participants 29 messages Apr 20, 2019 – Sep 8, 2020

Subsystems (7)
lore
Share & tools
lore

Yu Chen

author maintainer
#0 lore raw

v6 cover Add support for usb on Hikey960

The patchset adds support for usb functionality of Hikey960, includes:
- usb phy driver for Hisilicon Kirin Soc hi3660
- usb driver for HiKey960 board
- some adjustment in dwc3 and usb role driver
- dts for support usb of HiKey960

---
v5:
* Split modification of usb role into two patches, the first one introduces stubs for the exiting functions, and the second adds notifier functions.
v6:
* Add a fix of usb_role_switch_register_notifier initialization from John Stultz <[email protected]>
---

Yu Chen (13):
dt-bindings: phy: Add support for HiSilicon's hi3660 USB PHY
dt-bindings: misc: Add bindings for HiSilicon usb hub and data role
switch functionality on HiKey960
usb: dwc3: dwc3-of-simple: Add support for dwc3 of Hisilicon Soc
Platform
usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc
usb: dwc3: Execute GCTL Core Soft Reset while switch mdoe for
Hisilicon Kirin Soc
usb: dwc3: Increase timeout for CmdAct cleared by device controller
phy: Add usb phy support for hi3660 Soc of Hisilicon
usb: roles: Introduce stubs for the exiting functions in role.h.
usb: roles: Add usb role switch notifier.
usb: dwc3: Registering a role switch in the DRD code.
hikey960: Support usb functionality of Hikey960
usb: gadget: Add configfs attribuite for controling
match_existing_only
dts: hi3660: Add support for usb on Hikey960

 .../bindings/misc/hisilicon-hikey-usb.txt          |  52 +++++
 .../devicetree/bindings/phy/phy-hi3660-usb3.txt    |  26 +++
 MAINTAINERS                                        |   8 +
 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts  |  53 +++++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi          |  73 +++++++
 drivers/misc/Kconfig                               |   6 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/hisi_hikey_usb.c                      | 162 ++++++++++++++
 drivers/phy/hisilicon/Kconfig                      |  10 +
 drivers/phy/hisilicon/Makefile                     |   1 +
 drivers/phy/hisilicon/phy-hi3660-usb3.c            | 233 +++++++++++++++++++++
 drivers/usb/dwc3/Kconfig                           |   1 +
 drivers/usb/dwc3/core.c                            |  45 ++++
 drivers/usb/dwc3/core.h                            |  15 ++
 drivers/usb/dwc3/drd.c                             |  78 ++++++-
 drivers/usb/dwc3/dwc3-of-simple.c                  |   4 +-
 drivers/usb/dwc3/gadget.c                          |   2 +-
 drivers/usb/gadget/configfs.c                      |  32 +++
 drivers/usb/roles/class.c                          |  35 +++-
 include/linux/usb/role.h                           |  46 ++++
 20 files changed, 879 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt
 create mode 100644 Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
 create mode 100644 drivers/misc/hisi_hikey_usb.c
 create mode 100644 drivers/phy/hisilicon/phy-hi3660-usb3.c
Signature · 1 line
2.15.0-rc2
author maintainer
#1 lore raw

PATCH v6 1/13 dt-bindings: phy: Add support for HiSilicon's hi3660 USB PHY

This patch adds binding documentation for supporting the hi3660 usb phy on boards like the HiKey960.

Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Fix some format error as suggested by Rob. v2:
* Change hi3660 usb PHY to hi3660 USB PHY
v3:
* Make device node a subnode of usb3_otg_bc register. v4:
* Remove "hisilicon,usb3-otg-bc-syscon" property
---

---
 .../devicetree/bindings/phy/phy-hi3660-usb3.txt    | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt new file +26 -0
new file mode 100644
index 000000000000..e88ba7d92dcb
@@ -0,0 +1,26 @@
+Hisilicon hi3660 USB PHY
+-----------------------
+
+Required properties:
+- compatible: should be "hisilicon,hi3660-usb-phy"
+- #phy-cells: must be 0
+- hisilicon,pericrg-syscon: phandle of syscon used to control phy.
+- hisilicon,pctrl-syscon: phandle of syscon used to control phy.
+- hisilicon,eye-diagram-param: parameter set for phy
+Refer to phy/phy-bindings.txt for the generic PHY binding properties
+
+This is a subnode of usb3_otg_bc register node.
+
+Example:
+	usb3_otg_bc: usb3_otg_bc@ff200000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x0 0xff200000 0x0 0x1000>;
+
+		usb-phy {
+			compatible = "hisilicon,hi3660-usb-phy";
+			#phy-cells = <0>;
+			hisilicon,pericrg-syscon = <&crg_ctrl>;
+			hisilicon,pctrl-syscon = <&pctrl>;
+			hisilicon,eye-diagram-param = <0x22466e4>;
+		};
+	};
Signature · 1 line
2.15.0-rc2
author maintainer
#2 lore raw

PATCH v6 2/13 dt-bindings: misc: Add bindings for HiSilicon usb hub and data role switch functionality on HiKey960

In reply to Yu Chen

This patch adds binding documentation to support usb hub and usb data role switch of Hisilicon HiKey960 Board.

Cc Kishon Vijay Abraham I <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Fix some format errors as suggested by Sergei.
* Modify gpio description to use gpiod API.
v2:
* Remove information about Hikey.
* Fix gpio description.
* Remove device_type of endpoint.
v3:
* Remove property typec-vbus-enable-val.
* Add description of pinctrl-names.
* Add example for "hisilicon,gpio-hubv1"
* Add flag in gpiod properties.
---

---
 .../bindings/misc/hisilicon-hikey-usb.txt          | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +52 -0
new file mode 100644
index 000000000000..422e844df719
@@ -0,0 +1,52 @@
+Support usb hub and usb data role switch of Hisilicon HiKey960 Board.
+
+-----------------------------
+
+Required properties:
+- compatible: "hisilicon,gpio-hubv1","hisilicon,hikey960-usb"
+- typec-vbus-gpios: gpio to control the vbus of typeC port
+- otg-switch-gpios: gpio to switch DP & DM between the hub and typeC port
+- hub-vdd33-en-gpios: gpio to enable the power of hub
+- pinctrl-names: pin configuration state name ("default")
+- pinctrl-0: pinctrl config
+
+Example
+-----
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960-usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,gpio-hubv1";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_LOW>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
Signature · 1 line
2.15.0-rc2
maintainer
#3 lore raw

Re: [PATCH v6 02/13] dt-bindings: misc: Add bindings for HiSilicon usb hub and data role switch functionality on HiKey960

Quoted 2 lines · Yu Chen

This patch adds binding documentation to support usb hub and usb data role switch of Hisilicon HiKey960 Board.

Sorry I've been slow to really review this, but I needed to look at the schematics to see what exactly is going on here.

I think this needs some changes to better reflect the h/w and utilize existing bindings. It should really be designed ignoring the muxing to start with. Define the binding for the TypeC connector and then the host hub and make sure they can coexist. Then overlay what you need to switch between the 2 modes which AFAICT is just a single GPIO.

Quoted 33 lines
Cc Kishon Vijay Abraham I <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Fix some format errors as suggested by Sergei.
* Modify gpio description to use gpiod API.
v2:
* Remove information about Hikey.
* Fix gpio description.
* Remove device_type of endpoint.
v3:
* Remove property typec-vbus-enable-val.
* Add description of pinctrl-names.
* Add example for "hisilicon,gpio-hubv1"
* Add flag in gpiod properties.
---

---
 .../bindings/misc/hisilicon-hikey-usb.txt          | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +0 -0
new file mode 100644
index 000000000000..422e844df719

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +7 -0
@@ -0,0 +1,52 @@
+Support usb hub and usb data role switch of Hisilicon HiKey960 Board.
+
+-----------------------------
+
+Required properties:
+- compatible: "hisilicon,gpio-hubv1","hisilicon,hikey960-usb"
+- typec-vbus-gpios: gpio to control the vbus of typeC port

This should be a gpio regulator and then connected to 'vbus-supply' in a usb-connector node (see .../bindings/connectors/usb-connector.txt).

Then you also need the RT1711HWSC TypeC controller in DT. That is typically the parent device of the connector node.

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- otg-switch-gpios: gpio to switch DP & DM between the hub and typeC port

This probably belongs in USB controller node.

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 9

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- hub-vdd33-en-gpios: gpio to enable the power of hub

This too should be a gpio regulator and then in a hub node. We have 2 ways to represent hubs. Either as an I2C device or as a child of the host controller. The latter is preferred, but I'm not too sure how the OF graph connection linking the controller to the TypeC connector will work with the usb bus binding.

Quoted 16 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +16 -0
+- pinctrl-names: pin configuration state name ("default")
+- pinctrl-0: pinctrl config
+
+Example
+-----
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960-usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 35

Quoted 10 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +10 -0
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
+
+	hisi_hikey_usb: hisi_hikey_usb {

Perhaps doesn't matter with my above feedback, but I don't understand the point of this 2nd example.

Quoted 20 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +17 -0
+		compatible = "hisilicon,gpio-hubv1";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_LOW>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
Signature · 1 line
2.15.0-rc2
author maintainer
#4 lore raw

Re: [PATCH v6 02/13] dt-bindings: misc: Add bindings for HiSilicon usb hub and data role switch functionality on HiKey960

Hi Rob,

Quoted 40 lines · Rob Herring
Quoted 2 lines · Yu Chen

This patch adds binding documentation to support usb hub and usb data role switch of Hisilicon HiKey960 Board.

Sorry I've been slow to really review this, but I needed to look at the schematics to see what exactly is going on here.

I think this needs some changes to better reflect the h/w and utilize existing bindings. It should really be designed ignoring the muxing to start with. Define the binding for the TypeC connector and then the host hub and make sure they can coexist. Then overlay what you need to switch between the 2 modes which AFAICT is just a single GPIO.

Quoted 27 lines
Cc Kishon Vijay Abraham I <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Fix some format errors as suggested by Sergei.
* Modify gpio description to use gpiod API.
v2:
* Remove information about Hikey.
* Fix gpio description.
* Remove device_type of endpoint.
v3:
* Remove property typec-vbus-enable-val.
* Add description of pinctrl-names.
* Add example for "hisilicon,gpio-hubv1"
* Add flag in gpiod properties.
---

---
 .../bindings/misc/hisilicon-hikey-usb.txt          | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt
Quoted 16 lines

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 7

Quoted 13 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +7 -0
new file mode 100644
index 000000000000..422e844df719
@@ -0,0 +1,52 @@
+Support usb hub and usb data role switch of Hisilicon HiKey960 Board.
+
+-----------------------------
+
+Required properties:
+- compatible: "hisilicon,gpio-hubv1","hisilicon,hikey960-usb"
+- typec-vbus-gpios: gpio to control the vbus of typeC port

This should be a gpio regulator and then connected to 'vbus-supply' in a usb-connector node (see .../bindings/connectors/usb-connector.txt).

Currently usb-connector node has no "vbus-supply" property and I do not find process that handles vbus-supply in RT1711H TypeC driver.

Quoted 8 lines

Then you also need the RT1711HWSC TypeC controller in DT. That is typically the parent device of the connector node.

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- otg-switch-gpios: gpio to switch DP & DM between the hub and typeC port

This probably belongs in USB controller node.

The otg-switch-gpios controls a mux like fsusb30mux. It is related to the board design of HiKey960. And the state of the mux is decided by the typeC port state. So I think it is not so good to make it belongs in USB controller node.

Quoted 8 lines

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 9

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- hub-vdd33-en-gpios: gpio to enable the power of hub

This too should be a gpio regulator and then in a hub node. We have 2 ways to represent hubs. Either as an I2C device or as a child of the host controller. The latter is preferred, but I'm not too sure how the OF graph connection linking the controller to the TypeC connector will work with the usb bus binding.

There is no particular code except the power control for the hub. The i2c on the hub is not used. So it can not be an I2C device. Is there such an example that make the hub as a child of the host controller and control its power?

Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +21 -0
+- pinctrl-names: pin configuration state name ("default")
+- pinctrl-0: pinctrl config
+
+Example
+-----
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960-usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
Quoted 9 lines

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +5 -0
+			};
+		};
+	};
+
+	hisi_hikey_usb: hisi_hikey_usb {

Perhaps doesn't matter with my above feedback, but I don't understand the point of this 2nd example.

OK. I will remove it.

Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +14 -0
+		compatible = "hisilicon,gpio-hubv1";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_LOW>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
Quoted 9 lines
Quoted 6 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +3 -0
+			};
+		};
+	};
Signature · 1 line
2.15.0-rc2

.

Thanks
- Yu Chen

maintainer
#5 lore raw

Re: [PATCH v6 02/13] dt-bindings: misc: Add bindings for HiSilicon usb hub and data role switch functionality on HiKey960

Quoted 60 lines · Chen Yu

Hi Rob,

Quoted 40 lines · Rob Herring
Quoted 2 lines · Yu Chen

This patch adds binding documentation to support usb hub and usb data role switch of Hisilicon HiKey960 Board.

Sorry I've been slow to really review this, but I needed to look at the schematics to see what exactly is going on here.

I think this needs some changes to better reflect the h/w and utilize existing bindings. It should really be designed ignoring the muxing to start with. Define the binding for the TypeC connector and then the host hub and make sure they can coexist. Then overlay what you need to switch between the 2 modes which AFAICT is just a single GPIO.

Quoted 27 lines
Cc Kishon Vijay Abraham I <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Fix some format errors as suggested by Sergei.
* Modify gpio description to use gpiod API.
v2:
* Remove information about Hikey.
* Fix gpio description.
* Remove device_type of endpoint.
v3:
* Remove property typec-vbus-enable-val.
* Add description of pinctrl-names.
* Add example for "hisilicon,gpio-hubv1"
* Add flag in gpiod properties.
---

---
 .../bindings/misc/hisilicon-hikey-usb.txt          | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt
Quoted 16 lines

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 7

Quoted 13 lines
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +7 -0
new file mode 100644
index 000000000000..422e844df719
@@ -0,0 +1,52 @@
+Support usb hub and usb data role switch of Hisilicon HiKey960 Board.
+
+-----------------------------
+
+Required properties:
+- compatible: "hisilicon,gpio-hubv1","hisilicon,hikey960-usb"
+- typec-vbus-gpios: gpio to control the vbus of typeC port

This should be a gpio regulator and then connected to 'vbus-supply' in a usb-connector node (see .../bindings/connectors/usb-connector.txt).

Quoted 2 lines

Currently usb-connector node has no "vbus-supply" property and I do not find process that handles vbus-supply in RT1711H TypeC driver.

The patch[1] adding that is posted to the list and may not have landed yet.

Whether the RT1711H TypeC driver handles it or not is not a binding problem.

Quoted 11 lines
Quoted 7 lines

Then you also need the RT1711HWSC TypeC controller in DT. That is typically the parent device of the connector node.

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- otg-switch-gpios: gpio to switch DP & DM between the hub and typeC port

This probably belongs in USB controller node.

The otg-switch-gpios controls a mux like fsusb30mux. It is related to the board design of HiKey960. And the state of the mux is decided by the typeC port state. So I think it is not so good to make it belongs in USB controller node.

Let me put it this way. The gpio property belongs wherever the mux is represented. In this case, I would expect the graph port representing the HS port to have 2 endpoints representing the 2 mux outputs. We don't generally put properties in the endpoint or port nodes, but the parent nodes.

Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt line 9

Quoted 1 line
Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.txt new file +1 -0
+- hub-vdd33-en-gpios: gpio to enable the power of hub

This too should be a gpio regulator and then in a hub node. We have 2 ways to represent hubs. Either as an I2C device or as a child of the host controller. The latter is preferred, but I'm not too sure how the OF graph connection linking the controller to the TypeC connector will work with the usb bus binding.

Quoted 4 lines

There is no particular code except the power control for the hub. The i2c on the hub is not used. So it can not be an I2C device. Is there such an example that make the hub as a child of the host controller and control its power?

Yes, bindings/usb/usb-device.txt.

Rob

[1] https://www.spinics.net/lists/kernel/msg3089136.html

author maintainer
#6 lore raw

PATCH v6 3/13 usb: dwc3: dwc3-of-simple: Add support for dwc3 of Hisilicon Soc Platform

In reply to Yu Chen

This patch adds support for the poweron and shutdown of dwc3 core on Hisilicon Soc Platform.

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-of-simple.c +3 -1
index 4c2771c5e727..0ed09d876542 100644
@@ -98,7 +98,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 	 * Some controllers need to toggle the usb3-otg reset before trying to
 	 * initialize the PHY, otherwise the PHY times out.
 	 */
-	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
+	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3") ||
+			of_device_is_compatible(np, "hisilicon,hi3660-dwc3"))
 		simple->need_reset = true;
 
 	if (of_device_is_compatible(np, "amlogic,meson-axg-dwc3") ||
@@ -243,6 +244,7 @@ static const struct of_device_id of_dwc3_simple_match[] = {
 	{ .compatible = "amlogic,meson-axg-dwc3" },
 	{ .compatible = "amlogic,meson-gxl-dwc3" },
 	{ .compatible = "allwinner,sun50i-h6-dwc3" },
+	{ .compatible = "hisilicon,hi3660-dwc3" },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, of_dwc3_simple_match);
Signature · 1 line
2.15.0-rc2
maintainer
#7 lore raw

Re: [PATCH v6 03/13] usb: dwc3: dwc3-of-simple: Add support for dwc3 of Hisilicon Soc Platform

Quoted 16 lines · Yu Chen

This patch adds support for the poweron and shutdown of dwc3 core on Hisilicon Soc Platform.

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-of-simple.c +0 -0
index 4c2771c5e727..0ed09d876542 100644

drivers/usb/dwc3/dwc3-of-simple.c static int dwc3_of_simple_probe(struct platform_device *pdev) · line 103

Quoted 7 lines
drivers/usb/dwc3/dwc3-of-simple.c +2 -1
@@ -98,7 +98,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 	 * Some controllers need to toggle the usb3-otg reset before trying to
 	 * initialize the PHY, otherwise the PHY times out.
 	 */
-	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
+	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3") ||
+			of_device_is_compatible(np, "hisilicon,hi3660-dwc3"))
 		simple->need_reset = true;

Fine, I guess, but really this flag should be moved to the match table so we aren't doing compatible matching twice.

Quoted 13 lines
drivers/usb/dwc3/dwc3-of-simple.c +1 -0
 	if (of_device_is_compatible(np, "amlogic,meson-axg-dwc3") ||
@@ -243,6 +244,7 @@ static const struct of_device_id of_dwc3_simple_match[] = {
 	{ .compatible = "amlogic,meson-axg-dwc3" },
 	{ .compatible = "amlogic,meson-gxl-dwc3" },
 	{ .compatible = "allwinner,sun50i-h6-dwc3" },
+	{ .compatible = "hisilicon,hi3660-dwc3" },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, of_dwc3_simple_match);
Signature · 1 line
2.15.0-rc2
author maintainer
#8 lore raw

PATCH v6 4/13 usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

In reply to Yu Chen

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

Cc Andy Shevchenko <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v4:
* Add dwc3_complete definition while CONFIG_PM_SLEEP does not defined.
* Add description for 'dis_split_quirk'.
---

---
 drivers/usb/dwc3/core.c | 26 ++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 33 insertions(+)
drivers/usb/dwc3/core.c +26 -0
index a1b126f90261..c3ef6bd2b0d4 100644
@@ -117,6 +117,7 @@ static void __dwc3_set_mode(struct work_struct *work)
 	struct dwc3 *dwc = work_to_dwc(work);
 	unsigned long flags;
 	int ret;
+	u32 reg;
 
 	if (dwc->dr_mode != USB_DR_MODE_OTG)
 		return;
@@ -169,6 +170,11 @@ static void __dwc3_set_mode(struct work_struct *work)
 			phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
 			phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
 			phy_calibrate(dwc->usb2_generic_phy);
+			if (dwc->dis_split_quirk) {
+				reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+				reg |= DWC3_GUCTL3_SPLITDISABLE;
+				dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+			}
 		}
 		break;
 	case DWC3_GCTL_PRTCAP_DEVICE:
@@ -1306,6 +1312,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 	dwc->dis_metastability_quirk = device_property_read_bool(dev,
 				"snps,dis_metastability_quirk");
 
+	dwc->dis_split_quirk = device_property_read_bool(dev,
+				"snps,dis-split-quirk");
+
 	dwc->lpm_nyet_threshold = lpm_nyet_threshold;
 	dwc->tx_de_emphasis = tx_de_emphasis;
 
@@ -1825,10 +1834,27 @@ static int dwc3_resume(struct device *dev)
 
 	return 0;
 }
+
+static void dwc3_complete(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+	u32		reg;
+
+	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
+			dwc->dis_split_quirk) {
+		dev_dbg(dwc->dev, "set DWC3_GUCTL3_SPLITDISABLE\n");
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,
 	SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
 			dwc3_runtime_idle)
 };
drivers/usb/dwc3/core.h +7 -0
index 1528d395b156..28475e301ad9 100644
@@ -136,6 +136,7 @@
 #define DWC3_GEVNTCOUNT(n)	(0xc40c + ((n) * 0x10))
 
 #define DWC3_GHWPARAMS8		0xc600
+#define DWC3_GUCTL3		0xc60c
 #define DWC3_GFLADJ		0xc630
 
 /* Device Registers */
@@ -370,6 +371,9 @@
 /* Global User Control Register 2 */
 #define DWC3_GUCTL2_RST_ACTBITLATER		BIT(14)
 
+/* Global User Control Register 3 */
+#define DWC3_GUCTL3_SPLITDISABLE		BIT(14)
+
 /* Device Configuration Register */
 #define DWC3_DCFG_DEVADDR(addr)	((addr) << 3)
 #define DWC3_DCFG_DEVADDR_MASK	DWC3_DCFG_DEVADDR(0x7f)
@@ -1030,6 +1034,7 @@ struct dwc3_scratchpad_array {
  * 	2	- No de-emphasis
  * 	3	- Reserved
  * @dis_metastability_quirk: set to disable metastability quirk.
+ * @dis_split_quirk: set to disable split boundary.
  * @imod_interval: set the interrupt moderation interval in 250ns
  *                 increments or 0 to disable.
  */
@@ -1216,6 +1221,8 @@ struct dwc3 {
 
 	unsigned		dis_metastability_quirk:1;
 
+	unsigned		dis_split_quirk:1;
+
 	u16			imod_interval;
 };
 
Signature · 1 line
2.15.0-rc2
Tested-by on v6 4/13
#9 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

Hi Felipe/Greg,

What's the status of this patch?

I tested here, together with the Hikey 970 phy RFC patches I sent last week.

Without this patch, the USB HID driver receives -EPROTO from submitted URBs, causing it to enter into an endless reset cycle on every 500 ms, at the hid_io_error() logic.

If you prefer, I can re-submit this one with my SOB.

Thanks,
Mauro

Em Sat, 20 Apr 2019 14:40:10 +0800
Yu Chen <[email protected]> escreveu:

Quoted 112 lines

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

Cc Andy Shevchenko <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v4:
* Add dwc3_complete definition while CONFIG_PM_SLEEP does not defined.
* Add description for 'dis_split_quirk'.
---

---
 drivers/usb/dwc3/core.c | 26 ++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 33 insertions(+)
drivers/usb/dwc3/core.c +26 -0
index a1b126f90261..c3ef6bd2b0d4 100644
@@ -117,6 +117,7 @@ static void __dwc3_set_mode(struct work_struct *work)
 	struct dwc3 *dwc = work_to_dwc(work);
 	unsigned long flags;
 	int ret;
+	u32 reg;
 
 	if (dwc->dr_mode != USB_DR_MODE_OTG)
 		return;
@@ -169,6 +170,11 @@ static void __dwc3_set_mode(struct work_struct *work)
 			phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
 			phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
 			phy_calibrate(dwc->usb2_generic_phy);
+			if (dwc->dis_split_quirk) {
+				reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+				reg |= DWC3_GUCTL3_SPLITDISABLE;
+				dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+			}
 		}
 		break;
 	case DWC3_GCTL_PRTCAP_DEVICE:
@@ -1306,6 +1312,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 	dwc->dis_metastability_quirk = device_property_read_bool(dev,
 				"snps,dis_metastability_quirk");
 
+	dwc->dis_split_quirk = device_property_read_bool(dev,
+				"snps,dis-split-quirk");
+
 	dwc->lpm_nyet_threshold = lpm_nyet_threshold;
 	dwc->tx_de_emphasis = tx_de_emphasis;
 
@@ -1825,10 +1834,27 @@ static int dwc3_resume(struct device *dev)
 
 	return 0;
 }
+
+static void dwc3_complete(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+	u32		reg;
+
+	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
+			dwc->dis_split_quirk) {
+		dev_dbg(dwc->dev, "set DWC3_GUCTL3_SPLITDISABLE\n");
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,
 	SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
 			dwc3_runtime_idle)
 };
drivers/usb/dwc3/core.h +5 -0
index 1528d395b156..28475e301ad9 100644
@@ -136,6 +136,7 @@
 #define DWC3_GEVNTCOUNT(n)	(0xc40c + ((n) * 0x10))
 
 #define DWC3_GHWPARAMS8		0xc600
+#define DWC3_GUCTL3		0xc60c
 #define DWC3_GFLADJ		0xc630
 
 /* Device Registers */
@@ -370,6 +371,9 @@
 /* Global User Control Register 2 */
 #define DWC3_GUCTL2_RST_ACTBITLATER		BIT(14)
 
+/* Global User Control Register 3 */
+#define DWC3_GUCTL3_SPLITDISABLE		BIT(14)
+
 /* Device Configuration Register */
 #define DWC3_DCFG_DEVADDR(addr)	((addr) << 3)
 #define DWC3_DCFG_DEVADDR_MASK	DWC3_DCFG_DEVADDR(0x7f)
@@ -1030,6 +1034,7 @@ struct dwc3_scratchpad_array {
  * 	2	- No de-emphasis
  * 	3	- Reserved
  * @dis_metastability_quirk: set to disable metastability quirk.
+ * @dis_split_quirk: set to disable split boundary.
  * @imod_interval: set the interrupt moderation interval in 250ns
  *                 increments or 0 to disable.
  */

drivers/usb/dwc3/core.h struct dwc3 { · line 1228

Quoted 8 lines
drivers/usb/dwc3/core.h +2 -0
@@ -1216,6 +1221,8 @@ struct dwc3 {
 
 	unsigned		dis_metastability_quirk:1;
 
+	unsigned		dis_split_quirk:1;
+
 	u16			imod_interval;
 };
 

Thanks,
Mauro

#10 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

Hi Mauro,

Quoted 3 lines · Mauro Carvalho Chehab

Hi Felipe/Greg,

What's the status of this patch?

to be frank, I don't think I have this in my inbox anymore.

Quoted 10 lines

I tested here, together with the Hikey 970 phy RFC patches I sent last week.

Without this patch, the USB HID driver receives -EPROTO from submitted URBs, causing it to enter into an endless reset cycle on every 500 ms, at the hid_io_error() logic.

If you prefer, I can re-submit this one with my SOB.

Please do, but since you're changing device tree, I need Rob's acked-by.

Quoted 8 lines

Thanks,
Mauro

Em Sat, 20 Apr 2019 14:40:10 +0800
Yu Chen <[email protected]> escreveu:

Quoted 2 lines

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

is this Kirin-specific or is this something that we should do a revision check? Why does it affect only Hikey kirin? What's the dwc3 revision on that SoC (grep SNPSID /sys/kernel/debugfs/*dwc3/regdump)?

Quoted 13 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1845

Quoted 13 lines
drivers/usb/dwc3/core.c +9 -0
@@ -1825,10 +1834,27 @@ static int dwc3_resume(struct device *dev)
 
 	return 0;
 }
+
+static void dwc3_complete(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+	u32		reg;
+
+	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
+			dwc->dis_split_quirk) {
+		dev_dbg(dwc->dev, "set DWC3_GUCTL3_SPLITDISABLE\n");

no more dev_dbg() should be added. This driver relies exclusively on tracepoints for debugging.

Quoted 9 lines
Quoted 9 lines
drivers/usb/dwc3/core.c +7 -0
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
 
Quoted 3 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1857

Quoted 3 lines
drivers/usb/dwc3/core.c +1 -0
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,

why is this done on complete? Why can't it be done at the end of dwc3_resume()?

Signature · 1 line
balbi
#11 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

Em Mon, 07 Sep 2020 17:04:31 +0300
Felipe Balbi <[email protected]> escreveu:

Quoted 17 lines

Hi Mauro,

Quoted 3 lines · Mauro Carvalho Chehab

Hi Felipe/Greg,

What's the status of this patch?

to be frank, I don't think I have this in my inbox anymore.

Quoted 6 lines

I tested here, together with the Hikey 970 phy RFC patches I sent last week.

Without this patch, the USB HID driver receives -EPROTO from submitted URBs, causing it to enter into an endless reset cycle on every 500 ms, at the hid_io_error() logic.

Quoted 5 lines
Quoted 3 lines

If you prefer, I can re-submit this one with my SOB.

Please do, but since you're changing device tree, I need Rob's acked-by.

Ok, I'll do that.

Quoted 11 lines
Quoted 8 lines

Thanks,
Mauro

Em Sat, 20 Apr 2019 14:40:10 +0800
Yu Chen <[email protected]> escreveu:

Quoted 2 lines

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

is this Kirin-specific or is this something that we should do a revision check?

I've no idea. I don't have any datasheets from this device.

Quoted 1 line

Why does it affect only Hikey kirin?

As John Stultz didn't re-submit this one (and looking at the DT between Kirin 960 and 970 from the original Kernel 4.9 official drivers), I suspect that only Kirin 970 requires this quirk.

It could well be due to some Dwc3 revision, but it could also be due to some differences at the USB part of the SoC, as there are a few other things different between hikey 960 and 970: it has a different PHY driver, and there are also some differences at the USB HUB which is connected into it.

On both devices, the USB physical ports are actually connected into a HUB. In the case of Hikey 970, the hub seems to be a TI TUSB8041 4-Port Hub:

	$ lsusb
	Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
	Bus 001 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
	Bus 001 Device 003: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
	Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Quoted 2 lines

What's the dwc3 revision on
that SoC (grep SNPSID /sys/kernel/debugfs/*dwc3/regdump)?

	GSNPSID = 0x33313130
Quoted 17 lines
Quoted 14 lines
Quoted 4 lines
drivers/usb/dwc3/core.c +0 -0
@@ -1825,10 +1834,27 @@ static int dwc3_resume(struct device *dev)
 
 	return 0;

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1845

Quoted 10 lines
drivers/usb/dwc3/core.c +9 -0
 }
+
+static void dwc3_complete(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+	u32		reg;
+
+	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
+			dwc->dis_split_quirk) {
+		dev_dbg(dwc->dev, "set DWC3_GUCTL3_SPLITDISABLE\n");  

no more dev_dbg() should be added. This driver relies exclusively on tracepoints for debugging.

Ok.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/usb/dwc3/core.c +7 -0
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
 
Quoted 6 lines
Quoted 3 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1857

Quoted 3 lines
drivers/usb/dwc3/core.c +1 -0
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,  

why is this done on complete? Why can't it be done at the end of dwc3_resume()?

Again, no idea. I didn't actually tried to suspend/resume.

Maybe the original author can shed a light on it.

Thanks,
Mauro

#12 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

Hi,

Quoted 7 lines · Mauro Carvalho Chehab
Quoted 7 lines
Quoted 6 lines

I tested here, together with the Hikey 970 phy RFC patches I sent last week.

Without this patch, the USB HID driver receives -EPROTO from submitted URBs, causing it to enter into an endless reset cycle on every 500 ms, at the hid_io_error() logic.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If you prefer, I can re-submit this one with my SOB.

Please do, but since you're changing device tree, I need Rob's acked-by.

Ok, I'll do that.

thanks

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

Em Sat, 20 Apr 2019 14:40:10 +0800
Yu Chen <[email protected]> escreveu:

Quoted 2 lines

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

is this Kirin-specific or is this something that we should do a revision check?

I've no idea. I don't have any datasheets from this device.

I see

Quoted 8 lines
Quoted 1 line

Why does it affect only Hikey kirin?

As John Stultz didn't re-submit this one (and looking at the DT between Kirin 960 and 970 from the original Kernel 4.9 official drivers), I suspect that only Kirin 970 requires this quirk.

It could well be due to some Dwc3 revision, but it could also be due to some differences at the USB part of the SoC, as there are a

the reason I ask is that if it's caused by dwc3 revision, then we don't need the extra dt property, we can rely on a revision check. If it's something that can't be detected in runtime, then we need a property.

Quoted 16 lines

few other things different between hikey 960 and 970: it has a different PHY driver, and there are also some differences at the USB HUB which is connected into it.

On both devices, the USB physical ports are actually connected into a HUB. In the case of Hikey 970, the hub seems to be a TI TUSB8041 4-Port Hub:

	$ lsusb
	Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
	Bus 001 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
	Bus 001 Device 003: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
	Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Quoted 4 lines
Quoted 2 lines

What's the dwc3 revision on
that SoC (grep SNPSID /sys/kernel/debugfs/*dwc3/regdump)?

	GSNPSID = 0x33313130

This isn't even listed as a known revision in dwc3/core.h. Thinh, could the issue being described here caused by a known Erratum with this particular revision?

Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/usb/dwc3/core.c +7 -0
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
Quoted 6 lines
Quoted 3 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1857

Quoted 3 lines

static const struct dev_pm_ops dwc3_dev_pm_ops = {

drivers/usb/dwc3/core.c +1 -0
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,  

why is this done on complete? Why can't it be done at the end of dwc3_resume()?

Quoted 3 lines

Again, no idea. I didn't actually tried to suspend/resume.

Maybe the original author can shed a light on it.

yeah, would be nice :-)

Signature · 1 line
balbi
#13 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

Em Tue, 08 Sep 2020 09:09:46 +0300
Felipe Balbi <[email protected]> escreveu:

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Why does it affect only Hikey kirin?

As John Stultz didn't re-submit this one (and looking at the DT between Kirin 960 and 970 from the original Kernel 4.9 official drivers), I suspect that only Kirin 970 requires this quirk.

Quoted 6 lines
Quoted 2 lines

It could well be due to some Dwc3 revision, but it could also be due to some differences at the USB part of the SoC, as there are a

the reason I ask is that if it's caused by dwc3 revision, then we don't need the extra dt property, we can rely on a revision check. If it's something that can't be detected in runtime, then we need a property.

Yeah, if it would be possible to auto-detect, that would be better. Yet, hard to say if it would be possible to do that, without access to the Dwc3 docs, and without different hardware for testing it.

Quoted 16 lines
Quoted 16 lines

few other things different between hikey 960 and 970: it has a different PHY driver, and there are also some differences at the USB HUB which is connected into it.

On both devices, the USB physical ports are actually connected into a HUB. In the case of Hikey 970, the hub seems to be a TI TUSB8041 4-Port Hub:

	$ lsusb
	Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
	Bus 001 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
	Bus 001 Device 003: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
	Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

What's the dwc3 revision on
that SoC (grep SNPSID /sys/kernel/debugfs/*dwc3/regdump)?

	GSNPSID = 0x33313130  

This isn't even listed as a known revision in dwc3/core.h. Thinh, could the issue being described here caused by a known Erratum with this particular revision?

Maybe. Again, hard to tell without any documentation from Synopsys.

Maybe some of the Synopsys folks at USB MK can shed a light.

Thanks,
Mauro

maintainer
#14 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

In reply to Felipe Balbi
Quoted 53 lines · Felipe Balbi

Hi,

Quoted 11 lines · Mauro Carvalho Chehab
Quoted 10 lines
Quoted 9 lines

I tested here, together with the Hikey 970 phy RFC patches I sent last week.

Without this patch, the USB HID driver receives -EPROTO from submitted URBs, causing it to enter into an endless reset cycle on every 500 ms, at the hid_io_error() logic.

If you prefer, I can re-submit this one with my SOB.

Please do, but since you're changing device tree, I need Rob's acked-by.

Ok, I'll do that.

thanks

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Em Sat, 20 Apr 2019 14:40:10 +0800
Yu Chen <[email protected]> escreveu:

Quoted 2 lines

SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.

is this Kirin-specific or is this something that we should do a revision check?

I've no idea. I don't have any datasheets from this device.

I see

Quoted 7 lines
Quoted 1 line

Why does it affect only Hikey kirin?

As John Stultz didn't re-submit this one (and looking at the DT between Kirin 960 and 970 from the original Kernel 4.9 official drivers), I suspect that only Kirin 970 requires this quirk.

It could well be due to some Dwc3 revision, but it could also be due to some differences at the USB part of the SoC, as there are a

the reason I ask is that if it's caused by dwc3 revision, then we don't need the extra dt property, we can rely on a revision check. If it's something that can't be detected in runtime, then we need a property.

Quoted 16 lines

few other things different between hikey 960 and 970: it has a different PHY driver, and there are also some differences at the USB HUB which is connected into it.

On both devices, the USB physical ports are actually connected into a HUB. In the case of Hikey 970, the hub seems to be a TI TUSB8041 4-Port Hub:

	$ lsusb
	Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
	Bus 001 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
	Bus 001 Device 003: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
	Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

What's the dwc3 revision on
that SoC (grep SNPSID /sys/kernel/debugfs/*dwc3/regdump)?

	GSNPSID = 0x33313130

This isn't even listed as a known revision in dwc3/core.h. Thinh, could the issue being described here caused by a known Erratum with this particular revision?

If you have a STAR issue number, then I may be able to look it up.

Btw, GNSPSID register is the ID for DWC_usb31 IP. For DWC_usb31 and DWC_usb32, we need to read the version number and version type registers (offset 0xc1a0 and 0xc1a4 respectively).

We need to add these registers to the register dump.

BR,
Thinh

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/usb/dwc3/core.c +7 -0
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
+		reg |= DWC3_GUCTL3_SPLITDISABLE;
+		dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
+	}
+}
+#else
+#define dwc3_complete NULL
 #endif /* CONFIG_PM_SLEEP */
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1857

Quoted 3 lines

static const struct dev_pm_ops dwc3_dev_pm_ops = {

drivers/usb/dwc3/core.c +1 -0
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,  

why is this done on complete? Why can't it be done at the end of dwc3_resume()?

Again, no idea. I didn't actually tried to suspend/resume.

Maybe the original author can shed a light on it.

yeah, would be nice :-)

#15 lore raw

Re: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc

In reply to Felipe Balbi

Em Mon, 07 Sep 2020 17:04:31 +0300
Felipe Balbi <[email protected]> escreveu:

Quoted 6 lines
Quoted 3 lines

drivers/usb/dwc3/core.c static int dwc3_resume(struct device *dev) · line 1857

Quoted 3 lines

static const struct dev_pm_ops dwc3_dev_pm_ops = {

drivers/usb/dwc3/core.c +1 -0
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	.complete = dwc3_complete,  

why is this done on complete? Why can't it be done at the end of dwc3_resume()?

Updating my answer:

No. I just tested moving the code from .complete to the end of .resume. After moving it, the HID won't be able to properly enable the device at resume time (logs filtered to show only relevant msgs):

	# echo reboot > /sys/power/disk; echo disk > /sys/power/state
	...
	[   29.051314] Freezing user space processes ... (elapsed 0.001 seconds) done.
	[   29.059811] OOM killer disabled.
	[   30.171526] PM: hibernation: Creating image:
	[   30.171526] PM: hibernation: Need to copy 164192 pages
	[   30.171526] PM: hibernation: Image created (164192 pages copied)
	[   30.171644] Enabling non-boot CPUs ...
	[   30.293953] dwc3 ff100000.dwc3: dwc3_resume
	[   30.424549] usb usb1-port1: status 0101 change 0001
	[   30.428538] usb usb2-port1: status 0203 change 0001
	[   30.536609] usb 1-1: Waited 0ms for CONNECT
	[   30.543822] usb 1-1: finish reset-resume
	[   30.544619] usb 2-1: Waited 0ms for CONNECT
	[   30.558869] usb 2-1: finish reset-resume
	[   30.676706] usb 1-1: reset high-speed USB device number 2 using xhci-hcd
	[   30.882194] hub 1-1:1.0: hub_reset_resume
	[   30.888479] hub 1-1:1.0: enabling power on all ports
	[   30.960767] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
	[   30.994229] hub 2-1:1.0: hub_reset_resume
	[   31.000574] usb 1-1-port1: status 0301 change 0001
	[   31.002088] hub 2-1:1.0: enabling power on all ports
	[   31.009079] usb 1-1-port2: status 0101 change 0001
	[   31.132633] usb 1-1.2: Waited 0ms for CONNECT
	[   31.132665] usb 1-1.1: Waited 0ms for CONNECT
	[   31.140560] usb 1-1.2: finish reset-resume
	[   31.148509] usb 1-1.1: finish reset-resume
	[   31.240760] usb 1-1.2: reset high-speed USB device number 4 using xhci-hcd
	[   32.471492] dwc3 ff100000.dwc3: dwc3_complete
	[   32.480512] PM: Cannot find swap device, try swapon -a
	[   32.489532] PM: Cannot get swap writer
	[   32.575790] Restarting tasks ... 
	[   32.575891] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000
	[   32.575894] hub 2-0:1.0: state 7 ports 1 chg 0000 evt 0000
	[   32.575896] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   32.576570] hub 2-1:1.0: state 7 ports 4 chg 0000 evt 0000
	[   32.576876] done.
	[   32.600094] hub 2-1:1.0: hub_suspend
	[   32.642090] PM: hibernation: hibernation exit
	[   32.650255] usb 2-1: usb auto-suspend, wakeup 1
	[   32.668581] hub 2-0:1.0: hub_suspend
	[   33.122384] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   33.378220] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	[   33.698394] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0000
	[   34.882365] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   35.138217] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	[   35.458617] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0000
	[   36.642392] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   36.898207] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	[   37.218598] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0000
	[   37.672658] kirin9xx-drm e8600000.dpe: [drm:dss_disable_vblank [kirin9xx_drm]] dss_disable_vblank
	[   38.402368] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   38.658174] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	[   38.978594] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0000
	[   40.162361] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0002
	[   40.418148] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	...
	[  397.698132] usb 1-1.1: reset low-speed USB device number 3 using xhci-hcd
	[  398.018565] hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0000

Basically, after resume, the code behaves just like the quirk were not applied.

Explaining with more details, without the splitdisable quirk, what happens is that the USB URBs return -EPROTO errors, causing hid-core.c to call hid_io_error(). This function starts a reset work (usbhid->reset_work), which ends calling (at hid_reset()):

	usb_queue_reset_device(usbhid->intf);

This happens on every HZ/2 intervals, causing an endless reset loop.

Thanks,
Mauro

author maintainer
#16 lore raw

PATCH v6 5/13 usb: dwc3: Execute GCTL Core Soft Reset while switch mdoe for Hisilicon Kirin Soc

In reply to Yu Chen

A GCTL soft reset should be executed when switch mode for dwc3 core of Hisilicon Kirin Soc.

Cc Andy Shevchenko <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v4:
* Add description for 'gctl_reset_quirk'.
---

---
 drivers/usb/dwc3/core.c | 19 +++++++++++++++++++
 drivers/usb/dwc3/core.h |  2 ++
 2 files changed, 21 insertions(+)
drivers/usb/dwc3/core.c +19 -0
index c3ef6bd2b0d4..fd581d72794a 100644
@@ -112,6 +112,19 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode)
 	dwc->current_dr_role = mode;
 }
 
+static void dwc3_gctl_core_soft_reset(struct dwc3 *dwc)
+{
+	u32 reg;
+
+	reg = dwc3_readl(dwc->regs, DWC3_GCTL);
+	reg |= DWC3_GCTL_CORESOFTRESET;
+	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
+
+	reg = dwc3_readl(dwc->regs, DWC3_GCTL);
+	reg &= ~DWC3_GCTL_CORESOFTRESET;
+	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
+}
+
 static void __dwc3_set_mode(struct work_struct *work)
 {
 	struct dwc3 *dwc = work_to_dwc(work);
@@ -157,6 +170,10 @@ static void __dwc3_set_mode(struct work_struct *work)
 
 	dwc3_set_prtcap(dwc, dwc->desired_dr_role);
 
+	/* Execute a GCTL Core Soft Reset when switch mode */
+	if (dwc->gctl_reset_quirk)
+		dwc3_gctl_core_soft_reset(dwc);
+
 	spin_unlock_irqrestore(&dwc->lock, flags);
 
 	switch (dwc->desired_dr_role) {
@@ -1314,6 +1331,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 
 	dwc->dis_split_quirk = device_property_read_bool(dev,
 				"snps,dis-split-quirk");
+	dwc->gctl_reset_quirk = device_property_read_bool(dev,
+				"snps,gctl-reset-quirk");
 
 	dwc->lpm_nyet_threshold = lpm_nyet_threshold;
 	dwc->tx_de_emphasis = tx_de_emphasis;
drivers/usb/dwc3/core.h +2 -0
index 28475e301ad9..6a050d663ec7 100644
@@ -1035,6 +1035,7 @@ struct dwc3_scratchpad_array {
  * 	3	- Reserved
  * @dis_metastability_quirk: set to disable metastability quirk.
  * @dis_split_quirk: set to disable split boundary.
+ * @gctl_reset_quirk: set to do a gctl soft-reset while switch operation mode.
  * @imod_interval: set the interrupt moderation interval in 250ns
  *                 increments or 0 to disable.
  */
@@ -1222,6 +1223,7 @@ struct dwc3 {
 	unsigned		dis_metastability_quirk:1;
 
 	unsigned		dis_split_quirk:1;
+	unsigned		gctl_reset_quirk:1;
 
 	u16			imod_interval;
 };
Signature · 1 line
2.15.0-rc2
author maintainer
#17 lore raw

PATCH v6 6/13 usb: dwc3: Increase timeout for CmdAct cleared by device controller

In reply to Yu Chen

It needs more time for the device controller to clear the CmdAct of DEPCMD on Hisilicon Kirin Soc.

Cc Andy Shevchenko <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>
---
 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
index e293400cc6e9..9cefb579e161 100644
@@ -270,7 +270,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
 {
 	const struct usb_endpoint_descriptor *desc = dep->endpoint.desc;
 	struct dwc3		*dwc = dep->dwc;
-	u32			timeout = 1000;
+	u32			timeout = 5000;
 	u32			saved_config = 0;
 	u32			reg;
 
Signature · 1 line
2.15.0-rc2
author maintainer
#18 lore raw

PATCH v6 7/13 phy: Add usb phy support for hi3660 Soc of Hisilicon

In reply to Yu Chen

This driver handles usb phy power on and shutdown for hi3660 Soc of Hisilicon.

Cc Andy Shevchenko <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Pengcheng Li <[email protected]>
Cc Jianguo Sun <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Jiancheng Xue <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v1:
* Remove unused code and add comment for time delay as suggested by Kishon Vijay Abraham I.
v2:
* Fix license declaration.
* Remove redundant parens.
* Remove unused member variables in struct hi3660_priv. v4:
* Add comments for HI3660_USB_DEFAULT_PHY_PARAM.
* Add margin for usleep_range.
* Get regmap of otg_bc from parent's of_node.
---

---
 MAINTAINERS                             |   8 ++
 drivers/phy/hisilicon/Kconfig           |  10 ++
 drivers/phy/hisilicon/Makefile          |   1 +
 drivers/phy/hisilicon/phy-hi3660-usb3.c | 233 ++++++++++++++++++++++++++++++++
 4 files changed, 252 insertions(+)
 create mode 100644 drivers/phy/hisilicon/phy-hi3660-usb3.c
MAINTAINERS +8 -0
index d18b4d62cc21..d2c161e7a085 100644
@@ -16084,6 +16084,14 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/usb/roles/intel-xhci-usb-role-switch.c
 
+USB IP DRIVER FOR HISILICON KIRIN
+M:	Yu Chen <[email protected]>
+M:	Binghui Wang <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
+F:	drivers/phy/hisilicon/phy-hi3660-usb3.c
+
 USB ISP116X DRIVER
 M:	Olav Kongas <[email protected]>
 L:	[email protected]
drivers/phy/hisilicon/Kconfig +10 -0
index b40ee54a1a50..3c142f08987c 100644
@@ -12,6 +12,16 @@ config PHY_HI6220_USB
 
 	  To compile this driver as a module, choose M here.
 
+config PHY_HI3660_USB
+	tristate "hi3660 USB PHY support"
+	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Enable this to support the HISILICON HI3660 USB PHY.
+
+	  To compile this driver as a module, choose M here.
+
 config PHY_HISTB_COMBPHY
 	tristate "HiSilicon STB SoCs COMBPHY support"
 	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
drivers/phy/hisilicon/Makefile +1 -0
index f662a4fe18d8..75ba64e2faf8 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_PHY_HI6220_USB)		+= phy-hi6220-usb.o
+obj-$(CONFIG_PHY_HI3660_USB)		+= phy-hi3660-usb3.o
 obj-$(CONFIG_PHY_HISTB_COMBPHY)		+= phy-histb-combphy.o
 obj-$(CONFIG_PHY_HISI_INNO_USB2)	+= phy-hisi-inno-usb2.o
 obj-$(CONFIG_PHY_HIX5HD2_SATA)		+= phy-hix5hd2-sata.o
drivers/phy/hisilicon/phy-hi3660-usb3.c new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
2.15.0-rc2
author maintainer
#19 lore raw

PATCH v6 8/13 usb: roles: Introduce stubs for the exiting functions in role.h.

In reply to Yu Chen

This patch adds stubs for the exiting functions while CONFIG_USB_ROLE_SWITCH does not enabled.

Cc Greg Kroah-Hartman <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc John Stultz <[email protected]>
---
 include/linux/usb/role.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
include/linux/usb/role.h +30 -0
index c05ffa6abda9..da2b9641b877 100644
@@ -42,6 +42,8 @@ struct usb_role_switch_desc {
 	bool allow_userspace_control;
 };
 
+
+#if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role);
 enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw);
 struct usb_role_switch *usb_role_switch_get(struct device *dev);
@@ -51,5 +53,33 @@ struct usb_role_switch *
 usb_role_switch_register(struct device *parent,
 			 const struct usb_role_switch_desc *desc);
 void usb_role_switch_unregister(struct usb_role_switch *sw);
+#else
+static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
+		enum usb_role role)
+{
+	return 0;
+}
+
+static inline enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
+{
+	return USB_ROLE_NONE;
+}
+
+static inline struct usb_role_switch *usb_role_switch_get(struct device *dev)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline void usb_role_switch_put(struct usb_role_switch *sw) { }
+
+static inline struct usb_role_switch *
+usb_role_switch_register(struct device *parent,
+			 const struct usb_role_switch_desc *desc)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }
+#endif
 
 #endif /* __LINUX_USB_ROLE_H */
Signature · 1 line
2.15.0-rc2
author maintainer
#20 lore raw

PATCH v6 9/13 usb: roles: Add usb role switch notifier.

In reply to Yu Chen

This patch adds notifier for drivers want to be informed of the usb role switch.

Cc Greg Kroah-Hartman <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc John Stultz <[email protected]>

---
v5:
* Split the patch into two patches, the first one introduces stubs for
* the
exiting functions, and this patch adds notifier functions. v6:
* Fold a fix in form John Stultz <[email protected]>.
---

---
 drivers/usb/roles/class.c | 35 ++++++++++++++++++++++++++++++++++-
 include/linux/usb/role.h  | 16 ++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)
drivers/usb/roles/class.c +34 -1
index f45d8df5cfb8..5bc60f478725 100644
@@ -20,6 +20,7 @@ struct usb_role_switch {
 	struct device dev;
 	struct mutex lock; /* device lock*/
 	enum usb_role role;
+	struct blocking_notifier_head nh;
 
 	/* From descriptor */
 	struct device *usb2_port;
@@ -49,8 +50,10 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
 	mutex_lock(&sw->lock);
 
 	ret = sw->set(sw->dev.parent, role);
-	if (!ret)
+	if (!ret) {
 		sw->role = role;
+		blocking_notifier_call_chain(&sw->nh, role, NULL);
+	}
 
 	mutex_unlock(&sw->lock);
 
@@ -58,6 +61,35 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
 }
 EXPORT_SYMBOL_GPL(usb_role_switch_set_role);
 
+int usb_role_switch_register_notifier(struct usb_role_switch *sw,
+				      struct notifier_block *nb)
+{
+	int ret = blocking_notifier_chain_register(&sw->nh, nb);
+	enum usb_role role;
+
+	if (ret)
+		return ret;
+
+	/* Initialize the notifier that was just registered */
+	mutex_lock(&sw->lock);
+	if (sw->get)
+		role = sw->get(sw->dev.parent);
+	else
+		role = sw->role;
+	blocking_notifier_call_chain(&sw->nh, role, NULL);
+	mutex_unlock(&sw->lock);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(usb_role_switch_register_notifier);
+
+int usb_role_switch_unregister_notifier(struct usb_role_switch *sw,
+					struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&sw->nh, nb);
+}
+EXPORT_SYMBOL_GPL(usb_role_switch_unregister_notifier);
+
 /**
  * usb_role_switch_get_role - Get the USB role for a switch
  * @sw: USB role switch
@@ -271,6 +303,7 @@ usb_role_switch_register(struct device *parent,
 		return ERR_PTR(-ENOMEM);
 
 	mutex_init(&sw->lock);
+	BLOCKING_INIT_NOTIFIER_HEAD(&sw->nh);
 
 	sw->allow_userspace_control = desc->allow_userspace_control;
 	sw->usb2_port = desc->usb2_port;
include/linux/usb/role.h +16 -0
index da2b9641b877..99d8b8e4fe61 100644
@@ -53,6 +53,10 @@ struct usb_role_switch *
 usb_role_switch_register(struct device *parent,
 			 const struct usb_role_switch_desc *desc);
 void usb_role_switch_unregister(struct usb_role_switch *sw);
+int usb_role_switch_register_notifier(struct usb_role_switch *sw,
+				      struct notifier_block *nb);
+int usb_role_switch_unregister_notifier(struct usb_role_switch *sw,
+					struct notifier_block *nb);
 #else
 static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
 		enum usb_role role)
@@ -80,6 +84,18 @@ usb_role_switch_register(struct device *parent,
 }
 
 static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }
+
+static int usb_role_switch_register_notifier(struct usb_role_switch *sw,
+				      struct notifier_block *nb)
+{
+	return -ENODEV;
+}
+
+static int usb_role_switch_unregister_notifier(struct usb_role_switch *sw,
+					struct notifier_block *nb)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __LINUX_USB_ROLE_H */
Signature · 1 line
2.15.0-rc2
author maintainer
#21 lore raw

PATCH v6 10/13 usb: dwc3: Registering a role switch in the DRD code.

In reply to Yu Chen

The Type-C drivers use USB role switch API to inform the system about the negotiated data role, so registering a role switch in the DRD code in order to support platforms with USB Type-C connectors.

Cc Jun Li <[email protected]>
Cc Valentin Schneider <[email protected]>
Cc John Stultz <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Heikki Krogerus <[email protected]>

---
v2:
* Assign fwnode in dwc3_role_switch.
v3:
* Add default mode property for usb role switch.
* Add select USB_ROLE_SWITCH for USB_DWC3_DUAL_ROLE in Kconfig.
* Do usb_role_switch_register only if property "usb-role-switch"
* present.
v4:
* Add description for 'role_sw' and 'role_switch_default_mode'. v5:
* Init dwc3 mode for usb_role_switch branch.
v6:
* Fold a fix of dwc3_usb_role_switch_get in from John Stultz <[email protected]>
---

---
 drivers/usb/dwc3/Kconfig |  1 +
 drivers/usb/dwc3/core.h  |  6 ++++
 drivers/usb/dwc3/drd.c   | 78 +++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 84 insertions(+), 1 deletion(-)
drivers/usb/dwc3/Kconfig +1 -0
index 2b1494460d0c..661b1d2efc8b 100644
@@ -44,6 +44,7 @@ config USB_DWC3_DUAL_ROLE
 	bool "Dual Role mode"
 	depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
 	depends on (EXTCON=y || EXTCON=USB_DWC3)
+	select USB_ROLE_SWITCH
 	help
 	  This is the default mode of working of DWC3 controller where
 	  both host and gadget features are enabled.
drivers/usb/dwc3/core.h +6 -0
index 6a050d663ec7..e6d40f79faa7 100644
@@ -25,6 +25,7 @@
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
+#include <linux/usb/role.h>
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
@@ -958,6 +959,9 @@ struct dwc3_scratchpad_array {
  * @hsphy_mode: UTMI phy mode, one of following:
  *		- USBPHY_INTERFACE_MODE_UTMI
  *		- USBPHY_INTERFACE_MODE_UTMIW
+ * role_sw: usb_role_switch handle
+ * role_switch_default_mode: default operation mode of controller while
+ *			usb role is USB_ROLE_NONE.
  * @usb2_phy: pointer to USB2 PHY
  * @usb3_phy: pointer to USB3 PHY
  * @usb2_generic_phy: pointer to USB2 PHY
@@ -1091,6 +1095,8 @@ struct dwc3 {
 	struct extcon_dev	*edev;
 	struct notifier_block	edev_nb;
 	enum usb_phy_interface	hsphy_mode;
+	struct usb_role_switch	*role_sw;
+	enum usb_dr_mode	role_switch_default_mode;
 
 	u32			fladj;
 	u32			irq_gadget;
drivers/usb/dwc3/drd.c +77 -1

96 lines not on this page · raw message

Signature · 1 line
2.15.0-rc2
author maintainer
#22 lore raw

PATCH v6 11/13 hikey960: Support usb functionality of Hikey960

In reply to Yu Chen

This driver handles usb hub power on and typeC port event of HiKey960 board:
1)DP&DM switching between usb hub and typeC port base on typeC port state
2)Control power of usb hub on Hikey960
3)Control vbus of typeC port

Cc Chunfeng Yun <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>
Cc Heikki Krogerus <[email protected]>

---
v1:
* Using gpiod API with the gpios.
* Removing registering usb role switch.
* Registering usb role switch notifier.
v2:
* Fix license declaration.
* Add configuration of gpio direction.
* Remove some log print.
v3:
* Remove property of "typec_vbus_enable_val".
* Remove gpiod_direction_output and set initial value of gpio by
* devm_gpiod_get.
v4:
* Remove 'linux/of.h' and add 'linux/mod_devicetable.h'.
* Remove unused 'root' of_node.
* Remove unuseful NULL check return by 'devm_gpiod_get'.
* Use 'devm_gpiod_get_optional' to get optional gpio.
---

---
 drivers/misc/Kconfig          |   6 ++
 drivers/misc/Makefile         |   1 +
 drivers/misc/hisi_hikey_usb.c | 162 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 169 insertions(+)
 create mode 100644 drivers/misc/hisi_hikey_usb.c
drivers/misc/Kconfig +6 -0
index 42ab8ec92a04..3b3f610b80c2 100644
@@ -532,6 +532,12 @@ config PVPANIC
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
 	  (guest) communicate panic events to the host.
 
+config HISI_HIKEY_USB
+	tristate "USB functionality of HiSilicon Hikey Platform"
+	depends on OF && GPIOLIB
+	help
+	  If you say yes here you get support for usb functionality of HiSilicon Hikey Platform.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index d5b7d3404dc7..1c6c108d3a0c 100644
@@ -61,3 +61,4 @@ obj-$(CONFIG_OCXL)		+= ocxl/
 obj-y				+= cardreader/
 obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
+obj-$(CONFIG_HISI_HIKEY_USB)	+= hisi_hikey_usb.o
drivers/misc/hisi_hikey_usb.c new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
2.15.0-rc2
author maintainer
#23 lore raw

PATCH v6 12/13 usb: gadget: Add configfs attribuite for controling match_existing_only

In reply to Yu Chen

Currently the "match_existing_only" of usb_gadget_driver in configfs is set to one which is not flexible.
Dwc3 udc will be removed when usb core switch to host mode. This causes failure of writing name of dwc3 udc to configfs's UDC attribuite. To fix this we need to add a way to change the config of "match_existing_only".
There are systems like Android do not support udev, so adding "match_existing_only" attribute to allow configuration by user is cost little. This patch adds a configfs attribuite for controling match_existing_only which allow user to config "match_existing_only".

Cc Andy Shevchenko <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>
---
 drivers/usb/gadget/configfs.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
drivers/usb/gadget/configfs.c +32 -0
index 025129942894..be85104bfab9 100644
@@ -291,6 +291,36 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
 	return ret;
 }
 
+static ssize_t gadget_driver_match_existing_only_store(struct config_item *item,
+		const char *page, size_t len)
+{
+	struct gadget_info *gi = to_gadget_info(item);
+	struct usb_gadget_driver *gadget_driver = &(gi->composite.gadget_driver);
+	bool match_existing_only;
+	int ret;
+
+	ret = kstrtobool(page, &match_existing_only);
+	if (ret)
+		return ret;
+
+	if (match_existing_only)
+		gadget_driver->match_existing_only = 1;
+	else
+		gadget_driver->match_existing_only = 0;
+
+	return len;
+}
+
+static ssize_t gadget_driver_match_existing_only_show(struct config_item *item,
+		char *page)
+{
+	struct gadget_info *gi = to_gadget_info(item);
+	struct usb_gadget_driver *gadget_driver = &(gi->composite.gadget_driver);
+	bool match_existing_only = !!gadget_driver->match_existing_only;
+
+	return sprintf(page, "%s\n", match_existing_only ? "true" : "false");
+}
+
 CONFIGFS_ATTR(gadget_dev_desc_, bDeviceClass);
 CONFIGFS_ATTR(gadget_dev_desc_, bDeviceSubClass);
 CONFIGFS_ATTR(gadget_dev_desc_, bDeviceProtocol);
@@ -300,6 +330,7 @@ CONFIGFS_ATTR(gadget_dev_desc_, idProduct);
 CONFIGFS_ATTR(gadget_dev_desc_, bcdDevice);
 CONFIGFS_ATTR(gadget_dev_desc_, bcdUSB);
 CONFIGFS_ATTR(gadget_dev_desc_, UDC);
+CONFIGFS_ATTR(gadget_, driver_match_existing_only);
 
 static struct configfs_attribute *gadget_root_attrs[] = {
 	&gadget_dev_desc_attr_bDeviceClass,
@@ -311,6 +342,7 @@ static struct configfs_attribute *gadget_root_attrs[] = {
 	&gadget_dev_desc_attr_bcdDevice,
 	&gadget_dev_desc_attr_bcdUSB,
 	&gadget_dev_desc_attr_UDC,
+	&gadget_attr_driver_match_existing_only,
 	NULL,
 };
 
Signature · 1 line
2.15.0-rc2
author maintainer
#24 lore raw

PATCH v6 13/13 dts: hi3660: Add support for usb on Hikey960

In reply to Yu Chen

This patch adds support for usb on Hikey960.

Cc Chunfeng Yun <[email protected]>
Cc Wei Xu <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v2:
* Remove device_type property.
* Add property "usb-role-switch".
v3:
* Make node "usb_phy" a subnode of usb3_otg_bc register.
* Remove property "typec-vbus-enable-val" of hisi_hikey_usb. v4:
* Remove property "hisilicon,usb3-otg-bc-syscon" of usb-phy.
---

---
 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 53 ++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi         | 73 +++++++++++++++++++++++
 2 files changed, 126 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +53 -0
index e035cf195b19..d4e11c56b250 100644
@@ -13,6 +13,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/usb/pd.h>
 
 / {
 	model = "HiKey960";
@@ -196,6 +197,26 @@
 			method = "smc";
 		};
 	};
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960_usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
+
 };
 
 /*
@@ -526,6 +547,38 @@
 &i2c1 {
 	status = "okay";
 
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";
+		reg = <0x4e>;
+		status = "ok";
+		interrupt-parent = <&gpio27>;
+		interrupts = <3 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>;
+		};
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch>;
+			};
+		};
+	};
+
 	adv7533: adv7533@39 {
 		status = "ok";
 		compatible = "adi,adv7533";
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +73 -0

84 lines not on this page · raw message

Signature · 1 line
2.15.0-rc2
maintainer
#25 lore raw

Re: [PATCH v6 13/13] dts: hi3660: Add support for usb on Hikey960

Quoted 65 lines · Yu Chen

This patch adds support for usb on Hikey960.

Cc Chunfeng Yun <[email protected]>
Cc Wei Xu <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v2:
* Remove device_type property.
* Add property "usb-role-switch".
v3:
* Make node "usb_phy" a subnode of usb3_otg_bc register.
* Remove property "typec-vbus-enable-val" of hisi_hikey_usb. v4:
* Remove property "hisilicon,usb3-otg-bc-syscon" of usb-phy.
---

---
 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 53 ++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi         | 73 +++++++++++++++++++++++
 2 files changed, 126 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +21 -0
index e035cf195b19..d4e11c56b250 100644
@@ -13,6 +13,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/usb/pd.h>
 
 / {
 	model = "HiKey960";
@@ -196,6 +197,26 @@
 			method = "smc";
 		};
 	};
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960_usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
+
 };
 
 /*

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 551

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
@@ -526,6 +547,38 @@
 &i2c1 {
 	status = "okay";
 
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";

The binding doc for this should state it should have a 'connector' node.

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 553

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
+		reg = <0x4e>;
+		status = "ok";

Can drop this, it is the default.

Quoted 8 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +8 -0
+		interrupt-parent = <&gpio27>;
+		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_cfg_func>;
+
+		usb_con: connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 571

Quoted 10 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +10 -0
+			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>;
+		};
+
+		port {

The connector node should have a 'ports' child with 'port@0' being the HS connection.

Quoted 43 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +10 -0
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch>;
+			};
+		};
+	};
+
 	adv7533: adv7533@39 {
 		status = "ok";
 		compatible = "adi,adv7533";
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +15 -0
index 2f19e0e5b7cf..173467505ada 100644
@@ -355,6 +355,12 @@
 			#clock-cells = <1>;
 		};
 
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3660-pmctrl", "syscon";
+			reg = <0x0 0xfff31000 0x0 0x1000>;
+			#clock-cells = <1>;
+		};
+
 		pmuctrl: crg_ctrl@fff34000 {
 			compatible = "hisilicon,hi3660-pmuctrl", "syscon";
 			reg = <0x0 0xfff34000 0x0 0x1000>;
@@ -1134,5 +1140,72 @@
 				};
 			};
 		};
+
+		usb3_otg_bc: usb3_otg_bc@ff200000 {
+			compatible = "syscon", "simple-mfd";
+			reg = <0x0 0xff200000 0x0 0x1000>;
+
+			usb_phy: usb-phy {
+				compatible = "hisilicon,hi3660-usb-phy";
+				#phy-cells = <0>;
+				hisilicon,pericrg-syscon = <&crg_ctrl>;

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1161

Quoted 10 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +10 -0
+				hisilicon,pctrl-syscon = <&pctrl>;
+				hisilicon,eye-diagram-param = <0x22466e4>;
+			};
+		};
+
+		usb3: hisi_dwc3 {
+			compatible = "hisilicon,hi3660-dwc3";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;

If there are not any wrapper registers, then get rid of the hisi_dwc3 node. For just clocks and resets we just put everything in one node.

Quoted 19 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +19 -0
+
+			clocks = <&crg_ctrl HI3660_CLK_ABB_USB>,
+				 <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+			clock-names = "clk_usb3phy_ref", "aclk_usb3otg";
+
+			assigned-clocks = <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+			assigned-clock-rates = <229000000>;
+			resets = <&crg_rst 0x90 8>,
+				 <&crg_rst 0x90 7>,
+				 <&crg_rst 0x90 6>,
+				 <&crg_rst 0x90 5>;
+
+			dwc3: dwc3@ff100000 {
+				compatible = "snps,dwc3";
+				reg = <0x0 0xff100000 0x0 0x100000>;
+				interrupts = <0 159 4>, <0 161 4>;
+				phys = <&usb_phy>;
+				phy-names = "usb3-phy";
+				dr_mode = "otg";

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1189

Quoted 10 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +9 -0
+				maximum-speed = "super-speed";
+				phy_type = "utmi";
+				snps,dis-del-phy-power-chg-quirk;
 
+				snps,lfps_filter_quirk;
+				snps,dis_u2_susphy_quirk;
+				snps,dis_u3_susphy_quirk;
+				snps,tx_de_emphasis_quirk;
+				snps,tx_de_emphasis = <1>;
+				snps,dis_enblslpm_quirk;

Pretty sure these aren't documented because we don't use '_' in property names.

Quoted 25 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +20 -0
+				snps,gctl-reset-quirk;
+				usb-role-switch;
+				role-switch-default-host;
+
+				port {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					dwc3_role_switch: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&rt1711h_ep>;
+					};
+
+					dwc3_role_switch_notify: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&hikey_usb_ep>;
+					};
+				};
+			};
+		};
 	};

};

Signature · 1 line
2.15.0-rc2
author maintainer
#26 lore raw

Re: [PATCH v6 13/13] dts: hi3660: Add support for usb on Hikey960

Hi Rob,

Quoted 69 lines · Rob Herring
Quoted 68 lines · Yu Chen

This patch adds support for usb on Hikey960.

Cc Chunfeng Yun <[email protected]>
Cc Wei Xu <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>

---
v2:
* Remove device_type property.
* Add property "usb-role-switch".
v3:
* Make node "usb_phy" a subnode of usb3_otg_bc register.
* Remove property "typec-vbus-enable-val" of hisi_hikey_usb. v4:
* Remove property "hisilicon,usb3-otg-bc-syscon" of usb-phy.
---

---
 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 53 ++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi         | 73 +++++++++++++++++++++++
 2 files changed, 126 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +21 -0
index e035cf195b19..d4e11c56b250 100644
@@ -13,6 +13,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/usb/pd.h>
 
 / {
 	model = "HiKey960";
@@ -196,6 +197,26 @@
 			method = "smc";
 		};
 	};
+
+	hisi_hikey_usb: hisi_hikey_usb {
+		compatible = "hisilicon,hikey960_usb";
+		typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+		otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+		hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usbhub5734_pmx_func>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hikey_usb_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch_notify>;
+			};
+		};
+	};
+
 };
 
 /*
@@ -526,6 +547,38 @@
 &i2c1 {
 	status = "okay";
 
Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 551

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
+	rt1711h: rt1711h@4e {
+		compatible = "richtek,rt1711h";

The binding doc for this should state it should have a 'connector' node.

Hi shufan,
Is the 'connector' node an essential node of rt1711h?
Currently it is missing in Documentation/devicetree/bindings/usb/richtek,rt1711h.txt. Do you think the 'connector' node should add as this patch in the binding doc?

Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 553

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
+		reg = <0x4e>;
+		status = "ok";

Can drop this, it is the default.

OK.

Quoted 13 lines
Quoted 13 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +13 -0
+		interrupt-parent = <&gpio27>;
+		interrupts = <3 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)
Quoted 9 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 571

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +5 -0
+				PDO_VAR(5000, 5000, 1000)>;
+			op-sink-microwatt = <10000000>;
+		};
+
+		port {

The connector node should have a 'ports' child with 'port@0' being the HS connection.

This port and endpoint of the port are used for role_switch matching by fwnode_graph_devcon_match. I'm not too sure the 'ports' under connector is used in rt1711h driver?
Hi shufan_lee,
Can you confirm this?

Quoted 48 lines
Quoted 48 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +10 -0
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rt1711h_ep: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&dwc3_role_switch>;
+			};
+		};
+	};
+
 	adv7533: adv7533@39 {
 		status = "ok";
 		compatible = "adi,adv7533";
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +20 -0
index 2f19e0e5b7cf..173467505ada 100644
@@ -355,6 +355,12 @@
 			#clock-cells = <1>;
 		};
 
+		pmctrl: pmctrl@fff31000 {
+			compatible = "hisilicon,hi3660-pmctrl", "syscon";
+			reg = <0x0 0xfff31000 0x0 0x1000>;
+			#clock-cells = <1>;
+		};
+
 		pmuctrl: crg_ctrl@fff34000 {
 			compatible = "hisilicon,hi3660-pmuctrl", "syscon";
 			reg = <0x0 0xfff34000 0x0 0x1000>;
@@ -1134,5 +1140,72 @@
 				};
 			};
 		};
+
+		usb3_otg_bc: usb3_otg_bc@ff200000 {
+			compatible = "syscon", "simple-mfd";
+			reg = <0x0 0xff200000 0x0 0x1000>;
+
+			usb_phy: usb-phy {
+				compatible = "hisilicon,hi3660-usb-phy";
+				#phy-cells = <0>;
+				hisilicon,pericrg-syscon = <&crg_ctrl>;
+				hisilicon,pctrl-syscon = <&pctrl>;
+				hisilicon,eye-diagram-param = <0x22466e4>;
+			};
+		};
+
Quoted 9 lines

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1161

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +5 -0
+		usb3: hisi_dwc3 {
+			compatible = "hisilicon,hi3660-dwc3";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;

If there are not any wrapper registers, then get rid of the hisi_dwc3 node. For just clocks and resets we just put everything in one node.

I will try to fix this.

Quoted 23 lines
Quoted 22 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +22 -0
+
+			clocks = <&crg_ctrl HI3660_CLK_ABB_USB>,
+				 <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+			clock-names = "clk_usb3phy_ref", "aclk_usb3otg";
+
+			assigned-clocks = <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+			assigned-clock-rates = <229000000>;
+			resets = <&crg_rst 0x90 8>,
+				 <&crg_rst 0x90 7>,
+				 <&crg_rst 0x90 6>,
+				 <&crg_rst 0x90 5>;
+
+			dwc3: dwc3@ff100000 {
+				compatible = "snps,dwc3";
+				reg = <0x0 0xff100000 0x0 0x100000>;
+				interrupts = <0 159 4>, <0 161 4>;
+				phys = <&usb_phy>;
+				phy-names = "usb3-phy";
+				dr_mode = "otg";
+				maximum-speed = "super-speed";
+				phy_type = "utmi";
+				snps,dis-del-phy-power-chg-quirk;
Quoted 10 lines

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1189

Quoted 6 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +6 -0
+				snps,lfps_filter_quirk;
+				snps,dis_u2_susphy_quirk;
+				snps,dis_u3_susphy_quirk;
+				snps,tx_de_emphasis_quirk;
+				snps,tx_de_emphasis = <1>;
+				snps,dis_enblslpm_quirk;

Pretty sure these aren't documented because we don't use '_' in property names.

Do you mean property as "snps,dis_enblslpm_quirk"? These properties are documented in Documentation/devicetree/bindings/usb/dwc3.txt.

Quoted 19 lines
Quoted 19 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +19 -0
+				snps,gctl-reset-quirk;
+				usb-role-switch;
+				role-switch-default-host;
+
+				port {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					dwc3_role_switch: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&rt1711h_ep>;
+					};
+
+					dwc3_role_switch_notify: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&hikey_usb_ep>;
+					};
+				};
+			};
Quoted 9 lines
Quoted 6 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +1 -0
+		};
 	};
 };
Signature · 1 line
2.15.0-rc2

.

Thanks
- Yu Chen

#27 lore raw

RE: [PATCH v6 13/13] dts: hi3660: Add support for usb on Hikey960

Hi Yu Chen,

From: Chen Yu <[email protected]>
Sent: Tuesday, April 30, 2019 3:16 PM
To: Rob Herring <[email protected]>
Cc: Liuyu (R) <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Chunfeng Yun <[email protected]>; Wei Xu <[email protected]>; Mark Rutland <[email protected]>; [email protected]; Binghui Wang <[email protected]>; shufan_lee(李書帆) <[email protected]>
Subject: Re: [PATCH v6 13/13] dts: hi3660: Add support for usb on Hikey960

Hi Rob,

Quoted 75 lines · Rob Herring
Quoted 70 lines · Yu Chen
Quoted 10 lines

This patch adds support for usb on Hikey960.

Cc Chunfeng Yun <[email protected]>
Cc Wei Xu <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc John Stultz <[email protected]>
Cc Binghui Wang <[email protected]>
Quoted 4 lines

---
v2:
* Remove device_type property.
* Add property "usb-role-switch".

v3:

Quoted 54 lines

* Make node "usb_phy" a subnode of usb3_otg_bc register.
* Remove property "typec-vbus-enable-val" of hisi_hikey_usb. v4:
* Remove property "hisilicon,usb3-otg-bc-syscon" of usb-phy.
---

---
 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 53 ++++++++++++++++
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi         | 73 +++++++++++++++++++++++
 2 files changed, 126 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +0 -0
index e035cf195b19..d4e11c56b250 100644
@@ -13,6 +13,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>  #include

<dt-bindings/interrupt-controller/irq.h>

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +21 -0
+#include <dt-bindings/usb/pd.h>
 
 / {
 model = "HiKey960";
@@ -196,6 +197,26 @@
 method = "smc";
 };
 };
+
+hisi_hikey_usb: hisi_hikey_usb {
+compatible = "hisilicon,hikey960_usb";
+typec-vbus-gpios = <&gpio25 2 GPIO_ACTIVE_HIGH>;
+otg-switch-gpios = <&gpio25 6 GPIO_ACTIVE_HIGH>;
+hub-vdd33-en-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
+pinctrl-names = "default";
+pinctrl-0 = <&usbhub5734_pmx_func>;
+
+port {
+#address-cells = <1>;
+#size-cells = <0>;
+
+hikey_usb_ep: endpoint@0 {
+reg = <0>;
+remote-endpoint = <&dwc3_role_switch_notify>;
+};
+};
+};
+
 };
 
 /*
@@ -526,6 +547,38 @@
 &i2c1 {
 status = "okay";
 
Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 551

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
+rt1711h: rt1711h@4e {
+compatible = "richtek,rt1711h";

The binding doc for this should state it should have a 'connector' node.

Quoted 4 lines

Hi shufan,
Is the 'connector' node an essential node of rt1711h?
Currently it is missing in Documentation/devicetree/bindings/usb/richtek,rt1711h.txt. Do you think the 'connector' node should add as this patch in the binding doc?

Yes.
For rt1711h, the parsing work is done when calling tcpci_register_port and tcpm_register_port.
The parsing flow is uploaded by Jun Li after rt1711h is uploaded, so richtek,rt1711h.txt hasn't modified yet.
To add rt1711h node and modify the binding doc, richtek,rt1711h.txt, you can refer to Documentation/devicetree/bindings/usb/typec-tcpci.txt

Quoted 29 lines
Quoted 5 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 553

Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +2 -0
+reg = <0x4e>;
+status = "ok";

Can drop this, it is the default.

OK.

Quoted 13 lines
Quoted 13 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +13 -0
+interrupt-parent = <&gpio27>;
+interrupts = <3 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)
Quoted 9 lines

arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts line 571

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +5 -0
+PDO_VAR(5000, 5000, 1000)>;
+op-sink-microwatt = <10000000>;
+};
+
+port {

The connector node should have a 'ports' child with 'port@0' being the HS connection.

Quoted 3 lines

This port and endpoint of the port are used for role_switch matching by fwnode_graph_devcon_match. I'm not too sure the 'ports' under connector is used in rt1711h driver? Hi shufan_lee,
Can you confirm this?

The 'ports' is not used in rt1711h's driver.
I'm not sure if this is helpful but the usage of 'ports' may refer to the following patch.
https://lore.kernel.org/patchwork/patch/879945/

Quoted 122 lines
Quoted 48 lines
Quoted 48 lines
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +10 -0
+#address-cells = <1>;
+#size-cells = <0>;
+
+rt1711h_ep: endpoint@0 {
+reg = <0>;
+remote-endpoint = <&dwc3_role_switch>;
+};
+};
+};
+
 adv7533: adv7533@39 {
 status = "ok";
 compatible = "adi,adv7533";
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +6 -0
index 2f19e0e5b7cf..173467505ada 100644
@@ -355,6 +355,12 @@
 #clock-cells = <1>;
 };
 
+pmctrl: pmctrl@fff31000 {
+compatible = "hisilicon,hi3660-pmctrl", "syscon";
+reg = <0x0 0xfff31000 0x0 0x1000>;
+#clock-cells = <1>;
+};
+
 pmuctrl: crg_ctrl@fff34000 {
 compatible = "hisilicon,hi3660-pmuctrl", "syscon";
 reg = <0x0 0xfff34000 0x0 0x1000>; @@ -1134,5 +1140,72 @@

};
};
};

arch/arm64/boot/dts/hisilicon/hi3660.dtsi +14 -0
+
+usb3_otg_bc: usb3_otg_bc@ff200000 {
+compatible = "syscon", "simple-mfd";
+reg = <0x0 0xff200000 0x0 0x1000>;
+
+usb_phy: usb-phy {
+compatible = "hisilicon,hi3660-usb-phy";
+#phy-cells = <0>;
+hisilicon,pericrg-syscon = <&crg_ctrl>;
+hisilicon,pctrl-syscon = <&pctrl>;
+hisilicon,eye-diagram-param = <0x22466e4>;
+};
+};
+
Quoted 9 lines

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1161

Quoted 5 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +5 -0
+usb3: hisi_dwc3 {
+compatible = "hisilicon,hi3660-dwc3";
+#address-cells = <2>;
+#size-cells = <2>;
+ranges;

If there are not any wrapper registers, then get rid of the hisi_dwc3 node. For just clocks and resets we just put everything in one node.

I will try to fix this.

Quoted 23 lines
Quoted 22 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +22 -0
+
+clocks = <&crg_ctrl HI3660_CLK_ABB_USB>,
+ <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+clock-names = "clk_usb3phy_ref", "aclk_usb3otg";
+
+assigned-clocks = <&crg_ctrl HI3660_ACLK_GATE_USB3OTG>;
+assigned-clock-rates = <229000000>;
+resets = <&crg_rst 0x90 8>,
+ <&crg_rst 0x90 7>,
+ <&crg_rst 0x90 6>,
+ <&crg_rst 0x90 5>;
+
+dwc3: dwc3@ff100000 {
+compatible = "snps,dwc3";
+reg = <0x0 0xff100000 0x0 0x100000>;
+interrupts = <0 159 4>, <0 161 4>;
+phys = <&usb_phy>;
+phy-names = "usb3-phy";
+dr_mode = "otg";
+maximum-speed = "super-speed";
+phy_type = "utmi";
+snps,dis-del-phy-power-chg-quirk;
Quoted 10 lines

arch/arm64/boot/dts/hisilicon/hi3660.dtsi line 1189

Quoted 6 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +6 -0
+snps,lfps_filter_quirk;
+snps,dis_u2_susphy_quirk;
+snps,dis_u3_susphy_quirk;
+snps,tx_de_emphasis_quirk;
+snps,tx_de_emphasis = <1>;
+snps,dis_enblslpm_quirk;

Pretty sure these aren't documented because we don't use '_' in property names.

Do you mean property as "snps,dis_enblslpm_quirk"? These properties are documented in Documentation/devicetree/bindings/usb/dwc3.txt.

Quoted 19 lines
Quoted 19 lines
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +19 -0
+snps,gctl-reset-quirk;
+usb-role-switch;
+role-switch-default-host;
+
+port {
+#address-cells = <1>;
+#size-cells = <0>;
+
+dwc3_role_switch: endpoint@0 {
+reg = <0>;
+remote-endpoint = <&rt1711h_ep>;
+};
+
+dwc3_role_switch_notify: endpoint@1 {
+reg = <1>;
+remote-endpoint = <&hikey_usb_ep>;
+};
+};
+};
Quoted 9 lines
Quoted 6 lines

+};
};
};
--
2.15.0-rc2

.

Quoted 2 lines

Thanks
- Yu Chen

************* Email Confidentiality Notice ********************

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Tested-by on the v6 series
#28 lore raw
In reply to Yu Chen

Hi,

Quoted 6 lines · Yu Chen

The patchset adds support for usb functionality of Hikey960, includes:
- usb phy driver for Hisilicon Kirin Soc hi3660
- usb driver for HiKey960 board
- some adjustment in dwc3 and usb role driver
- dts for support usb of HiKey960

Still works fine on my Debian setup:

Thanks,
Valentin