public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <hzpeterchen@gmail.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: felipe.balbi@linux.intel.com,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lee Jones <lee.jones@linaro.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux
Date: Mon, 6 Jun 2016 09:25:57 +0800	[thread overview]
Message-ID: <20160606012557.GA16012@shlinux2> (raw)
In-Reply-To: <5753CCFC.2060504@linux.intel.com>

On Sun, Jun 05, 2016 at 02:55:56PM +0800, Lu Baolu wrote:
> Hi Peter,
> 
> On 06/04/2016 10:28 AM, Peter Chen wrote:
> > On Sat, Jun 04, 2016 at 12:06:06AM +0800, Lu Baolu wrote:
> >>> from my point,it is a dual-role switch
> >>> driver too,
> >> No, it's not a dual-role switch driver, but a driver for USB port multiplexing.
> >>
> >> One example of port multiplexing can be found in several Intel SOC and PCH
> >> chips, inside of which, there are two independent USB controllers: host and
> >> device. They might share a single port and this port could be configured to
> >> route the line to one of these two controllers. This patch introduced a generic
> >> framework for port mux drivers. It aids the drivers to handle port mux by
> >> providing interfaces to 1) register/unregister a mux device; 2) lookup the
> >> mux device; and 3) switch the port.
> >>
> > For this case, I can't see it is different with dual-role switch.
> 
> Port mux is part of dual role switch, but not the whole thing.
> 
> Dual role switch includes at least below things:
>  - ID or type-C event detection
>  - port mux
>  - VBUS management
>  - start/stop host/device controllers
> 
> An OTG/Dual-role framework can be used to keep all these
> things run together with an internal state machine. But it's
> not duplicated with a generic framework for port mux and
> the port mux drivers.

You have admitted port mux is one of the ports of dual-role switch,
Then, how they can co-work with each other? If can't, the dual-role
switch framework needs another input events management for switching.

> 
> > Your
> > case is just like Renesas case, which uses two different drivers between
> > peripheral and host[1].
> 
> In my case, the port mux devices are physical devices and they
> can be controlled through GPIO pins or device registers. They
> are independent of both peripheral and host controllers.
> 

Yes, it is the same. GPIO pin or device registers is like ID pin
event.

> 
> >> Port multiplexing isn't equal to USB dual role. There are other cases in today's
> >> systems. In several Intel PCH chips, there equips two USB host controllers: ehci
> >> and xhci. The xhci USB2 ports are multiplexed with ehci. This guarantees all
> >> USB ports work even running an old version of OS which lacks of USB3 support.
> >> In theory, we can create a driver for the port mux and switch the ports between
> >> xhci and ehci, but that's silly, isn't it? Why not always USB3?:-)
> >>
> >> Another case is xHCI debug capability. The xHCI host controller might equip
> >> a unit for system debugging (refer to 7.6 of xHCI spec). The debugging unit is
> >> independent of xhci host controller. But it shares its port with xhci. Software
> >> could switch the port between xhci and the debugging unit through the registers
> >> defined in xHCI spec.
> >>
> > Yes, above two are different with dual role switch. But in your code and
> > Kconfig, it seems this framework is dedicated for dual-role. Eg:
> >
> > +menuconfig USB_PORTMUX
> > +       bool "USB dual role port MUX support"
> > +       help
> > +         Generic USB dual role port mux support.
> 
> Above two cases are examples for port multiplexing, but I don't think we
> need drivers for them. At this moment, this framework is only for dual
> role port mux devices.
> 
> >
> > I think a general dual role port mux is necessary, it can be used to
> > manage different dual-role switch method, eg
> 
> Yes, I agree.
> 
> > - ID pin
> > - External connector through GPIO
> > - SoC register
> > - sysfs
> > - type-C events
> 
> ID pin and type-C events are the *reasons* which trigger the port
> mux switch. Currently, on our platforms, gpio, registers and sysfs
> are methods to control the mux.
> 
> >
> > But this code is better co-work with OTG/Dual-role framework, we'd
> > better have only interface that the user can know which role for the
> > current port.
> 
> OTG/Dual-role framework and portmux framework are not overlapped.
> The sysfs interface shouldn't be overlapped as well. Say, I have a port
> mux device and I have a driver for it. I am able to read the status of my
> port mux device through sysfs. This is not part of OTG/Dual-role as far
> as I can see.
> 

Then how the user wants to switch the role through the mux driver's
sysfs or dual-role switch sysfs?

-- 

Best Regards,
Peter Chen

  parent reply	other threads:[~2016-06-06  1:31 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  1:37 [PATCH v10 0/7] usb: add support for Intel dual role port mux Lu Baolu
2016-06-02  1:37 ` [PATCH v10 1/7] regulator: fixed: add support for ACPI interface Lu Baolu
2016-06-08  4:42   ` Greg Kroah-Hartman
2016-06-08 13:43     ` Mark Brown
2016-06-08 15:46       ` Greg Kroah-Hartman
2016-06-09  2:43     ` Lu Baolu
2016-06-02  1:37 ` [PATCH v10 2/7] usb: mux: add generic code for dual role port mux Lu Baolu
2016-06-03  7:41   ` Peter Chen
2016-06-03  8:16     ` Heikki Krogerus
2016-06-03  9:20       ` Peter Chen
2016-06-03 16:06     ` Lu Baolu
2016-06-04  2:28       ` Peter Chen
2016-06-05  6:55         ` Lu Baolu
2016-06-05  8:33           ` Jun Li
2016-06-05  8:46             ` Lu Baolu
2016-06-06  1:08               ` Jun Li
2016-06-06  2:30                 ` Lu Baolu
2016-06-06  2:05               ` Peter Chen
2016-06-06  2:45                 ` Lu Baolu
2016-06-06  6:48                   ` Peter Chen
2016-06-06  1:25           ` Peter Chen [this message]
2016-06-06  3:04             ` Lu Baolu
2016-06-06  7:02               ` Roger Quadros
2016-06-07  3:03                 ` Jun Li
2016-06-07  6:27                   ` Lu Baolu
2016-06-07  6:34                     ` Jun Li
2016-06-07  9:27                       ` Lu Baolu
2016-06-07 12:49                         ` Roger Quadros
2016-06-07  9:53                   ` Lu Baolu
2016-06-07 12:58                     ` Roger Quadros
2016-06-07 13:04                       ` Felipe Balbi
2016-06-07 14:02                         ` Roger Quadros
2016-06-07 15:05                           ` Felipe Balbi
2016-06-08  3:04                             ` Jun Li
     [not found]                               ` <5757A8CB.90402@linux.intel.com>
2016-06-08  6:20                                 ` Jun Li
2016-06-08  6:25                             ` Peter Chen
2016-06-08  7:58                             ` Roger Quadros
2016-06-06  7:02               ` Peter Chen
2016-06-06  7:35                 ` Lu Baolu
2016-06-02  1:37 ` [PATCH v10 3/7] usb: mux: add driver for Intel gpio controlled " Lu Baolu
2016-06-02  1:37 ` [PATCH v10 4/7] usb: mux: add driver for Intel drcfg " Lu Baolu
2016-06-02  1:37 ` [PATCH v10 5/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver Lu Baolu
2016-06-02  1:37 ` [PATCH v10 6/7] usb: pci-quirks: add Intel USB drcfg mux device Lu Baolu
2016-06-08  4:45   ` Greg Kroah-Hartman
2016-06-08  7:56     ` Lu Baolu
2016-06-08 15:45       ` Greg Kroah-Hartman
2016-06-09  2:39         ` Lu Baolu
2016-06-16  0:27           ` Lu Baolu
2016-06-18  0:58             ` Greg Kroah-Hartman
2016-06-19  9:52               ` Lu Baolu
2016-06-02  1:37 ` [PATCH v10 7/7] MAINTAINERS: add maintainer entry for Intel USB dual role mux drivers Lu Baolu

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=20160606012557.GA16012@shlinux2 \
    --to=hzpeterchen@gmail.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rogerq@ti.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