devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH 09/20] ARM: dts: sun4i: Enable USB DRC on the Cubieboard
Date: Thu, 18 Jun 2015 18:16:01 +0200	[thread overview]
Message-ID: <5582EEC1.80505@redhat.com> (raw)
In-Reply-To: <20150618155935.GR11732@lukather>

Hi,

On 18-06-15 17:59, Maxime Ripard wrote:
> Hi Hans,
>
> On Fri, Jun 05, 2015 at 09:02:12PM +0200, Hans de Goede wrote:
>> Enable the otg/drc usb controller on the Cubieboard. Note that the
>> 5V of the otg is directly connected to the general 5V, so we only use
>> the id pin.
>>
>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>>   arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> index 9afb4e0..046a84d 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> @@ -155,6 +155,10 @@
>>   	status = "okay";
>>   };
>>
>> +&otg_sram {
>> +	status = "okay";
>> +};
>> +
>>   &pio {
>>   	led_pins_cubieboard: led_pins@0 {
>>   		allwinner,pins = "PH20", "PH21";
>> @@ -162,6 +166,13 @@
>>   		allwinner,drive = <SUN4I_PINCTRL_20_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>;
>> +	};
>>   };
>>
>>   &reg_ahci_5v {
>> @@ -216,7 +227,15 @@
>>   	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 */
>
> Does that work?

Yes :)

> Your phy driver seem to actively check at probe time for both the ID
> detect and VBUS detect pins to be set in the DT, which is not the case
> here.

My initial version did, later on I added a patch adding special handling
for boards which have Vusb hardwired to the 5V of the board such as the
cubieboard (the schematics show both a current regulator and an optional
0 ohm resistor to short-circuit that, it seems that the boards are
shipped with short-circuiting resistor, at least all mine are (both a10
and a20 variants).

See here for the patch:
https://github.com/jwrdegoede/linux-sunxi/commit/b73922986cab2bad9d54a2a1223583008e155bc4

This is part of the v5 phy-sun4i-usb series I send to Kishon a week ago.

> I don't really get either why VBUS detect has to be set. Can't it work
> just fine if you have a regulator that you can control and the ID pin
> alone ?

Not really, we can work around it as done in the above commit, but it
is not ideal.

Vbus detect going low is used by the musb silicon to determine that the
current session has ended, and without this happening it will not
switch from host to device mode or vice versa no matter what the id pin
does.

Vbus detect is also used to not provide power to the port if external
power is present as doing so is not a good idea.

Last vbus-detect is used to detect that the devices connected to the
port are using too much power.

Regards,

Hans

  reply	other threads:[~2015-06-18 16:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 19:02 [PATCH 00/20] ARM: dts: Add USB and OTG related nodes and enable on various boards Hans de Goede
     [not found] ` <1433530943-12599-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-05 19:02   ` [PATCH 01/20] ARM: dts: sun4i: Add USB Dual Role Controller Hans de Goede
2015-06-05 19:02   ` [PATCH 02/20] ARM: dts: sun5i: " Hans de Goede
2015-06-05 19:02   ` [PATCH 03/20] ARM: dts: sun6i: " Hans de Goede
2015-06-05 19:02   ` [PATCH 04/20] ARM: dts: sun7i: " Hans de Goede
2015-06-05 19:02   ` [PATCH 05/20] ARM: dts: sun8i: Add A23 usb-phy and otg nodes Hans de Goede
2015-06-05 19:02   ` [PATCH 06/20] ARM: dts: sun8i: Add A33 " Hans de Goede
2015-06-05 19:02   ` [PATCH 07/20] ARM: dts: sun8i: Add support for USB controllers on A23/A33 Hans de Goede
2015-06-05 19:02   ` [PATCH 08/20] ARM: dts: sun4i: Enable USB DRC on Chuwi V7 CW0825 Hans de Goede
2015-06-05 19:02   ` [PATCH 09/20] ARM: dts: sun4i: Enable USB DRC on the Cubieboard Hans de Goede
     [not found]     ` <1433530943-12599-10-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-18 15:59       ` Maxime Ripard
2015-06-18 16:16         ` Hans de Goede [this message]
2015-06-05 19:02   ` [PATCH 10/20] ARM: dts: sun5i: Enable USB DRC on UTOO P66 Hans de Goede
2015-06-05 19:02   ` [PATCH 11/20] ARM: dts: sun6i: Enable USB DRC on the Mele A1000G quad Hans de Goede
2015-06-05 19:02   ` [PATCH 12/20] ARM: dts: sun7i: Enable USB DRC on Cubietruck Hans de Goede
2015-06-05 19:02   ` [PATCH 13/20] ARM: dts: sun7i: Enable USB DRC on A20-OLinuxIno-Lime Hans de Goede
2015-06-05 19:02   ` [PATCH 14/20] ARM: dts: sun7i: Enable USB DRC on A20-OLinuxIno-Micro Hans de Goede
2015-06-05 19:02   ` [PATCH 15/20] ARM: dts: sun7i: Enable USB DRC on Bananapi (BROKEN!) Hans de Goede
     [not found]     ` <1433530943-12599-16-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-05 19:15       ` Hans de Goede
2015-06-05 19:02   ` [PATCH 16/20] ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A23 tablets Hans de Goede
2015-06-05 19:02   ` [PATCH 17/20] ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A33 tablet Hans de Goede
2015-06-05 19:02   ` [PATCH 18/20] ARM: dts: sun8i: Enable USB DRC on GA10H-A33 tablets Hans de Goede
2015-06-05 19:02   ` [PATCH 19/20] ARM: dts: sun8i: Enable USB host " Hans de Goede
2015-06-05 19:02   ` [PATCH 20/20] ARM: dts: sun8i: sina33: Enable USB hosts Hans de Goede
2015-06-08 10:03   ` [PATCH 00/20] ARM: dts: Add USB and OTG related nodes and enable on various boards Maxime Ripard
2015-06-08 12:56     ` Michal Suchanek
     [not found]       ` <CAOMqctRDEoPiJ95EVgs_ZRQVt=SzK9NPDJGmq3JTJF1kWscmqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-09 20:18         ` Maxime Ripard
2015-06-10 13:27     ` Hans de Goede
     [not found]       ` <55783B2C.3080207-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-12 13:27         ` Hans de Goede
     [not found]           ` <557ADE40.70200-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-13 13:30             ` Hans de Goede
     [not found]               ` <557C308A.4010104-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-16  9:36                 ` Maxime Ripard
2015-06-16  9:35         ` Maxime Ripard

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=5582EEC1.80505@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@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=wens-jdAy2FN1RRM@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).