linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: <balbi@kernel.org>, <tony@atomide.com>
Cc: <peter.chen@freescale.com>, <vivek.gautam@codeaurora.org>,
	<linux-usb@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [PATCH 0/8] usb: dwc3: add dual-role support
Date: Mon, 23 Jan 2017 13:19:33 +0200	[thread overview]
Message-ID: <1485170381-32110-1-git-send-email-rogerq@ti.com> (raw)

Hi,

We rely on the OTG controller block to provide us with
VBUS and ID line status via an interrupt.

This is then used to switch the controller between host, peripheral
and idle roles based on the following table.

    ID  VBUS    dual-role state
    --  ----    ---------------
    0   x       A_HOST - Host controller active
    1   0       B_IDLE - Both Host and Gadget controllers inactive
    1   1       B_PERIPHERAL - Gadget controller active

Couple of things to clarify:
- There is a small window where we can potentially miss an
event related to OTG. I've added a comment in the code where this
could happen. How can we prevent this? Is it better to just leave
the OTG events unmasked (but keep otg_irq on ARM GIC disabled)
so that any new events can be captured by the OTG event register
and interrupt re-triggered if it has not been serviced by the
previous interrupt.
- I'm running the entire dual-role state change logic inside
the threaded interrupt handler with dwc->lock (spinlock) held
but IRQs enabled. OTG events are very rare i.e. manual intervention
so I don't see this as a problem. Just wanted to double check.
- Some SoC's (e.g. Qualcomm MSM) do not have the OTG controller block
but do have both host and peripheral controllers and so can operate
in dual role mode. Current series does not address this case.
We can get dual-role to work with such SoCs if core.c can get
information about ID and VBUS somehow (private interface
from parent or directly read extcon?).

cheers,
-roger

Roger Quadros (8):
  usb: otg-fsm: Prevent build warning "VDBG" redefined
  usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox()
  usb: dwc3: use BIT() macro where possible
  usb: dwc3: core.h: add some register definitions
  usb: dwc3: add dual-role support
  ARM: dts: dra7x-evm: Enable dual-role mode for USB1
  ARM: dts: am43xx: Enable dual-role mode for USB1
  ARM: dts: am57xx-idk: Enable dual-role mode for USB2

 arch/arm/boot/dts/am437x-gp-evm.dts      |   2 +-
 arch/arm/boot/dts/am437x-sk-evm.dts      |   2 +-
 arch/arm/boot/dts/am43x-epos-evm.dts     |   2 +-
 arch/arm/boot/dts/am57xx-idk-common.dtsi |   2 +-
 arch/arm/boot/dts/dra7-evm.dts           |   2 +-
 arch/arm/boot/dts/dra72-evm-common.dtsi  |   2 +-
 drivers/usb/common/usb-otg-fsm.c         |   7 +
 drivers/usb/dwc3/core.c                  | 583 ++++++++++++++++++++++++++++++-
 drivers/usb/dwc3/core.h                  | 312 ++++++++++++-----
 drivers/usb/dwc3/dwc3-omap.c             |  49 +--
 drivers/usb/dwc3/gadget.c                |  18 +-
 drivers/usb/dwc3/gadget.h                |  20 +-
 drivers/usb/phy/phy-fsl-usb.c            |   7 +
 include/linux/usb/otg-fsm.h              |  15 -
 14 files changed, 848 insertions(+), 175 deletions(-)

-- 
2.7.4

             reply	other threads:[~2017-01-23 11:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170123112122epcas4p3af3d2f3434d02967d7c662a9ab9f3e31@epcas4p3.samsung.com>
2017-01-23 11:19 ` Roger Quadros [this message]
2017-01-23 11:19   ` [PATCH 1/8] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros
2017-01-23 11:19   ` [PATCH 2/8] usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox() Roger Quadros
2017-01-23 11:19   ` [PATCH 3/8] usb: dwc3: use BIT() macro where possible Roger Quadros
2017-01-23 11:19   ` [PATCH 4/8] usb: dwc3: core.h: add some register definitions Roger Quadros
2017-01-23 11:19   ` [PATCH 5/8] usb: dwc3: add dual-role support Roger Quadros
2017-01-23 11:19   ` [PATCH 6/8] ARM: dts: dra7x-evm: Enable dual-role mode for USB1 Roger Quadros
2017-01-26 15:56     ` Tony Lindgren
2017-01-26 16:33       ` Roger Quadros
2017-01-23 11:19   ` [PATCH 7/8] ARM: dts: am43xx: " Roger Quadros
2017-01-23 11:19   ` [PATCH 8/8] ARM: dts: am57xx-idk: Enable dual-role mode for USB2 Roger Quadros
2017-01-23 11:31   ` [PATCH 0/8] usb: dwc3: add dual-role support Chanwoo Choi
2017-02-09  6:42   ` Vivek Gautam
2017-02-09  7:49     ` Roger Quadros
2017-02-09 11:38       ` Vivek Gautam

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=1485170381-32110-1-git-send-email-rogerq@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@freescale.com \
    --cc=tony@atomide.com \
    --cc=vivek.gautam@codeaurora.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).