devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board
@ 2017-12-01 22:49 Krzysztof Adamski
       [not found] ` <20171201224942.GA12473-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Adamski @ 2017-12-01 22:49 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Maxime Ripard,
	Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel

Similarly to Orange Pi Zero, NanoPi Neo board has an USB OTG port with
an ID pin but with unpowered VBUS. This patch enables this port in
forced peripheral mode.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
---
 arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
index 78f6c24952dd..14c3f137dbd3 100644
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
@@ -53,3 +53,20 @@
 	allwinner,leds-active-low;
 	status = "okay";
 };
+
+&usb_otg {
+	status = "okay";
+	dr_mode = "peripheral";
+};
+
+&usbphy {
+	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+};
+
+&ohci0 {
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
-- 
2.13.6

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

* Re: [PATCH] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board
       [not found] ` <20171201224942.GA12473-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
@ 2017-12-05  9:07   ` Maxime Ripard
       [not found]     ` <20171205090706.et5a7dizkhn6auje-ZC1Zs529Oq4@public.gmane.org>
  2017-12-05 22:10     ` [PATCH] " Krzysztof Adamski
  0 siblings, 2 replies; 5+ messages in thread
From: Maxime Ripard @ 2017-12-05  9:07 UTC (permalink / raw)
  To: Krzysztof Adamski
  Cc: Rob Herring, Mark Rutland, Russell King, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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

Hi,

On Fri, Dec 01, 2017 at 11:49:42PM +0100, Krzysztof Adamski wrote:
> Similarly to Orange Pi Zero, NanoPi Neo board has an USB OTG port with
> an ID pin but with unpowered VBUS. This patch enables this port in
> forced peripheral mode.
> 
> Signed-off-by: Krzysztof Adamski <k@japko.eu>
> ---
> arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
> index 78f6c24952dd..14c3f137dbd3 100644
> --- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
> @@ -53,3 +53,20 @@
> 	allwinner,leds-active-low;
> 	status = "okay";
> };
> +
> +&usb_otg {
> +	status = "okay";
> +	dr_mode = "peripheral";
> +};
> +
> +&usbphy {
> +	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
> +};
> +
> +&ohci0 {
> +	status = "okay";
> +};
> +
> +&ehci0 {
> +	status = "okay";
> +};

Please sort the nodes in alphabetical order.

Also, does it make sense to add the OHCI and EHCI controller for a
peripheral-only device?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [PATCH v2] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board
       [not found]     ` <20171205090706.et5a7dizkhn6auje-ZC1Zs529Oq4@public.gmane.org>
@ 2017-12-05 22:03       ` Krzysztof Adamski
       [not found]         ` <20171205220358.GA28161-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Adamski @ 2017-12-05 22:03 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Mark Rutland,
	Russell King

Similarly to Orange Pi Zero, NanoPi Neo board has an USB OTG port with
an ID pin but with unpowered VBUS. This patch enables this port in
forced peripheral mode.

ohci/ehci nodes are still enabled since the host mode may work if
external power source is used. In that case, the mode can be switched
for example via sysfs. The same strategy is used for Orange Pi Zero
board DTS.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
---

Changes since version 1:
- nodes sorted alphabetically
- added explanation why enabling ohci/ehci still makes sense

 arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
index 78f6c24952dd..9f33f6fae595 100644
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
@@ -47,9 +47,26 @@
 	compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 &emac {
 	phy-handle = <&int_mii_phy>;
 	phy-mode = "mii";
 	allwinner,leds-active-low;
 	status = "okay";
 };
+
+&ohci0 {
+	status = "okay";
+};
+
+&usb_otg {
+	status = "okay";
+	dr_mode = "peripheral";
+};
+
+&usbphy {
+	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+};
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board
  2017-12-05  9:07   ` Maxime Ripard
       [not found]     ` <20171205090706.et5a7dizkhn6auje-ZC1Zs529Oq4@public.gmane.org>
@ 2017-12-05 22:10     ` Krzysztof Adamski
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Adamski @ 2017-12-05 22:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Rob Herring, Mark Rutland, Russell King, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-kernel

On Tue, Dec 05, 2017 at 10:07:06AM +0100, Maxime Ripard wrote:
>> diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
>> index 78f6c24952dd..14c3f137dbd3 100644
>> --- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
>> +++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
>> @@ -53,3 +53,20 @@
>> 	allwinner,leds-active-low;
>> 	status = "okay";
>> };
>> +
>> +&usb_otg {
>> +	status = "okay";
>> +	dr_mode = "peripheral";
>> +};
>> +
>> +&usbphy {
>> +	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
>> +};
>> +
>> +&ohci0 {
>> +	status = "okay";
>> +};
>> +
>> +&ehci0 {
>> +	status = "okay";
>> +};
>
>Please sort the nodes in alphabetical order.

Will do in v2 sent in separate e-mail.

>Also, does it make sense to add the OHCI and EHCI controller for a
>peripheral-only device?

It does. The reasoning is the same as for the OrangePi Zero board in the
patch by Icenowy Zheng (72897fa31fcf6222a11c6ebb0bcca25628bb1f7c) - the
host mode on this board should work if you have external power source.
In this case you can switch the mode via sysfs. I wanted to be
consistent with the approach taken for the OrangePi Zero board. I added
this reasoning to the commit message of v2.

Best regards,
Krzysztof Adamski

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

* Re: [PATCH v2] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board
       [not found]         ` <20171205220358.GA28161-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
@ 2017-12-07  9:03           ` Maxime Ripard
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2017-12-07  9:03 UTC (permalink / raw)
  To: Krzysztof Adamski
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Mark Rutland,
	Russell King

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

On Tue, Dec 05, 2017 at 11:03:58PM +0100, Krzysztof Adamski wrote:
> Similarly to Orange Pi Zero, NanoPi Neo board has an USB OTG port with
> an ID pin but with unpowered VBUS. This patch enables this port in
> forced peripheral mode.
> 
> ohci/ehci nodes are still enabled since the host mode may work if
> external power source is used. In that case, the mode can be switched
> for example via sysfs. The same strategy is used for Orange Pi Zero
> board DTS.
> 
> Signed-off-by: Krzysztof Adamski <k@japko.eu>

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-12-07  9:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 22:49 [PATCH] ARM: dts: sun8i: h3: enable USB OTG for NanoPi Neo board Krzysztof Adamski
     [not found] ` <20171201224942.GA12473-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
2017-12-05  9:07   ` Maxime Ripard
     [not found]     ` <20171205090706.et5a7dizkhn6auje-ZC1Zs529Oq4@public.gmane.org>
2017-12-05 22:03       ` [PATCH v2] " Krzysztof Adamski
     [not found]         ` <20171205220358.GA28161-JrLRIG1mnG582hYKe6nXyg@public.gmane.org>
2017-12-07  9:03           ` Maxime Ripard
2017-12-05 22:10     ` [PATCH] " Krzysztof Adamski

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