[RFC][PATCH 4/5 v2] usb: dwc2: Avoid suspending if we're in gadget mode

2016-12-16 Thread John Stultz
I've found when booting HiKey with the usb gadget cable attached if I then try to connect via adb, I get an infinite spew of: dwc2 f72c.usb: dwc2_hsotg_ep_sethalt(ep ffc0790ecb18 ep1out, 0) dwc2 f72c.usb: dwc2_hsotg_ep_sethalt(ep ffc0790eca18 ep1in, 0) It seems that the usb autosu

[RFC][PATCH 2/5 v2] usb: dwc2: Workaround case where GOTGCTL state is wrong

2016-12-16 Thread John Stultz
When removing a USB-A to USB-otg adapter cable, we get a change status irq, and then in dwc2_conn_id_status_change, we erroniously see the GOTGCTL_CONID_B flag set. This causes us to get stuck in the "while (!dwc2_is_device_mode(hsotg))" loop, spitting out "Waiting for Peripheral Mode, Mode=Host"

[RFC][PATCH 3/5 v2] usb: dwc2: Force port resume on switching to device mode

2016-12-16 Thread John Stultz
From: Chen Yu We've seen failures when switching between host and gadget mode, which was diagnosed as being caused due to the bus being auto-suspended when we switched. So this patch forces a port resume when switching to device mode if the bus is suspended. Cc: Wei Xu Cc: Guodong Xu Cc: Amit

[RFC][PATCH 1/5 v2] usb: dwc2: Avoid sleeping while holding hsotg->lock

2016-12-16 Thread John Stultz
Basically when plugging in various cables in different orders, I'm occasionally seeing the following BUG splat: [ 86.215403] BUG: scheduling while atomic: kworker/u16:2/53/0x0002 [ 86.219164] usb 1-1: USB disconnect, device number 9 [ 86.226845] Preemption disabled at:[ 86.230218] [] d

[RFC][PATCH 5/5 v2] usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220

2016-12-16 Thread John Stultz
From: Chen Yu The Hi6220's usb controller is limited in that it does not support "Split Transactions", so it does not support communicating with low-speed and full-speed devices behind a high-speed hub. Thus it requires a quirk so that we can manually drop the usb speed when low/full-speed are a

[RFC][PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board

2016-12-16 Thread John Stultz
I just wanted to re-send my current queue of patches for dwc2 controller on the HiKey board, as my last patchset ended up colliding with a number of changes that landed in the 4.10-rc merge window. I've fixed things up and validated these against HiKey. I also made a small change to one of the pa

Re: [PATCH 1/2] usb: dwc3: gadget: Fix full speed mode

2016-12-16 Thread John Youn
On 12/7/2016 7:06 PM, John Youn wrote: > On 12/7/2016 4:44 AM, Felipe Balbi wrote: >> >> Hi, >> >> Roger Quadros writes: > Roger Quadros writes: >> DCFG.DEVSPD == 0x3 is not valid and we need to set >> DCFG.DEVSPD to 0x1 for full speed mode. > > seems like it has been made inv

[PATCH 0/2] usb: musb: blackfin: fix unused warnings

2016-12-16 Thread Jérémy Lefaure
I found three functions in blackfin.c defined but not used in some configurations. These patches fix these compilation warnings. [PATCH 1/2] usb: musb: blackfin: fix unused warnings on suspend/resume [PATCH 2/2] usb: musb: blackfin: add bfin_fifo_offset in bfin_ops -- To unsubscribe from this list

[PATCH 2/2] usb: musb: blackfin: add bfin_fifo_offset in bfin_ops

2016-12-16 Thread Jérémy Lefaure
Commit cc92f6818f6e ("usb: musb: Populate new IO functions for blackfin") defines bfin_fifo_offset function without using it: drivers/usb/musb/blackfin.c:36:12: warning: ‘bfin_fifo_offset’ defined but not used [-Wunused-function] static u32 bfin_fifo_offset(u8 epnum) ^~~~

[PATCH 1/2] usb: musb: blackfin: fix unused warnings on suspend/resume

2016-12-16 Thread Jérémy Lefaure
When CONFIG_PM_SLEEP is disabled, SIMPLE_DEV_PM_OPS does not use bfin_resume and bfin_suspend even if CONFIG_PM is enabled: drivers/usb/musb/blackfin.c:602:12: warning: ‘bfin_resume’ defined but not used [-Wunused-function] static int bfin_resume(struct device *dev) ^~~ driver

[PATCH] usb: c67x00: remove unused variable

2016-12-16 Thread Sudip Mukherjee
The pointer urbp was only assigned some address but was never used. Signed-off-by: Sudip Mukherjee --- drivers/usb/c67x00/c67x00-sched.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c index 7311ed6..0b68cd6 100644 --- a

[PATCH] usb: atm: cxacru: remove impossible condition

2016-12-16 Thread Sudip Mukherjee
The variable index is unsigned and so it can never be less than 0. Signed-off-by: Sudip Mukherjee --- drivers/usb/atm/cxacru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index f9fe86b6..d65a64c 100644 --- a/drivers/usb/

Re: usb/core: warning in usb_create_ep_devs/sysfs_create_dir_ns

2016-12-16 Thread Alan Stern
On Mon, 12 Dec 2016, Andrey Konovalov wrote: > Hi! > > While running the syzkaller fuzzer I've got the following error report. > > On commit 3c49de52d5647cda8b42c4255cf8a29d1e22eff5 (Dev 2). > > WARNING: CPU: 2 PID: 865 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x8a/0xa0 > gadgetfs: disconnected > sy

Re: [PATCH v2 0/3] usb: musb: da8xx: Add support of suspend / resume

2016-12-16 Thread Bin Liu
On Fri, Dec 16, 2016 at 11:46:13AM +0100, Alexandre Bailon wrote: > There is no suspend / resume support for da8xx. > Add the PM methods to da8xx glue. > In addition, introduce a new quirk to preserve the session > (i.e not clear the devctl register). > Clearing devctl will power off vbus on da8xx

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 05:13:50PM +0100, Johan Hovold wrote: > On Fri, Dec 16, 2016 at 08:04:18AM -0800, Russell Senior wrote: > > Sorry, I got distracted. I'm back now. Do you want me to test your > > 13 patch series? And what is that on top of? > > Yes, please. It's against my usb-next branc

RE: [PATCH] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Felipe Balbi
Hi, Jerry Huang writes: > Hi, Balbi, >> -Original Message- >> From: Felipe Balbi [mailto:ba...@kernel.org] >> Sent: Friday, December 16, 2016 7:44 PM >> To: Jerry Huang ; gre...@linuxfoundation.org >> Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Rajesh Bhagat >> >> Subje

RE: [PATCH] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Jerry Huang
Hi, Balbi, > -Original Message- > From: Felipe Balbi [mailto:ba...@kernel.org] > Sent: Friday, December 16, 2016 7:44 PM > To: Jerry Huang ; gre...@linuxfoundation.org > Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Rajesh Bhagat > > Subject: RE: [PATCH] USB3/DWC3: Enable u

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 08:04:18AM -0800, Russell Senior wrote: > Sorry, I got distracted. I'm back now. Do you want me to test your > 13 patch series? And what is that on top of? Yes, please. It's against my usb-next branch. I'll send you a couple of diagnostics patches as well shortly. Than

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Russell Senior
Sorry, I got distracted. I'm back now. Do you want me to test your 13 patch series? And what is that on top of? Thanks On Fri, Dec 16, 2016 at 6:46 AM, Johan Hovold wrote: > On Fri, Dec 16, 2016 at 01:19:05PM +, Aidan Thornton wrote: >> On Wed, Dec 14, 2016 at 3:28 PM, Johan Hovold wrote

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 01:19:05PM +, Aidan Thornton wrote: > On Wed, Dec 14, 2016 at 3:28 PM, Johan Hovold wrote: > > The ch341 driver is based on reverse-engineering and contains some bits > > which appear to be redundant and some which appear incompatible which > > certain devices. > > > >

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 12:39:45PM +, Aidan Thornton wrote: > On Thu, Dec 15, 2016 at 3:58 PM, Johan Hovold wrote: > > On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote: > >> Some CH341 devices appear to require the use of the init vendor command > >> to set the baud rate and line-c

[PATCH] usb: dwc3: pci: sometimes 'add' means 'set'

2016-12-16 Thread Felipe Balbi
even though the API is called platform_device_add_properties(), it actually replaces any previously set properties and only maintains the last properties set. This means that we need to duplicate "linux,sysdev_is_parent" in all other occasions instead of having it in a single place. Signed-off-by

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Aidan Thornton
On Wed, Dec 14, 2016 at 3:28 PM, Johan Hovold wrote: > The ch341 driver is based on reverse-engineering and contains some bits > which appear to be redundant and some which appear incompatible which > certain devices. > > Specifically, some CH340 devices seem unable to change the initial line > se

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-16 Thread Aidan Thornton
On Thu, Dec 15, 2016 at 3:58 PM, Johan Hovold wrote: > On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote: >> Some CH341 devices appear to require the use of the init vendor command >> to set the baud rate and line-control register. Specifically, while >> using direct register updates fo

[PATCH v2 1/2] USB3/DWC3: Add definition for global soc bus configuration register

2016-12-16 Thread Changming Huang
Add the macro definition for global soc bus configuration register 0/1 Signed-off-by: Changming Huang --- Changes in v2: - split the patch - add more macro definition for soc bus configuration register drivers/usb/dwc3/core.h | 26 ++ 1 file changed, 26 insertions(

RE: [PATCH] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Felipe Balbi
Hi, Jerry Huang writes: >> there's no need for that. This patch is in good format. I do have a question, >> however: how do you know this will work for all users? Burst size is a >> function >> of how wide the interconnect where dwc3 is attached to, is. > So I need to generate one new property

[PATCH v2 0/3] usb: musb: da8xx: Add support of suspend / resume

2016-12-16 Thread Alexandre Bailon
There is no suspend / resume support for da8xx. Add the PM methods to da8xx glue. In addition, introduce a new quirk to preserve the session (i.e not clear the devctl register). Clearing devctl will power off vbus on da8xx platform (when it is host mode) and then devices will be disconnected on res

[PATCH v2 3/3] usb: musb: da8xx: Fix host mode suspend

2016-12-16 Thread Alexandre Bailon
On da8xx, VBUS is not maintained during suspend when musb is in host mode. On resume, all the connected devices will be disconnected and then will be enumerated again. This happens because MUSB_DEVCTL is cleared during suspend. Use the quirk MUSB_PRESERVE_SESSION to preseve MUSB_DEVCTL during susp

[PATCH v2 2/3] usb: musb: Add a quirk to preserve the session during suspend

2016-12-16 Thread Alexandre Bailon
On da8xx, VBUS is not maintained during suspend when musb is in host mode. On resume, all the connected devices will be disconnected and then will be enumerated again. This happens because MUSB_DEVCTL is cleared during suspend. Add a quirk to not clear MUSB_DEVCTL and then preserve the session dur

[PATCH v2 1/3] usb: musb: da8xx: Add support of suspend / resume

2016-12-16 Thread Alexandre Bailon
Implement PM methods specifics for da8xx glue. The only thing to do is to power off the phy. As the registers are in retention during suspend, there is no need to save them. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 29 + 1 file changed, 29 insert

Re: [PATCH 2/3] usb: musb: Add a quirk to preserve MUSB_DEVCTL during suspend

2016-12-16 Thread Alexandre Bailon
On 12/16/2016 03:36 AM, Bin Liu wrote: > On Mon, Nov 28, 2016 at 05:26:20PM +0100, Alexandre Bailon wrote: >> On da8xx, VBUS is not maintained during suspend when musb is in host mode. >> On resume, all the connected devices will be disconnected and then will >> be enumerated again. >> This happens

RE: [PATCH] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Jerry Huang
> -Original Message- > From: Felipe Balbi [mailto:ba...@kernel.org] > Sent: Friday, December 16, 2016 5:17 PM > To: Jerry Huang ; Jerry Huang > ; gre...@linuxfoundation.org > Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Rajesh Bhagat > > Subject: RE: [PATCH] USB3/DWC3: Ena

[PATCH v2 2/2] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Changming Huang
While enabling undefined length INCR burst type and INCR16 burst type, get better write performance on NXP Layerscape platform: around 3% improvement (from 364MB/s to 375MB/s). Signed-off-by: Changming Huang Signed-off-by: Rajesh Bhagat --- Changs in v2: - split patch - create one new functi

RE: [PATCH] USB3/DWC3: Enable undefined length INCR burst type

2016-12-16 Thread Felipe Balbi
Hi, Jerry Huang writes: >> -Original Message- >> From: Changming Huang [mailto:jerry.hu...@nxp.com] >> Sent: Tuesday, December 13, 2016 5:06 PM >> To: ba...@kernel.org; gre...@linuxfoundation.org >> Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; Jerry Huang >> ; Rajesh Bhag

[PATCH v2] usb: ohci-at91: use descriptor-based gpio APIs correctly

2016-12-16 Thread Peter Rosin
The gpiod_get* function family does not want the -gpio suffix. Use devm_gpiod_get_index_optional instead of devm_gpiod_get_optional. The descriptor based APIs handle active high/low automatically. The vbus-gpios are output, request enable while getting the gpio. Don't try to get any vbus-gpios for