From: Zhuang Jin Can <jin.can.zhuang@intel.com>
To: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
linux-kernel@vger.kernel.org,
David Cohen <david.a.cohen@linux.intel.com>
Subject: Re: [PATCH] usb: dwc3: gadget: giveback request if start transfer fail
Date: Sat, 3 May 2014 00:05:41 -0400 [thread overview]
Message-ID: <20140503040541.GC19925@intel.com> (raw)
In-Reply-To: <20140501151328.GB6355@saruman.home>
Hi,
On Thu, May 01, 2014 at 10:13:28AM -0500, Felipe Balbi wrote:
> On Thu, May 01, 2014 at 04:44:52PM -0400, Zhuang Jin Can wrote:
> > On Wed, Apr 30, 2014 at 02:58:29PM -0500, Felipe Balbi wrote:
> > > On Thu, May 01, 2014 at 02:36:08AM -0400, Zhuang Jin Can wrote:
> > > > At least we should giveback the current request to the
> > > > gadget. Otherwise, the gadget will be stuck without knowing
> > > > anything.
> > > >
> > > > It was oberved that the failure can happen if the request is
> > > > queued when the run/stop bit of controller is not set.
> > >
> > > why is your gadget queueing any requests before calling ->udc_start() ?
> > >
> > > A better question, what modification have you done to udc-core.c which
> > > broke this ? udc-core *always* calls ->udc_start() by the time you load
> > > a gadget driver so this case will *never* happen. Whatever modification
> > > you did, broke this assumption and I will *not* accept this patch
> > > because the bug is elsewhere and *not* in mainline kernel.
> > >
> > It's found in Android using kernel 3.10.20. Android has its own
> > usb_composite_driver usb/gadget/android.c (not in mainline), and it
>
> so you found something on an old kernel using an out-of-tree gadget
> driver.
>
> > allows userspace to disconnect the pullup (i.e clear run/stop bit in dwc3)
> > and remove the gadget functions like adb, mtp and then add new functions
> > like rndis, acm. The problem is when you disconnect the pullup, a gadget
> > maybe in the middle of queuing a request, and result in the "start
> > transfer cmd failure". I think this is also a common issue for other
>
> Android gadget needs to learn how to cope with that.
>
Agree.
> > usb_composite_drivers too. Normally, if one of the gadget deactivate its
> > own function, the pullup will be disconnected, other gadgets won't get
> > notified until their requests are failed. So it makes dwc3 more robust
> > to deal with these situations.
>
> Right, but Android gadget can run on top of several other UDCs and you
> want to have a single one of them cope with android's bug ?
>
> You'd be better off getting google to accept a bugfix to the android
> gadget, since that's where the problem lies.
>
I agree. I'll try to push the fix to google.
It's really hard to fix the race condition (for me), as any gadget or
/sys/class/udc/soft_connect can just disconnect the pullup anytime they
want. The only thing I can do is giving back the request to the
gadget if the condition happens.
Jincan
next prev parent reply other threads:[~2014-05-02 16:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 6:36 [PATCH] usb: dwc3: gadget: giveback request if start transfer fail Zhuang Jin Can
2014-04-30 19:58 ` Felipe Balbi
2014-04-30 19:58 ` Felipe Balbi
2014-05-01 20:44 ` Zhuang Jin Can
2014-05-01 15:13 ` Felipe Balbi
2014-05-01 15:13 ` Felipe Balbi
2014-05-03 4:05 ` Zhuang Jin Can [this message]
2014-05-02 16:10 ` Felipe Balbi
2014-05-02 16:10 ` Felipe Balbi
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=20140503040541.GC19925@intel.com \
--to=jin.can.zhuang@intel.com \
--cc=balbi@ti.com \
--cc=david.a.cohen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.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.