devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Siarhei Siamashka <siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Zoltan HERPAI <wigyori-1V5s5g7wVVk@public.gmane.org>
Subject: [PATCH 2/3] ARM: dts: sun4i: Enable USB DRC on pcDuino1/2
Date: Sun,  4 Oct 2015 21:58:47 +0300	[thread overview]
Message-ID: <1443985128-23137-3-git-send-email-siarhei.siamashka@gmail.com> (raw)
In-Reply-To: <1443985128-23137-1-git-send-email-siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Enable the otg/drc usb controller on the pcDuino1/2 board. Note
that the pcDuino2 FEX file from the vendor contains the following
information:

    [usbc0]
    usb_used = 1
    usb_port_type = 0
    usb_detect_type = 1
    usb_id_gpio = port:PH04<0><1><default><default>
    usb_det_vbus_gpio = port:PH05<0><0><default><default>
    usb_drv_vbus_gpio = port:PD02<1><0><default><0>
    usb_host_init_state = 0

The ID pin is indeed PH4. The PD2 pin can be used to switch power
on/off for the USB Type A receptacle, but it has nothing to do with
the MicroUSB OTG receptacle. The VBUS pin of the MicroUSB receptacle
is always connected to 5V according to the schematics and confirmed
by doing some tests with the device. The PH5 pin is just one of the
pins on the J8 expansion header and has nothing to do with USB OTG.
There is also the PB9 pin labelled as USB0-DRV on the schematics.
This PB9 pin is pulled up and connected to the N_VBUSEN pin of AXP209
PMIC, while the VBUS pin of AXP209 only has a capacitor between it
and the ground (this pin is not used for anything else).

To sum it up. Only the ID pin (PH4) works as expected. And 5V voltage
is always served to the MicroUSB OTG receptacle no matter what is the
state of the PB9/PD2 pins.

This patch has been tested to work fine in a host role with a USB
keyboard connected via an OTG cable. It also works fine in a device
role (cdc_ether) with a regular Micro-B cable connected to a desktop
PC.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/boot/dts/sun4i-a10-pcduino.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index fdc074c..c9b9330 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -164,6 +164,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	led_pins_pcduino: led_pins@0 {
 		allwinner,pins = "PH15", "PH16";
@@ -178,6 +182,13 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin@0 {
+		allwinner,pins = "PH4";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
 };
 
 &uart0 {
@@ -186,6 +197,14 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>;
+	usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
 	status = "okay";
 };
-- 
2.4.9

  parent reply	other threads:[~2015-10-04 18:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04 18:58 [PATCH 0/3] ARM: dts: sun4i: USB DRC and voltage-scaling for pcDuino1/2 Siarhei Siamashka
     [not found] ` <1443985128-23137-1-git-send-email-siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-04 18:58   ` [PATCH 1/3] ARM: dts: sun4i: Allow to use the PH6 pin for GPIO on pcDuino1/2 Siarhei Siamashka
     [not found]     ` <1443985128-23137-2-git-send-email-siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-05  1:55       ` Chen-Yu Tsai
     [not found]         ` <CAGb2v65n6ymon+sEASa726sam0KLOvMPbxTxCqvV4j0ust2PCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-05  5:39           ` Siarhei Siamashka
2015-10-05  5:58             ` Siarhei Siamashka
2015-10-07  5:11               ` Siarhei Siamashka
2015-10-05 12:49             ` Maxime Ripard
2015-10-07  4:27               ` Siarhei Siamashka
2015-10-04 18:58   ` Siarhei Siamashka [this message]
2015-10-04 18:58   ` [PATCH 3/3] ARM: dts: sun4i: Add AXP209 PMU regulators for pcDuino1/2 Siarhei Siamashka
     [not found]     ` <1443985128-23137-4-git-send-email-siarhei.siamashka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-05 12:56       ` Maxime Ripard
2015-10-05 12:38   ` [PATCH 0/3] ARM: dts: sun4i: USB DRC and voltage-scaling " Maxime Ripard
2015-10-07  4:06     ` Siarhei Siamashka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443985128-23137-3-git-send-email-siarhei.siamashka@gmail.com \
    --to=siarhei.siamashka-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=wigyori-1V5s5g7wVVk@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).