linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: MUSB dual-role on AM335x behaving weirdly
Date: Thu, 22 Jan 2015 12:01:13 +0100	[thread overview]
Message-ID: <20150122110113.GA17866@pengutronix.de> (raw)
In-Reply-To: <20150122104330.GN4367@lukather>

Hi,

On Thu, Jan 22, 2015 at 11:43:30AM +0100, Maxime Ripard wrote:
> Hi Yegor,
> 
> On Thu, Jan 22, 2015 at 08:37:45AM +0100, Yegor Yefremov wrote:
> > On 21.01.2015 19:53, Bin Liu wrote:
> > > Hi,
> > > 
> > > On Wed, Jan 21, 2015 at 10:06 AM, Maxime Ripard
> > > <maxime.ripard@free-electrons.com> wrote:
> > >> Hi Felipe,
> > >>
> > >> I'm currently working on a custom AM335x-based board, that has a OTG
> > >> connector wired to one of the musb controlers, and Linux 3.17
> > >>
> > >> This OTG connector seems to behave in a weird way when it comes to
> > >> switching from one role to another:
> > >>
> > >>   - The host mode works with CONFIG_USB_MUSB_DUAL_ROLE set, only if
> > >>     the dr_mode is set to host in the DT, and only if we plug the USB
> > >>     device after the kernel has booted. Otherwise, even though the
> > >>     controller seems to be set up as host in the kernel logs, it
> > >>     doesn't work. When DR-mode is set to otg, DRVVBUS is not high
> > >>     which surely doesn't help, but there might be some other issues.
> > >>
> > >>   - The gadget mode works with CONFIG_USB_MUSB_DUAL_ROLE, if dr_mode
> > >>     is set to otg and not host (obviously), and only if we plug the
> > >>     USB cable after the kernel has booted.
> > >>
> > >>   - The gadget mode works with CONFIG_USB_MUSB_GADGET, and with
> > >>     dr_mode set to otg, even if we cold plug the device.
> > >>
> > >>   - As you might expect from the two first items, the runtime
> > >>     switching from gadget to host when CONFIG_USB_MUSB_DUAL_ROLE is
> > >>     set and dr_mode is set in otg doesn't work either.
> > >>
> > >> It looks like it's only waiting for an interrupt to occur to read the
> > >> ID pin state, without reading its initial value, which would explain
> > >> why both the host and gadget enumerate only when a device/cable is
> > >> hotplugged, and that there's some configuration bits that differ
> > >> whenever dr_mode changes, but I couldn't really see anything standing
> > >> out in the driver nor the datasheet.
> > >>
> > >> Have you already experienced something alike with that driver?
> > > 
> > > I don't use vanilla mainline kernel very often, but I don't have such
> > > hotplug issues with TI 3.12/14 kernels [1]. I only use
> > > CONFIG_USB_MUSB_DUAL_ROLE though.
> > > 
> > > [1] git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git, branch
> > > remote/origin/linux-3.14.y
> > 
> > I have the same experience with 3.15. The switching is working when
> > CONFIG_USB_MUSB_DUAL_ROLE is set and dr_mode = "otg". But since 3.16
> > it seems to be broken. Still had no time to bisect this.
> 
> I just gave 3.15 a quick try, and it looks like it can now detect when
> the device is acting as a gadget, but the host mode is not working at
> all.
> 
> That's a good lead though, I'll dig more into the older versions and
> see if some are working better than others.

This issue may be related to the fact that the musb controller does not
have an ID pin interrupt. Last year I sent a RFC for a soft detection in
OTG mode. It has a poll loop which toggles the SESSION bit of the
controller to detect devices as host and drops back to device otherwise.
This is far away from a good solution.

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204519.html

Best Regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150122/0a823516/attachment-0001.sig>

  reply	other threads:[~2015-01-22 11:01 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 16:06 MUSB dual-role on AM335x behaving weirdly Maxime Ripard
2015-01-21 18:53 ` Bin Liu
2015-01-22  7:37   ` Yegor Yefremov
2015-01-22 10:43     ` Maxime Ripard
2015-01-22 11:01       ` Markus Pargmann [this message]
2015-01-22 14:00         ` Maxime Ripard
2015-01-22 14:52           ` Bin Liu
2015-02-05 13:21     ` Maxime Ripard
2015-02-24 10:39       ` Maxime Ripard
2015-02-24 14:54         ` Felipe Balbi
2015-02-24 16:50           ` Maxime Ripard
2015-02-24 17:33             ` Felipe Balbi
2015-02-25 11:11               ` Maxime Ripard
2015-02-25 12:11                 ` Yegor Yefremov
2015-05-14 17:07                   ` Felipe Balbi
2015-05-14 17:40                     ` Felipe Balbi
2015-05-14 17:49                       ` Felipe Balbi
2015-05-14 19:04                         ` Felipe Balbi
2015-05-14 19:19                           ` Bin Liu
2015-05-14 19:21                             ` Felipe Balbi
2015-05-14 19:29                               ` Bin Liu
2015-05-14 19:29                                 ` Felipe Balbi
2015-05-14 19:49                                   ` Felipe Balbi
2015-05-14 20:03                                     ` Bin Liu
2015-05-14 20:10                                       ` Felipe Balbi
2015-05-14 21:04                                   ` Bin Liu
2015-05-14 21:16                                     ` Bin Liu
2015-05-14 21:26                                       ` Alexandre Belloni
2015-05-14 21:36                                         ` Bin Liu
2015-05-26 14:51                                           ` Felipe Balbi
2015-05-27  9:42                                             ` Alexandre Belloni
2015-07-02  7:16                                               ` Gregory CLEMENT
2015-07-02 17:05                                                 ` Bin Liu
2015-08-04 13:08                                                   ` Gregory CLEMENT
2015-08-04 14:23                                                     ` Gregory CLEMENT
2015-08-04 19:32                                                       ` Felipe Balbi
2015-08-18 12:36                                                         ` Gregory CLEMENT
2015-08-18 14:13                                                           ` Felipe Balbi
2015-08-20 16:35                                                             ` Gregory CLEMENT
2015-08-20 16:46                                                               ` Felipe Balbi
2015-08-21 12:19                                                                 ` Gregory CLEMENT
2015-04-14 15:46       ` 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=20150122110113.GA17866@pengutronix.de \
    --to=mpa@pengutronix.de \
    --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 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).