linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Cohen <david.a.cohen@linux.intel.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: myungjoo.ham@samsung.com, cw00.choi@samsung.com,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	baolu.lu@linux.intel.com
Subject: Re: [RFC/PATCH] extcon: otg_gpio: add driver for USB OTG port controlled by GPIO(s)
Date: Tue, 23 Dec 2014 12:43:22 -0800	[thread overview]
Message-ID: <20141223204322.GB19996@psi-dev26.jf.intel.com> (raw)
In-Reply-To: <5499CC08.8000606@cogentembedded.com>

On Tue, Dec 23, 2014 at 11:09:44PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/23/2014 10:57 PM, David Cohen wrote:
> 
> >>>Some platforms have an USB OTG port fully (or partially) controlled by
> >>>GPIOs:
> 
> >>>(1) USB ID is connected directly to GPIO
> 
> >>>Optionally:
> >>>(2) VBUS is enabled by a GPIO (when ID is grounded)
> 
> >>    Can't the host driver still control Vbus?
> 
> >I can't a clean way for host driver to control VBUS considering it
> >depends on USB ID.
> 
>    You're using the cable state notifiers, why not control Vbus from there?
> You need some way of passing the GPIO to host driver though... I assume
> you're not using the device tree, and your host controllers live on PCI, so
> the platform data is out of question. You may be right then...

Yes to all questions :)

> 
> >>>(3) Platform has 2 USB controllers connected to same port: one for
> >>>     device and one for host role. D+/- are switched between phys
> >>>     by GPIO.
> 
> >>>As per initial version, this driver has the duty to control whether
> >>>USB-Host cable is plugged in or not:
> >>>  - If yes, OTG port is configured for host role
> >>>  - If no, by standard, the OTG port is configured for device role
> 
> >>>Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> >>>---
> 
> >>>Hi,
> 
> >>>Some Intel Bay Trail boards have an unusual way to handle the USB OTG port:
> >>>  - The USB ID pin is connected directly to GPIO on SoC
> >>>  - When in host role, VBUS is provided by enabling a GPIO
> >>>  - Device and host roles are supported by 2 independent controllers with D+/-
> >>>    pins from port switched between different phys according a GPIO level.
> 
> >>>The ACPI table describes this USB port as a (virtual) device with all the
> >>>necessary GPIOs. This driver implements support to this virtual device as an
> >>>extcon class driver. All drivers that depend on the USB OTG port state (USB phy,
> >>>PMIC, charge detection) will listen to extcon events.
> 
> >>    It's very close to my setup on R-Car R8A7791 based boards. :-)
> >>I have already submitted Maxim MAX3355 OTG chip GPIO-based driver.
> 
> >Hm. I'll look for it. Thanks for pointing.
> 
>    http://marc.info/?l=linux-usb&m=141825413802370
>    In my case, Vbus is not controlled via GPIO though. I would have probably
> used the generic GPIO extcon driver if I didn't have to drive MAX3355's
> SHDN# pin high...

Besides the USB ID, I need to control VBUS and the D+/- switch. We have
a new use case coming soon that may need to add a second switch control.

>    There were also some other patches for this issue, the one probably
> interesting to you is there:
> 
>    http://marc.info/?l=linux-usb&m=141877180912359

This one is interesting, but I'm restricted to ACPI and to the DSDTs already
released.
E.g. http://www.androidauthority.com/trekstor-xintron-lollipop-564364/

Br, David

> 
> >>>Comments are welcome.
> 
> >>>Br, David
> 
> [...]
> 
> >>>+static int __init vuport_init(void)
> >>>+{
> >>>+	return platform_driver_register(&vuport_driver);
> >>>+}
> >>>+subsys_initcall(vuport_init);
> 
> >>    Hm, why?
> 
> >We have drivers that depend on this one during their probe.
> 
>    What about deferred probing? With EPROBE_DEFER we don't need to play the
> initcall games any more AFAIU.
> 
> >Br, David
> 
> WBR, Sergei
> 

  reply	other threads:[~2014-12-23 20:42 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 22:43 [RFC/PATCH] extcon: otg_gpio: add driver for USB OTG port controlled by GPIO(s) David Cohen
2014-12-23  1:25 ` Peter Chen
2014-12-23 19:40   ` David Cohen
2014-12-24  3:08     ` Peter Chen
2014-12-24 22:46       ` David Cohen
2014-12-23 13:10 ` Sergei Shtylyov
2014-12-23 19:57   ` David Cohen
2014-12-23 20:09     ` Sergei Shtylyov
2014-12-23 20:43       ` David Cohen [this message]
2014-12-24  0:29 ` Felipe Balbi
2014-12-24 22:43   ` David Cohen
2014-12-26  4:49     ` Felipe Balbi
2015-02-17 19:18       ` David Cohen
2015-02-17 19:25         ` Felipe Balbi
2015-02-17 19:35           ` David Cohen
2015-02-18 10:17             ` Mika Westerberg
2015-02-18 17:53               ` David Cohen
2015-01-08 19:23 ` Linus Walleij
2015-02-17 19:20   ` David Cohen
2015-02-19 19:59 ` [PATCH v2] " David Cohen
2015-02-19 22:39   ` Paul Bolle
2015-02-20 19:02     ` David Cohen
2015-02-20 19:09       ` Felipe Balbi
2015-02-20 19:18         ` David Cohen
2015-02-20 19:10       ` Paul Bolle
2015-02-20 19:18         ` David Cohen
2015-02-20  6:41   ` Robert Baldyga
2015-02-20  9:53     ` Linus Walleij
2015-02-20 19:17       ` David Cohen
2015-02-20 19:36         ` Felipe Balbi
2015-02-20 19:59           ` David Cohen
2015-02-20 20:00             ` Felipe Balbi
2015-02-20 20:40               ` David Cohen
2015-03-07 20:03                 ` Linus Walleij
2015-02-24 19:18         ` David Cohen
2015-03-07 20:06         ` Linus Walleij
2015-03-09 16:16           ` Felipe Balbi
2015-03-09 19:10             ` David Cohen
2015-03-16 16:46               ` David Cohen
2015-03-16 16:46                 ` David Cohen
2015-03-19  8:18               ` Linus Walleij

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=20141223204322.GB19996@psi-dev26.jf.intel.com \
    --to=david.a.cohen@linux.intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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).