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 steps for this

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. Step

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 suggestion.

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. the

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 drivers

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 could

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 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 flush the

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 handler. (At

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? Don't we

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 about

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 get all of

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 net2272. Would

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 me to post

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 callback

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

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 callback if

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 reset mandatory.

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 drivers,

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 and the

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 callback

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 functions must

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 two issues:

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 what the API was

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 driver

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, it

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 two issues:

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 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, we need

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 the follow-up for:

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 (like dwc3) will be

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_gadget_disconnect to

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, Peter Chen

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 function

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 connect

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 driver doesn't want to

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 will invoke

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 This

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 always means

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 (like dwc3) will be

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 can call it at

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 of this

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: - We can let the

[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