All of lore.kernel.org
 help / color / mirror / Atom feed
From: b-liu@ti.com (Bin Liu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 0/7] musb: sunxi: Add support for run-time changing dr-mode through sysfs
Date: Fri, 19 Aug 2016 16:25:40 -0500	[thread overview]
Message-ID: <20160819212540.GB1853@uda0271908> (raw)
In-Reply-To: <1471288892-21702-1-git-send-email-hdegoede@redhat.com>

Hi,

On Mon, Aug 15, 2016 at 09:21:25PM +0200, Hans de Goede wrote:
> Hi All,
> 
> Here is a patch series which implements run-time changing the dr-mode
> of sunxi musb controllers through the (already existing) musb "mode"
> sysfs attribute.
> 
> This is useful on boards where there is no id pin, e.g. some tv-boxes
> use the musb controller to get an extra usb A port without needing
> a hub chip. Except for the missing id pin when using a usb A<->A cable
> these ports can do peripheral mode just fine. This series makes it
> possible to do e.g. this by doing echo "peripheral" > mode before
> plugging in the usb A<->A cable.

Well, this is an illegal usecase. A-A cable is invalid by USB Spec.
With type-A receptacle the controller should be in host-only mode,
switching to peripheral mode should not be allowed.

> 
> This series has both sun4i-usb-phy driver and sunxi-musb-glue changes,
> both are necessary for the run-time changing to work, but they can be
> merged independently without breaking anything.
> 
> Changed in v2:
> 
> After sleeping on it a night I realized that always passing port_mode =
> DUAL_ROLE to the musb-core was wrong. There is a distintion between
> the id-pin not working properly which we can work around with software
> mode switching (and we want to register both the host and udc driver
> in this case) vs cases where we really only want to register a host
> (wifi module connected to musb soldered onto the PCB).
> 
> So v2 of this series drops the
> "musb: sunxi: Always register both host and udc when build with dual-role support"
> patch.
> 
> Instead systems which are dual-role capable, but lack an id-pin should use
> dr_mode = "otg" in the dts file. There is one problem with this, some
> systems are dual-role capable but use a female USB-A connector connected
> to the musb controller. These should come up in host mode by default,

This is not a problem. With a type-A connector, the dual-role controller
should work in host-only mode.

Role switching should only be allowed if an AB connector is used.

Using the sysfs entry to switch roles for generic purpose is really a
bad idea, it opens up ton of problems.

For systems which lack of id-pin should use a discrete circuit (for
example GPIO) to detect the id pin in the AB receptacle, then the USB
driver will handle the role switching transparently.

> rather then peripheral mode which is the default for systems which lack an
> id-pin. This patch set introduces:
> 
> "phy-sun4i-usb: Add "allwinner,usb0-usb-a-connector" dt property"
> 
> Which allows specifying the use of a female USB-A connector for the
> musb controller in the phy dt node, the presence of this dt property
> changes the default to host mode.

This is unnecessary, if using a type-A connector, dr_mode should be
"host" in DT.

> 
> Please review (and if no issues are found merge).
> 
> Thanks & Regards,
> 
> Hans

Regards,
-Bin.

  parent reply	other threads:[~2016-08-19 21:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 19:21 [PATCH v2 0/7] musb: sunxi: Add support for run-time changing dr-mode through sysfs Hans de Goede
2016-08-15 19:21 ` [PATCH v2 1/7] phy-sun4i-usb: Use bool where appropriate Hans de Goede
2016-08-15 19:21 ` [PATCH v2 2/7] phy-sun4i-usb: Refactor forced session ending Hans de Goede
2016-08-15 19:21 ` [PATCH v2 3/7] phy-sun4i-usb: Simplify missing dr_mode handling Hans de Goede
2016-08-15 19:21 ` [PATCH v2 4/7] phy-sun4i-usb: Add support for phy_set_mode Hans de Goede
2016-08-16 13:48   ` Sergei Shtylyov
2016-08-16 20:01     ` Hans de Goede
2016-08-18  7:40       ` Felipe Balbi
2016-08-18  9:05         ` Hans de Goede
2016-08-18 10:17           ` Felipe Balbi
2016-08-19 13:27             ` Kishon Vijay Abraham I
2016-08-15 19:21 ` [PATCH v2 5/7] phy-sun4i-usb: Warn when external vbus is detected Hans de Goede
2016-08-15 19:21 ` [PATCH v2 6/7] phy-sun4i-usb: Add "allwinner, usb0-usb-a-connector" dt property Hans de Goede
2016-08-19 21:33   ` [PATCH v2 6/7] phy-sun4i-usb: Add "allwinner,usb0-usb-a-connector" " Bin Liu
2016-08-15 19:21 ` [PATCH v2 7/7] musb: sunxi: Add support for platform_set_mode Hans de Goede
2016-08-19 21:30   ` Bin Liu
2016-08-21 10:10     ` Hans de Goede
2016-08-22 14:11       ` Bin Liu
2016-08-22 15:08         ` Hans de Goede
2016-08-22 15:24           ` Bin Liu
2016-08-22 15:32             ` Hans de Goede
2016-08-22 15:38               ` Bin Liu
2016-08-22 15:55                 ` Hans de Goede
2016-08-22 16:10                   ` Bin Liu
2016-08-25 17:59                     ` Hans de Goede
2016-08-19 21:25 ` Bin Liu [this message]
2016-08-21  9:29   ` [PATCH v2 0/7] musb: sunxi: Add support for run-time changing dr-mode through sysfs Hans de Goede
2016-08-22 14:08     ` Bin Liu
2016-08-22 14:16       ` Bin Liu
2016-08-22 15:50       ` Hans de Goede
2016-08-22 16:03         ` Bin Liu
2016-08-22 19:16   ` Rask Ingemann Lambertsen

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=20160819212540.GB1853@uda0271908 \
    --to=b-liu@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.