linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Make USB ports to work on HiKey960/970
@ 2021-09-03  9:28 Mauro Carvalho Chehab
  2021-09-03  9:28 ` [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970 Mauro Carvalho Chehab
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2021-09-03  9:28 UTC (permalink / raw)
  To: Rob Herring, John Stultz
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Rob Herring,
	devicetree, linux-arm-kernel, linux-kernel

Hi Rob,

It follows the patchset adding a DT schema needed to power on and to
use the integrated USB hub found on HiKey 960 and Hikey 970 boards.

Besides each board use a different chip for the hub,  on both they're
controlled the same way. Such boards come with an integrated 4-port
USB hub on it, set on what it seems to be a non-standard way: on both 
implementations, the USB type-C port is used to detect the USB role.

When in host mode, the 3.3V power supply (VDD33 pins) for the hub
are disabled. That disables the USB I/O on type-A ports.

When USB type-C is on device mode, the OTG is switched via a GPIO pin
to device mode, and the hub is powered on.

A Type-C power supply line is also controlled depending on the role.

-

The entire series  which contains the remaining patches to support
PCI and USB on HiKey970, and USB on HiKey960 is at:

    https://github.com/mchehab/linux/commits/linux-master

The patches needed by the USB on HiKey970 were already merged
upstream. So, the above branch applies on the top of Linux master
branch.

Tested on HiKey 960:

	$ lsusb
	Bus 002 Device 002: ID 0424:5734 Standard Microsystems Corp. 
	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
	Bus 001 Device 004: ID 0424:2740 Standard Microsystems Corp. 
	Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
	Bus 001 Device 002: ID 0424:2734 Standard Microsystems Corp. 
	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Tested on HiKey 970:
	
	$ 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 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
	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

v4:
  - Improved description at the DT schema;
  - Use just one compatible, as there's no difference between
    HiKey 960 and 970 with regards to how the hub should be
    controlled;
  - parse usb-role-switch property at the driver;
  - make the properties that depends on usb-role-switch optional.

v3:
  - The examples at the dt-bindings were updated to reflect
    the actual DTS content and won't produce any warnings;
  - Added John Stultz SoB to Hikey960 DTS patch;
  - Added a patch for the mux hub driver for it to work with
    the newer schema;

John Stultz (1):
  arm64: dts: hisilicon: Add usb mux hub for hikey960

Mauro Carvalho Chehab (2):
  misc: hisi_hikey_usb: change the DT schema
  arm64: dts: hisilicon: Add usb mux hub for hikey970

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

 .../bindings/misc/hisilicon,hikey-usb.yaml    |  87 +++++++++++++
 .../boot/dts/hisilicon/hi3660-hikey960.dts    |  35 +++++-
 .../boot/dts/hisilicon/hi3670-hikey970.dts    |  23 ++++
 drivers/misc/hisi_hikey_usb.c                 | 119 +++++++++---------
 4 files changed, 206 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/hisilicon,hikey-usb.yaml

-- 
2.31.1



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970
  2021-09-03  9:28 [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
@ 2021-09-03  9:28 ` Mauro Carvalho Chehab
  2021-09-09 23:12   ` kernel test robot
  2021-09-03  9:28 ` [PATCH v4 4/4] arm64: dts: hisilicon: Add usb mux hub for hikey960 Mauro Carvalho Chehab
  2021-09-15 13:12 ` [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
  2 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2021-09-03  9:28 UTC (permalink / raw)
  To: Rob Herring, John Stultz
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Rob Herring,
	Wei Xu, devicetree, linux-arm-kernel, linux-kernel

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

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 .../boot/dts/hisilicon/hi3670-hikey970.dts    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 4/4] arm64: dts: hisilicon: Add usb mux hub for hikey960
  2021-09-03  9:28 [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
  2021-09-03  9:28 ` [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970 Mauro Carvalho Chehab
@ 2021-09-03  9:28 ` Mauro Carvalho Chehab
  2021-09-15 13:12 ` [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
  2 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2021-09-03  9:28 UTC (permalink / raw)
  To: Rob Herring, John Stultz
  Cc: linuxarm, mauro.chehab, Rob Herring, Wei Xu, devicetree,
	linux-arm-kernel, linux-kernel, Mauro Carvalho Chehab

From: John Stultz <john.stultz@linaro.org>

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

[mchehab: modified it to adapt to the merged DT schema]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 .../boot/dts/hisilicon/hi3660-hikey960.dts    | 35 +++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970
  2021-09-03  9:28 ` [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970 Mauro Carvalho Chehab
@ 2021-09-09 23:12   ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-09-09 23:12 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, John Stultz
  Cc: kbuild-all, linux-media, linuxarm, mauro.chehab,
	Mauro Carvalho Chehab, Wei Xu, devicetree, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing v5.14 next-20210909]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Make-USB-ports-to-work-on-HiKey960-970/20210903-173102
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm64-buildonly-randconfig-r001-20210908 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b8b9096981afc8389783e87cd0342002d4aeed94
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mauro-Carvalho-Chehab/Make-USB-ports-to-work-on-HiKey960-970/20210903-173102
        git checkout b8b9096981afc8389783e87cd0342002d4aeed94
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43931 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 0/4] Make USB ports to work on HiKey960/970
  2021-09-03  9:28 [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
  2021-09-03  9:28 ` [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970 Mauro Carvalho Chehab
  2021-09-03  9:28 ` [PATCH v4 4/4] arm64: dts: hisilicon: Add usb mux hub for hikey960 Mauro Carvalho Chehab
@ 2021-09-15 13:12 ` Mauro Carvalho Chehab
  2 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2021-09-15 13:12 UTC (permalink / raw)
  To: Rob Herring, John Stultz
  Cc: linuxarm, mauro.chehab, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel

Hi Rob,

Em Fri,  3 Sep 2021 11:28:31 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:

> Hi Rob,
> 
> It follows the patchset adding a DT schema needed to power on and to
> use the integrated USB hub found on HiKey 960 and Hikey 970 boards.
> 
> Besides each board use a different chip for the hub,  on both they're
> controlled the same way. Such boards come with an integrated 4-port
> USB hub on it, set on what it seems to be a non-standard way: on both 
> implementations, the USB type-C port is used to detect the USB role.
> 
> When in host mode, the 3.3V power supply (VDD33 pins) for the hub
> are disabled. That disables the USB I/O on type-A ports.
> 
> When USB type-C is on device mode, the OTG is switched via a GPIO pin
> to device mode, and the hub is powered on.
> 
> A Type-C power supply line is also controlled depending on the role.

Gentile ping.

Regards,
Mauro
> 
> -
> 
> The entire series  which contains the remaining patches to support
> PCI and USB on HiKey970, and USB on HiKey960 is at:
> 
>     https://github.com/mchehab/linux/commits/linux-master
> 
> The patches needed by the USB on HiKey970 were already merged
> upstream. So, the above branch applies on the top of Linux master
> branch.
> 
> Tested on HiKey 960:
> 
> 	$ lsusb
> 	Bus 002 Device 002: ID 0424:5734 Standard Microsystems Corp. 
> 	Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> 	Bus 001 Device 004: ID 0424:2740 Standard Microsystems Corp. 
> 	Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
> 	Bus 001 Device 002: ID 0424:2734 Standard Microsystems Corp. 
> 	Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> 
> Tested on HiKey 970:
> 	
> 	$ 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 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
> 	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
> 
> v4:
>   - Improved description at the DT schema;
>   - Use just one compatible, as there's no difference between
>     HiKey 960 and 970 with regards to how the hub should be
>     controlled;
>   - parse usb-role-switch property at the driver;
>   - make the properties that depends on usb-role-switch optional.
> 
> v3:
>   - The examples at the dt-bindings were updated to reflect
>     the actual DTS content and won't produce any warnings;
>   - Added John Stultz SoB to Hikey960 DTS patch;
>   - Added a patch for the mux hub driver for it to work with
>     the newer schema;
> 
> John Stultz (1):
>   arm64: dts: hisilicon: Add usb mux hub for hikey960
> 
> Mauro Carvalho Chehab (2):
>   misc: hisi_hikey_usb: change the DT schema
>   arm64: dts: hisilicon: Add usb mux hub for hikey970
> 
> Yu Chen (1):
>   dt-bindings: misc: add schema for USB hub on Kirin devices
> 
>  .../bindings/misc/hisilicon,hikey-usb.yaml    |  87 +++++++++++++
>  .../boot/dts/hisilicon/hi3660-hikey960.dts    |  35 +++++-
>  .../boot/dts/hisilicon/hi3670-hikey970.dts    |  23 ++++
>  drivers/misc/hisi_hikey_usb.c                 | 119 +++++++++---------
>  4 files changed, 206 insertions(+), 58 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/misc/hisilicon,hikey-usb.yaml
> 



Thanks,
Mauro

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-15 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  9:28 [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab
2021-09-03  9:28 ` [PATCH v4 3/4] arm64: dts: hisilicon: Add usb mux hub for hikey970 Mauro Carvalho Chehab
2021-09-09 23:12   ` kernel test robot
2021-09-03  9:28 ` [PATCH v4 4/4] arm64: dts: hisilicon: Add usb mux hub for hikey960 Mauro Carvalho Chehab
2021-09-15 13:12 ` [PATCH v4 0/4] Make USB ports to work on HiKey960/970 Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).