Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-08 Thread Felipe Balbi
On Sat, Sep 06, 2014 at 12:09:22AM +, Peter Chen wrote: > > > On Fri, Sep 05, 2014 at 08:44:08AM +0800, Peter Chen wrote: > > > On Thu, Sep 04, 2014 at 11:04:38AM -0400, Alan Stern wrote: > > > > On Thu, 4 Sep 2014, Peter Chen wrote: > > > > > > > > > Hi Felipe & Alan, how about using below s

RE: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-05 Thread Peter Chen
> On Fri, Sep 05, 2014 at 08:44:08AM +0800, Peter Chen wrote: > > On Thu, Sep 04, 2014 at 11:04:38AM -0400, Alan Stern wrote: > > > On Thu, 4 Sep 2014, Peter Chen wrote: > > > > > > > Hi Felipe & Alan, how about using below steps for this > > > > reset/vbus/pullup changes? It mainly uses Alan's s

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-05 Thread Felipe Balbi
On Fri, Sep 05, 2014 at 08:44:08AM +0800, Peter Chen wrote: > On Thu, Sep 04, 2014 at 11:04:38AM -0400, Alan Stern wrote: > > On Thu, 4 Sep 2014, Peter Chen wrote: > > > > > Hi Felipe & Alan, how about using below steps for this reset/vbus/pullup > > > changes? It mainly uses Alan's suggestion. >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-04 Thread Peter Chen
On Thu, Sep 04, 2014 at 11:04:38AM -0400, Alan Stern wrote: > On Thu, 4 Sep 2014, Peter Chen wrote: > > > Hi Felipe & Alan, how about using below steps for this reset/vbus/pullup > > changes? It mainly uses Alan's suggestion. > > > > Step 1: > > The initial implementation in the four gadget >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-04 Thread Alan Stern
On Thu, 4 Sep 2014, Peter Chen wrote: > Hi Felipe & Alan, how about using below steps for this reset/vbus/pullup > changes? It mainly uses Alan's suggestion. > > Step 1: > The initial implementation in the four gadget > drivers can be very simple: It calls the disconnect handler. >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-03 Thread Alan Stern
On Thu, 4 Sep 2014, Peter Chen wrote: > > > Alan, this problem seems not to be existed at g_mass_storage, > > > g_mass_storage > > > has not .disconnect API and only fsg_disable will be called when bus reset > > > occurs. > > > > That sounds like a bug. Shouldn't there be a disconnect callback?

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-03 Thread Peter Chen
On Wed, Sep 03, 2014 at 01:53:23PM -0400, Alan Stern wrote: > On Wed, 3 Sep 2014, Peter Chen wrote: > > > > Okay. Let's start by adding the reset field to struct > > > usb_gadget_driver. The initial implementation in the four gadget > > > drivers can be very simple: It calls the disconnect handl

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-03 Thread Peter Chen
On Wed, Sep 03, 2014 at 01:45:32PM -0400, Alan Stern wrote: > On Wed, 3 Sep 2014, Peter Chen wrote: > > > > PS: I also have an old patch that adds a reset callback to > > > g-mass-storage. Peter asked for this around the same time the other > > > work was done. The idea was that disconnect must

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-03 Thread Alan Stern
On Wed, 3 Sep 2014, Peter Chen wrote: > > Okay. Let's start by adding the reset field to struct > > usb_gadget_driver. The initial implementation in the four gadget > > drivers can be very simple: It calls the disconnect handler. (At some > > later time we can add a ->reset callback to struct >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-03 Thread Alan Stern
On Wed, 3 Sep 2014, Peter Chen wrote: > > PS: I also have an old patch that adds a reset callback to > > g-mass-storage. Peter asked for this around the same time the other > > work was done. The idea was that disconnect must flush the buffers to > > the backing storage device, whereas a reset c

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Peter Chen
On Tue, Sep 02, 2014 at 03:25:05PM -0400, Alan Stern wrote: > On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > > You know, more and more it seems like this ought to be handled by the > > > UDC core. There are two conditions for turning on the pullup: Vbus > > > must be active, and the gadget's funct

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Peter Chen
On Tue, Sep 02, 2014 at 12:02:03PM -0400, Alan Stern wrote: > On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > > > I still have some old patch files lying around, adding reset callb

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Alan Stern
On Tue, 2 Sep 2014, Felipe Balbi wrote: > > You know, more and more it seems like this ought to be handled by the > > UDC core. There are two conditions for turning on the pullup: Vbus > > must be active, and the gadget's functions must all be activated. The > > UDC driver knows about the first

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Felipe Balbi
On Tue, Sep 02, 2014 at 02:11:52PM -0400, Alan Stern wrote: > On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > > > alright, but we need to do this in steps to avoid regressions or a > > > > non-bisectable tree. So maybe we add ->reset as an optional method, > > > > implement support for it to all UDC

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Alan Stern
On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > alright, but we need to do this in steps to avoid regressions or a > > > non-bisectable tree. So maybe we add ->reset as an optional method, > > > implement support for it to all UDC drivers, patch all gadget drivers to > > > implement reset, make rese

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Felipe Balbi
Hi, On Tue, Sep 02, 2014 at 01:15:18PM -0400, Alan Stern wrote: > On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > > That needn't be a problem. If Peter updates the four gadget drivers, > > > adding reset callbacks, then we can remove the parts of our patches > > > that invoke the disconnect callba

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Alan Stern
On Tue, 2 Sep 2014, Felipe Balbi wrote: > > That needn't be a problem. If Peter updates the four gadget drivers, > > adding reset callbacks, then we can remove the parts of our patches > > that invoke the disconnect callback if there is no reset callback. In > > other words, we can make reset c

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Felipe Balbi
Hi, On Tue, Sep 02, 2014 at 12:02:03PM -0400, Alan Stern wrote: > On Tue, 2 Sep 2014, Felipe Balbi wrote: > > > On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > > > I still have some old patch files lying around, adding reset

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Alan Stern
On Tue, 2 Sep 2014, Felipe Balbi wrote: > On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > I still have some old patch files lying around, adding reset callback > > > > support to dummy-hcd, net2280, and net2272. Would you like

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Felipe Balbi
On Tue, Sep 02, 2014 at 10:43:37AM -0500, Felipe Balbi wrote: > On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > I still have some old patch files lying around, adding reset callback > > > > support to dummy-hcd, net2280, and net2

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Felipe Balbi
On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > I still have some old patch files lying around, adding reset callback > > > support to dummy-hcd, net2280, and net2272. Would you like me to post > > > them? > > > > Please do :-) let's

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-09-02 Thread Alan Stern
On Fri, 29 Aug 2014, Felipe Balbi wrote: > > I still have some old patch files lying around, adding reset callback > > support to dummy-hcd, net2280, and net2272. Would you like me to post > > them? > > Please do :-) let's get all of that sorted out soon. Patches coming up. These were written

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-31 Thread Peter Chen
On Fri, Aug 29, 2014 at 04:20:20PM -0500, Felipe Balbi wrote: > On Fri, Aug 29, 2014 at 05:08:13PM -0400, Alan Stern wrote: > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > First, change the API so that the disconnect API _does_ call > > > > usb_gadget_disconnect. > > > > > > that's not

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-31 Thread Peter Chen
On Fri, Aug 29, 2014 at 11:14:23AM -0400, Alan Stern wrote: > On Fri, 29 Aug 2014, Peter Chen wrote: > > > Felipe & Alan, thanks for your comments for these patches, I think I may > > need > > to list these issues again to make things clearer. > > > > The purpose of these patchsets are to fix tw

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-29 Thread Felipe Balbi
On Fri, Aug 29, 2014 at 05:08:13PM -0400, Alan Stern wrote: > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > First, change the API so that the disconnect API _does_ call > > > usb_gadget_disconnect. > > > > that's not what the API was intended for, however. If we're going down > > that path, w

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-29 Thread Alan Stern
On Fri, 29 Aug 2014, Felipe Balbi wrote: > > First, change the API so that the disconnect API _does_ call > > usb_gadget_disconnect. > > that's not what the API was intended for, however. If we're going down > that path, we need another of telling the gadget driver to reset all its > buffers and

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-29 Thread Felipe Balbi
On Fri, Aug 29, 2014 at 11:14:23AM -0400, Alan Stern wrote: > On Fri, 29 Aug 2014, Peter Chen wrote: > > > Felipe & Alan, thanks for your comments for these patches, I think I may > > need > > to list these issues again to make things clearer. > > > > The purpose of these patchsets are to fix tw

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-29 Thread Alan Stern
On Fri, 29 Aug 2014, Peter Chen wrote: > Felipe & Alan, thanks for your comments for these patches, I think I may need > to list these issues again to make things clearer. > > The purpose of these patchsets are to fix two issues: > - Some udcs failures at USB-IF certification Back-Voltage test, i

RE: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-29 Thread Alan Stern
On Fri, 29 Aug 2014, Peter Chen wrote: > > On Thu, 28 Aug 2014, Alan Stern wrote: > > > > > Okay, so we need to add a "vbus_is_on" flag to the usb_gadget > > > structure. The gadget driver will set this flag in its connect > > > callback and clear the flag in its disconnect callback. If the UDC

RE: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Peter Chen
> On Thu, 28 Aug 2014, Alan Stern wrote: > > > Okay, so we need to add a "vbus_is_on" flag to the usb_gadget > > structure. The gadget driver will set this flag in its connect > > callback and clear the flag in its disconnect callback. If the UDC > > driver doesn't have a Vbus handler, it wil

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Peter Chen
On Thu, Aug 28, 2014 at 09:56:06AM -0500, Felipe Balbi wrote: > Hi, > > > > > For other three stages (no need to control at bus_reset), we can > > > > control dp > > > > at two gadget driver's API relies on flag pullup_on_vbus. > > > > > > I also can't get what you mean here. > > > > If the UDC

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Alan Stern
On Thu, 28 Aug 2014, Alan Stern wrote: > Okay, so we need to add a "vbus_is_on" flag to the usb_gadget > structure. The gadget driver will set this flag in its connect > callback and clear the flag in its disconnect callback. If the UDC > driver doesn't have a Vbus handler, it will invoke the co

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Alan Stern
On Thu, 28 Aug 2014, Peter Chen wrote: > > DWC3 doesn't really have a pullup bit. It's got a RUN/STOP bit. Sure, it > > controls the pullups but it also kills the internal DMA and quite a bit > > of other internal blocks. > > It is the same with chipidea, it has RUN/STOP bit at usbcmd, and its >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Felipe Balbi
Hi, On Thu, Aug 28, 2014 at 05:08:08PM +0800, Peter Chen wrote: > On Wed, Aug 27, 2014 at 02:37:35PM -0500, Felipe Balbi wrote: > > Hi, > > > > On Tue, Aug 26, 2014 at 03:30:32PM +0800, Peter Chen wrote: > > > On Mon, Aug 25, 2014 at 11:27:47AM -0400, Alan Stern wrote: > > > > On Mon, 25 Aug 2014

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Peter Chen
On Wed, Aug 27, 2014 at 04:20:25PM -0400, Alan Stern wrote: > On Wed, 27 Aug 2014, Felipe Balbi wrote: > > > > Hi Alan & Felipe, > > > > > > During the changing UDC drivers process, I find we can't simply move > > > usb_gadget_disconnect to usb_gadget_driver.disconnect, some UDC > > > drivers (li

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Peter Chen
On Wed, Aug 27, 2014 at 03:29:20PM -0500, Felipe Balbi wrote: > On Wed, Aug 27, 2014 at 04:20:25PM -0400, Alan Stern wrote: > > On Wed, 27 Aug 2014, Felipe Balbi wrote: > > > > > > Hi Alan & Felipe, > > > > > > > > During the changing UDC drivers process, I find we can't simply move > > > > usb_g

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-28 Thread Peter Chen
On Wed, Aug 27, 2014 at 02:37:35PM -0500, Felipe Balbi wrote: > Hi, > > On Tue, Aug 26, 2014 at 03:30:32PM +0800, Peter Chen wrote: > > On Mon, Aug 25, 2014 at 11:27:47AM -0400, Alan Stern wrote: > > > On Mon, 25 Aug 2014, Peter Chen wrote: > > > > > > > Hi Felipe & Alan, > > > > > > > > It is t

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-27 Thread Felipe Balbi
On Wed, Aug 27, 2014 at 04:20:25PM -0400, Alan Stern wrote: > On Wed, 27 Aug 2014, Felipe Balbi wrote: > > > > Hi Alan & Felipe, > > > > > > During the changing UDC drivers process, I find we can't simply move > > > usb_gadget_disconnect to usb_gadget_driver.disconnect, some UDC > > > drivers (li

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-27 Thread Alan Stern
On Wed, 27 Aug 2014, Felipe Balbi wrote: > > Hi Alan & Felipe, > > > > During the changing UDC drivers process, I find we can't simply move > > usb_gadget_disconnect to usb_gadget_driver.disconnect, some UDC > > drivers (like dwc3) will be no chance to set software pullup bit > > (dp control alwa

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-27 Thread Felipe Balbi
Hi, On Tue, Aug 26, 2014 at 03:30:32PM +0800, Peter Chen wrote: > On Mon, Aug 25, 2014 at 11:27:47AM -0400, Alan Stern wrote: > > On Mon, 25 Aug 2014, Peter Chen wrote: > > > > > Hi Felipe & Alan, > > > > > > It is the follow-up for: > > > http://www.spinics.net/lists/linux-usb/msg112193.html >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-26 Thread Peter Chen
On Mon, Aug 25, 2014 at 11:27:47AM -0400, Alan Stern wrote: > On Mon, 25 Aug 2014, Peter Chen wrote: > > > Hi Felipe & Alan, > > > > It is the follow-up for: > > http://www.spinics.net/lists/linux-usb/msg112193.html > > > > This patchset adds reset API at usb_gadget_driver, the UDC driver > > ca

RE: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-25 Thread Peter Chen
> > Hi Felipe & Alan, > > > > It is the follow-up for: > > http://www.spinics.net/lists/linux-usb/msg112193.html > > > > This patchset adds reset API at usb_gadget_driver, the UDC driver can > > call it at bus_reset handler instead of calling disconnect. > > The benefits of this patchset are: > >

Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-25 Thread Alan Stern
On Mon, 25 Aug 2014, Peter Chen wrote: > Hi Felipe & Alan, > > It is the follow-up for: > http://www.spinics.net/lists/linux-usb/msg112193.html > > This patchset adds reset API at usb_gadget_driver, the UDC driver > can call it at bus_reset handler instead of calling disconnect. > The benefits o

[RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

2014-08-24 Thread Peter Chen
Hi Felipe & Alan, It is the follow-up for: http://www.spinics.net/lists/linux-usb/msg112193.html This patchset adds reset API at usb_gadget_driver, the UDC driver can call it at bus_reset handler instead of calling disconnect. The benefits of this patchset are: - We can let the gadget driver do d