linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Allwinner R40 USB host support (DT part)
@ 2017-10-18 13:06 Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 1/5] ARM: sun8i: r40: add USB host port nodes for R40 Icenowy Zheng
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset adds support for the USB host ports on Allwiner R40, and
enable them on Banana Pi M2 Ultra and Berry boards.

The first patch adds USB PHY and EHCI/OHCI nodes to the R40 DTSI.

The second and third patch adds 5V regulator for the two boards, and
the fourth and fifth patch finally adds USB host ports support.

Icenowy Zheng (5):
  ARM: sun8i: r40: add USB host port nodes for R40
  ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra
  ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry
  ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra
  ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry

 arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 31 ++++++++++
 arch/arm/boot/dts/sun8i-r40.dtsi                  | 72 +++++++++++++++++++++++
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 +++++++
 3 files changed, 125 insertions(+)

-- 
2.13.6

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

* [PATCH v2 1/5] ARM: sun8i: r40: add USB host port nodes for R40
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
@ 2017-10-18 13:06 ` Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 2/5] ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra Icenowy Zheng
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

From: Icenowy Zheng <icenowy@aosc.xyz>

Allwinner R40 SoC features a USB OTG port and two USB HOST ports.

Add support for the host ports in the DTSI file.

The OTG controller still cannot work with existing compatibles, and needs
more investigation. So it's not added yet.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
Changes in v2:
- Dropped the bogus OHCI resources in EHCI device node.

 arch/arm/boot/dts/sun8i-r40.dtsi | 72 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index d5a6745409ae..19f270a9f3b1 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -173,6 +173,78 @@
 			#size-cells = <0>;
 		};
 
+		usbphy: phy at 1c13400 {
+			compatible = "allwinner,sun8i-r40-usb-phy";
+			reg = <0x01c13400 0x14>,
+			      <0x01c14800 0x4>,
+			      <0x01c19800 0x4>,
+			      <0x01c1c800 0x4>;
+			reg-names = "phy_ctrl",
+				    "pmu0",
+				    "pmu1",
+				    "pmu2";
+			clocks = <&ccu CLK_USB_PHY0>,
+				 <&ccu CLK_USB_PHY1>,
+				 <&ccu CLK_USB_PHY2>;
+			clock-names = "usb0_phy",
+				      "usb1_phy",
+				      "usb2_phy";
+			resets = <&ccu RST_USB_PHY0>,
+				 <&ccu RST_USB_PHY1>,
+				 <&ccu RST_USB_PHY2>;
+			reset-names = "usb0_reset",
+				      "usb1_reset",
+				      "usb2_reset";
+			status = "disabled";
+			#phy-cells = <1>;
+		};
+
+		ehci1: usb at 1c19000 {
+			compatible = "allwinner,sun8i-r40-ehci", "generic-ehci";
+			reg = <0x01c19000 0x100>;
+			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_EHCI1>;
+			resets = <&ccu RST_BUS_EHCI1>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci1: usb at 1c19400 {
+			compatible = "allwinner,sun8i-r40-ohci", "generic-ohci";
+			reg = <0x01c19400 0x100>;
+			interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_OHCI1>,
+				 <&ccu CLK_USB_OHCI1>;
+			resets = <&ccu RST_BUS_OHCI1>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ehci2: usb at 1c1c000 {
+			compatible = "allwinner,sun8i-r40-ehci", "generic-ehci";
+			reg = <0x01c1c000 0x100>;
+			interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_EHCI2>;
+			resets = <&ccu RST_BUS_EHCI2>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci2: usb at 1c1c400 {
+			compatible = "allwinner,sun8i-r40-ohci", "generic-ohci";
+			reg = <0x01c1c400 0x100>;
+			interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_OHCI2>,
+				 <&ccu CLK_USB_OHCI2>;
+			resets = <&ccu RST_BUS_OHCI2>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
 		ccu: clock at 1c20000 {
 			compatible = "allwinner,sun8i-r40-ccu";
 			reg = <0x01c20000 0x400>;
-- 
2.13.6

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

* [PATCH v2 2/5] ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 1/5] ARM: sun8i: r40: add USB host port nodes for R40 Icenowy Zheng
@ 2017-10-18 13:06 ` Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 3/5] ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry Icenowy Zheng
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

On newer revisions of the Banana Pi M2 Ultra boards, the 5V power output
(used by HDMI, SATA and USB) is controller via a GPIO.

Add the regulator node for it.

Older revisions just have the 5V power output always on, and the GPIO is
reserved on these boards. So it won't affect the older revisions.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 7b52608cebe6..035599d870b9 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -78,6 +78,15 @@
 		};
 	};
 
+	reg_vcc5v0: vcc5v0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
+		enable-active-high;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
-- 
2.13.6

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

* [PATCH v2 3/5] ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 1/5] ARM: sun8i: r40: add USB host port nodes for R40 Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 2/5] ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra Icenowy Zheng
@ 2017-10-18 13:06 ` Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 4/5] ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra Icenowy Zheng
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

On the Banana Pi M2 Berry board, the 5V power output (used by HDMI, SATA
and USB) is controlled via a GPIO.

Add regulator node for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index 8a69be2a0842..fe16fc0eb518 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -72,6 +72,15 @@
 		};
 	};
 
+	reg_vcc5v0: vcc5v0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
+		enable-active-high;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
-- 
2.13.6

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

* [PATCH v2 4/5] ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
                   ` (2 preceding siblings ...)
  2017-10-18 13:06 ` [PATCH v2 3/5] ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry Icenowy Zheng
@ 2017-10-18 13:06 ` Icenowy Zheng
  2017-10-18 13:06 ` [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry Icenowy Zheng
  2017-10-19  7:42 ` [linux-sunxi] [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Chen-Yu Tsai
  5 siblings, 0 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

From: Icenowy Zheng <icenowy@aosc.xyz>

Banana Pi M2 Ultra board features two USB host ports, connected to the
two USB host ports on the SoC.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 035599d870b9..8c5efe2a9881 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -93,6 +93,14 @@
 	};
 };
 
+&ehci1 {
+	status = "okay";
+};
+
+&ehci2 {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -180,8 +188,22 @@
 	status = "okay";
 };
 
+&ohci1 {
+	status = "okay";
+};
+
+&ohci2 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pb_pins>;
 	status = "okay";
 };
+
+&usbphy {
+	usb1_vbus-supply = <&reg_vcc5v0>;
+	usb2_vbus-supply = <&reg_vcc5v0>;
+	status = "okay";
+};
-- 
2.13.6

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

* [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
                   ` (3 preceding siblings ...)
  2017-10-18 13:06 ` [PATCH v2 4/5] ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra Icenowy Zheng
@ 2017-10-18 13:06 ` Icenowy Zheng
  2017-10-19  7:40   ` [linux-sunxi] " Chen-Yu Tsai
  2017-10-19  7:42 ` [linux-sunxi] [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Chen-Yu Tsai
  5 siblings, 1 reply; 8+ messages in thread
From: Icenowy Zheng @ 2017-10-18 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

Banana Pi M2 Berry has an on-board USB Hub that provides 4 USB Type-A
ports, and it's connected to the USB1 port of the SoC.

Enable it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index fe16fc0eb518..45c17c8c5915 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -87,6 +87,10 @@
 	};
 };
 
+&ehci1 {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -98,6 +102,10 @@
 	};
 };
 
+&ohci1 {
+	status = "okay";
+};
+
 #include "axp22x.dtsi"
 
 &reg_aldo3 {
@@ -171,3 +179,8 @@
 	pinctrl-0 = <&uart0_pb_pins>;
 	status = "okay";
 };
+
+&usbphy {
+	usb1_vbus-supply = <&reg_vcc5v0>;
+	status = "okay";
+};
-- 
2.13.6

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

* [linux-sunxi] [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry
  2017-10-18 13:06 ` [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry Icenowy Zheng
@ 2017-10-19  7:40   ` Chen-Yu Tsai
  0 siblings, 0 replies; 8+ messages in thread
From: Chen-Yu Tsai @ 2017-10-19  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Oct 18, 2017 at 9:06 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> Banana Pi M2 Berry has an on-board USB Hub that provides 4 USB Type-A
> ports, and it's connected to the USB1 port of the SoC.
>
> Enable it.

What is the USB hub chip's model? If it's a USB 2.0 hub, then you
don't need to enable the OHCI.

ChenYu

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

* [linux-sunxi] [PATCH v2 0/5] Allwinner R40 USB host support (DT part)
  2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
                   ` (4 preceding siblings ...)
  2017-10-18 13:06 ` [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry Icenowy Zheng
@ 2017-10-19  7:42 ` Chen-Yu Tsai
  5 siblings, 0 replies; 8+ messages in thread
From: Chen-Yu Tsai @ 2017-10-19  7:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 18, 2017 at 9:06 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> This patchset adds support for the USB host ports on Allwiner R40, and
> enable them on Banana Pi M2 Ultra and Berry boards.
>
> The first patch adds USB PHY and EHCI/OHCI nodes to the R40 DTSI.
>
> The second and third patch adds 5V regulator for the two boards, and
> the fourth and fifth patch finally adds USB host ports support.
>
> Icenowy Zheng (5):
>   ARM: sun8i: r40: add USB host port nodes for R40
>   ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra
>   ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry
>   ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra

For the four patches,

Acked-by: Chen-Yu Tsai <wens@csie.org>

>   ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry

See my comments on OHCI and USB hub for the last patch.

ChenYu

>
>  arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 31 ++++++++++
>  arch/arm/boot/dts/sun8i-r40.dtsi                  | 72 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 22 +++++++
>  3 files changed, 125 insertions(+)
>
> --
> 2.13.6
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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

end of thread, other threads:[~2017-10-19  7:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 13:06 [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Icenowy Zheng
2017-10-18 13:06 ` [PATCH v2 1/5] ARM: sun8i: r40: add USB host port nodes for R40 Icenowy Zheng
2017-10-18 13:06 ` [PATCH v2 2/5] ARM: sun8i: r40: add 5V regulator for Banana Pi M2 Ultra Icenowy Zheng
2017-10-18 13:06 ` [PATCH v2 3/5] ARM: sun8i: v40: add 5V regulator for Banana Pi M2 Berry Icenowy Zheng
2017-10-18 13:06 ` [PATCH v2 4/5] ARM: sun8i: r40: enable USB host for Banana Pi M2 Ultra Icenowy Zheng
2017-10-18 13:06 ` [PATCH v2 5/5] ARM: sun8i: v40: enable USB host ports for Banana Pi M2 Berry Icenowy Zheng
2017-10-19  7:40   ` [linux-sunxi] " Chen-Yu Tsai
2017-10-19  7:42 ` [linux-sunxi] [PATCH v2 0/5] Allwinner R40 USB host support (DT part) Chen-Yu Tsai

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).