Re: [PATCH 2/2] usbnet: Fix a race between usbnet_stop() and the BH

2015-08-28 Thread Eugene Shatokhin
25.08.2015 00:01, Bjørn Mork пишет: Eugene Shatokhin eugene.shatok...@rosalab.ru writes: The race may happen when a device (e.g. YOTA 4G LTE Modem) is unplugged while the system is downloading a large file from the Net. Hardware breakpoints and Kprobes with delays were used to confirm that

Re: [PATCH 2/2] usbnet: Fix a race between usbnet_stop() and the BH

2015-08-28 Thread Bjørn Mork
Eugene Shatokhin eugene.shatok...@rosalab.ru writes: 25.08.2015 00:01, Bjørn Mork пишет: Eugene Shatokhin eugene.shatok...@rosalab.ru writes: The race may happen when a device (e.g. YOTA 4G LTE Modem) is unplugged while the system is downloading a large file from the Net. Hardware

Re: [PATCH 2/2] usbnet: Fix a race between usbnet_stop() and the BH

2015-08-28 Thread Eugene Shatokhin
28.08.2015 11:55, Bjørn Mork пишет: Eugene Shatokhin eugene.shatok...@rosalab.ru writes: 25.08.2015 00:01, Bjørn Mork пишет: Eugene Shatokhin eugene.shatok...@rosalab.ru writes: The race may happen when a device (e.g. YOTA 4G LTE Modem) is unplugged while the system is downloading a large

[PATCH 29/32] usb: dwc2: gadget: unmask idstschng interrupt only if controller supports it

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com idstschng interrupt should not be used when id pin control is external. This is already handled on dwc2 host part. Fix it on gadget part as well. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab

[PATCH 22/32] usb: dwc2: gadget: set op_state in vbus_session call

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Some device may have external id pin control enabled, so op_state will not be set on id pin interrupt change. Thus, ensure op_state is set to peripheral during vbus detection. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by:

[PATCH 27/32] usb: dwc2: gadget: kill ep0 requests before reinitializing core

2015-08-28 Thread Mian Yousaf Kaukab
Make sure there are no requests pending on ep0 before reinitializing core. Otherwise, dwc2_hsotg_enqueue_setup will fail afterwards. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git

[PATCH 25/32] usb: dwc2: gadget: print complete setup packet

2015-08-28 Thread Mian Yousaf Kaukab
wIndex field was missing. Also print in natural order instead of Req first, so that its easier to compare for example against bus analyzer logs. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH 18/32] usb: dwc2: gadget: ensure lx_state corresponds to current state

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Correctly update lx_state on gadget connection and disconnection. When usb cable is disconnected, lx_state must be updated to L3 as controller could be in power off state. When usb cable is connected, lx_state must be updated to L0 as controller is

[PATCH 31/32] usb: dwc2: gadget: handle reset interrupt before endpoint interrupts

2015-08-28 Thread Mian Yousaf Kaukab
If system is loaded, reset, enum-done and setup interrupts can occur at the same time. Current interrupt handling sequence will handle setup packet's interrupt before handling reset interrupt. Which will break the enumeration process. Correct sequence is to handle reset, enum-done and then any

[PATCH 04/32] usb: dwc2: host: enter hibernation during bus suspend

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Disable controller power and enter hibernation when usb bus is suspended. A phy driver is required to disable the power of the controller and detect remote-wakeup or disconnection since the controller will not be able to detect these in this state.

[PATCH 06/32] usb: dwc2: host: avoid resetting lx_state to L3 during disconnect

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com When a device is disconnected, lx_state must not be changed since the device may be disconnected whereas controller is still powered. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com

[PATCH 07/32] usb: dwc2: host: ignore wakeup interrupt if hibernation supported

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com If hibernation is supported, resume of devices will be handled in bus_resume callback. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/core_intr.c | 4 1

[PATCH 14/32] usb: dwc2: host: wait 3ms for controller stabilization

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Some high speed mass storage devices fail to enumerate with following error: Cannot enable port %i. Maybe the USB cable is bad? This happens only when the device is plugged while the controller is in hibernation state. After exiting hibernation,

[PATCH 15/32] usb: dwc2: host: correctly dump urb isochronous descriptors

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Print urb-iso_frame_desc.status after it has been updated using dwc2_hcd_urb_get_iso_desc_status(). Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/hcd.c | 11

[PATCH 16/32] usb: dwc2: host: use correct frame number during qh init

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com On first qh initialization, hsotg-frame_number is not corresponding to reality. So read it from host controller to get correct value. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com

[PATCH 17/32] usb: dwc2: host: kill remaining urbs using -ECONNRESET status

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com On a disconnect, dwc2 will kill all remaining urbs from qh list. urbs are given back to hcd with -ETIMEDOUT status. Some usb device driver, like mass storage, will unlink all urbs using usb_hcd_unlink_urb when receiving a negative status different

[PATCH 00/32] usb: dwc2: various bug fixes

2015-08-28 Thread Mian Yousaf Kaukab
Hi, This series consists of various bug fixes for both host and gadget sides. All patches are verified on dwc2 v3.0a with dedicated fifos. It would be good to get some Tested-bys for other platforms. It is based on testing/next branch in Felipe's git and depends on [1]. Thank you, Best regards,

[PATCH 12/32] usb: dwc2: host: disable interrupt during stop

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Disable host interrupts before synchronising dwc2 irq. So that interrupts are not generated once controller is stopped. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com ---

[PATCH 10/32] usb: dwc2: host: disconnect hcd prior stopping it

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com In case controller is asked to stop while devices are connected, disconnect all devices and clean up before stopping. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com ---

[PATCH 01/32] usb: dwc2: host: don't clear hprt0 status bits when exiting hibernation

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com When entering hibernation hprt0 must be read using dwc2_read_hprt0(). Otherwise, any set hprt0 status bits will be cleared when restoring hprt0 on exit from hibernation. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian

[PATCH 03/32] usb: dwc2: host: add flag to reflect bus state

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com lx_state must be used to reflect controller power state only and not bus state. Thus add a flag to track state during bus suspend. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com

[PATCH 11/32] usb: dwc2: host: add disconnect interrupt to host only interrupts

2015-08-28 Thread Mian Yousaf Kaukab
GINTSTS.DisconnInt is host only interrupt and should be disable after dwc2_disable_host_interrupts is called. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.c

[PATCH 09/32] usb: dwc2: host: reset frame number after suspend

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Frame number is reset in hardware after exiting hibernation. Thus, reset frame_number and ensure qh are queued with correct sched_frame. Otherwise, qh-sched_frame may be too high compared to current frame number (which is 0). This can delay

[PATCH 08/32] usb: dwc2: host: resume only if bus is suspended

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Port can be resumed in bus_resume callback. In this case, there is no need to drive resume a second time when hcd ask for it. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com ---

[PATCH 13/32] usb: dwc2: host: clear pending interrupts prior hibernation

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com If an interrupt rises during hibernation process, dwc2 will assert interrupt line to interrupt controller. If interrupt is level sensitive, interrupt handler will be called in a loop because dwc2 will not be able to clear it while controller is

[PATCH 05/32] usb: dwc2: host: update hcd and lx_state during start/stop callbacks

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com During hcd initialization, hcd and lx states must be resetted to the working state since controller is powered at this stage. Same logic applied for stop callback. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf

[PATCH 02/32] usb: dwc2: host: create a function to handle port_resume

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com port resume sequence may be used in different places. Create a function to handle it. Moreover, make hprt0 read-modify-write atomic. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com

[PATCH 21/32] usb: dwc2: gadget: don't modify pullup state in host mode

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com Modifying the pullup state during host mode trig a new enumeration of attached device. Thus, avoid modifying pullup in host mode. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com ---

[PATCH 23/32] usb: dwc2: gadget: abort core init if core_reset fails

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com No point of continue with initialization if core is not in a sane state. Signed-off-by: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 6 +- 1 file changed, 5

[PATCH 30/32] usb: dwc2: gadget: exit hibernation before power down

2015-08-28 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com When disconnecting cable, controller will detect a suspend condition and enter partial power down. If vbus_session is called by the phy driver during hibernation, make sure controller exit hibernation before it is accessed. Signed-off-by: Jianqiang

[PATCH 26/32] usb: dwc2: gadget: stop current transfer on dequeue

2015-08-28 Thread Mian Yousaf Kaukab
If the request being dequeued is already started, disable endpoint to stop the transfer and then call dwc2_hsotg_complete_request(). Endpoint will be re-enabled on next call to dwc2_hsotg_start_req(). Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 77

[PATCH 19/32] usb: dwc2: gadget: initialize op_state for peripheral only configuration

2015-08-28 Thread Mian Yousaf Kaukab
ID status change interrupt will not be handled in peripheral only configuration. So initialize op_state during gadget init. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c

[PATCH 28/32] usb: dwc2: gadget: only reset core after addressed state

2015-08-28 Thread Mian Yousaf Kaukab
There is a 200ms guard period to avoid unnecessary resets of the dwc2 ip. This delay sometimes prove to be too large when usbcv is run with an ehci host. dwc2 only needs to be reset after addressed state. Change the logic to reset ip after addressed state. Signed-off-by: Mian Yousaf Kaukab

[PATCH 32/32] usb: dwc2: exit hibernation on session request

2015-08-28 Thread Mian Yousaf Kaukab
Controller enters hibernation through suspend interrupt on disconnection. On connection, session request interrupt is generated. dwc2 must exit hibernation and restore state from this interrupt before continuing. In host mode, exit from hibernation is handled by bus_resume function.

[PATCH 20/32] usb: dwc2: force dr_mode in case of configuration mismatch

2015-08-28 Thread Mian Yousaf Kaukab
If dual role configuration is not selected, check and force dr_mode based on the selected configuration. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/platform.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/dwc2/platform.c

[PATCH 24/32] usb: dwc2: gadget: ignore stall check for ep0

2015-08-28 Thread Mian Yousaf Kaukab
dwc2_hsotg_start_req starts a request only if endpoint is not stalled. Ignore this check for ep0 as core will clear DOEPCTL0.Stall after sending stall handshake. Prepare instead for receiving next setup packet. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com ---

Re: [Bug 103461] i.MX USB runtime power management breaks the boot

2015-08-28 Thread Peter Chen
On Wed, Aug 26, 2015 at 11:49:14AM +0200, Vincent Stehlé wrote: On 08/26/2015 06:41 AM, Peter Chen wrote: .. Vincent, would you supply related u-boot and pc tools for me? Then, I can reproduce it. Hi Peter, Thanks for your concern! I have updated the bugzilla Bug 103461 with more

[PATCH] rewrite isd200_init_info for readability

2015-08-28 Thread Kris Borer
Previously, Coccinelle would issue the following false positive: isd200.c:1478:14-18: ERROR: reference preceded by free on line 1472 This change rewrites the isd200_init_info function to have more explicit execution pathways to make it easier for scripts and humans to parse. Signed-off-by: Kris

Re: PROBLEM: lsusb -v freezes kernel on Acer ES1-111M

2015-08-28 Thread Roland Weber
Hmm, looks like my last two mails didn't get sent to the list. So, with some delay... If you want, you could try an even finer bisection. The commit you identified adds a mutex_lock and a mutex_unlock, and it also changes an alloc_ordered_workqueue to alloc_workqueue. You could leave

Re: [PATCH 1/2] usb: chipidea: add xilinx zynq platform data

2015-08-28 Thread Nathan Sullivan
On Fri, Aug 28, 2015 at 09:30:12AM +0800, Peter Chen wrote: On Thu, Aug 27, 2015 at 09:33:07AM -0500, Nathan Sullivan wrote: On Thu, Aug 27, 2015 at 01:11:30PM +0530, punnaiah choudary kalluri wrote: Hi, On Thu, Aug 27, 2015 at 10:03 AM, Peter Chen peter.c...@freescale.com wrote:

Re: PROBLEM: lsusb -v freezes kernel on Acer ES1-111M

2015-08-28 Thread Alan Stern
On Fri, 28 Aug 2015, Roland Weber wrote: Hmm, looks like my last two mails didn't get sent to the list. So, with some delay... If you want, you could try an even finer bisection. The commit you identified adds a mutex_lock and a mutex_unlock, and it also changes an

Re: xHCI reports “ERROR Unknown event condition 20, HC probably busted”

2015-08-28 Thread Steinar H. Gunderson
On Thu, Aug 27, 2015 at 12:26:28AM +0200, Steinar H. Gunderson wrote: However, at the same time I get these in dmesg: [ 221.350440] xhci_hcd :00:14.0: ERROR Unknown event condition 20, HC probably busted [ 221.350559] xhci_hcd :00:14.0: ERROR Unknown event condition 20, HC

Re: [PATCH 05/32] usb: dwc2: host: update hcd and lx_state during start/stop callbacks

2015-08-28 Thread Sergei Shtylyov
On 08/28/2015 01:27 PM, Mian Yousaf Kaukab wrote: From: Gregory Herrero gregory.herr...@intel.com During hcd initialization, hcd and lx states must be resetted to the Reset. And what is lx? working state since controller is powered at this stage. Same logic applied for stop callback.