aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2015-12-16usb: gadget: udc-core: remove unused usb_udc_attach_driver()Ruslan Bilovol1-26/+0
Now when last user of usb_udc_attach_driver() is switched to passing UDC name via usb_gadget_driver struct, it's safe to remove this function Tested-by: Maxime Ripard <[email protected]> Signed-off-by: Ruslan Bilovol <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Tested-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-16usb: gadget: configfs: pass UDC name via usb_gadget_driver structRuslan Bilovol1-13/+16
Now when udc-core supports binding to specific UDC by passing its name via 'udc_name' member of usb_gadget_driver struct, switch to this generic approach. Tested-by: Maxime Ripard <[email protected]> Signed-off-by: Ruslan Bilovol <[email protected]> [rebased and fixed checkpatch issues] Signed-off-by: Marek Szyprowski <[email protected]> Tested-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-16usb: gadget: bind UDC by name passed via usb_gadget_driver structureRuslan Bilovol1-5/+19
Introduce new 'udc_name' member to usb_gadget_driver structure. The 'udc_name' is a name of UDC that usb_gadget_driver should be bound to. If udc_name is NULL, it will be bound to any available UDC. Tested-by: Maxime Ripard <[email protected]> Signed-off-by: Ruslan Bilovol <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Tested-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-16usb: phy: phy-am335x: bypass first VBUS sensing for host-only modeBin Liu4-11/+27
To prevent VBUS contention, the am335x MUSB phy senses VBUS first before transitioning to host mode. However, for host-only mode, VBUS could be directly tied to 5V power rail which could prevent MUSB transitions to host mode. This change receives dr_mode of the controller then bypass the first VBUS sensing for host-only mode, so that MUSB can work in host mode event if VBUS is tied to 5V. Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-16usb: phy: correct the am335x phy header filenameBin Liu3-2/+2
The filename of am35x-phy-control.h is confusing. The header is used by the am335x phy driver, but the filename refers to am35x. Even worse there is indeed another device called am35x but it does not use this header at all. Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: phy: Remove unused Renesas R-Car (Gen1) USB PHY driverGeert Uytterhoeven3-261/+0
As of commit 3d7608e4c169af03 ("ARM: shmobile: bockw: remove legacy board file and config"), the Renesas R-Car (Gen1) USB PHY driver is no longer used. In theory it could still be used on R-Car Gen1 SoCs, but that would require adding DT support to the driver. Instead, a new driver using the generic PHY framework should be written, as was done for R-Car Gen2. Remove the driver for good. Acked-by: Simon Horman <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: lpc32xxx_udc: clean up and sort include directives outVladimir Zapolskiy1-24/+11
Remove mach/irq.h from the list of included headers, there is no compilation dependency on this include file, and the change is needed to prevent a compilation failure, when mach/irq.h is removed. Additionally remove other unneeded includes and sort out their order. Signed-off-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: trace: show request flagsFelipe Balbi1-1/+10
struct usb_request have 3 flags which might be important to know about during debug. This patch shows each of the 3 flags as a single letter: z -> for zero s -> short not okay i -> interrupt A capital letter means the feature is enabled while a lower case letter means it is disabled; Thus 'zsI' indicates that a ZLP is not needed, that we can accept a short packet and interrupt for this request should be enabled. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: gadget: handle request->zeroFelipe Balbi2-2/+51
So far, dwc3 has always missed request->zero handling for every endpoint. Let's implement that so we can handle cases where transfer must be finished with a ZLP. Note that dwc3 is a little special. Even though we're dealing with a ZLP, we still need a buffer of wMaxPacketSize bytes; to hide that detail from every gadget driver, we have a preallocated buffer of 1024 bytes (biggest bulk size) to use (and share) among all endpoints. Reported-by: Ravi B <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: musb: convert printk to pr_*Rasmus Villemoes1-10/+7
This file already uses pr_debug in a few places; this converts the remaining printks. Signed-off-by: Rasmus Villemoes <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: Clear interrupts before handling themDouglas Anderson2-35/+32
In general it is wise to clear interrupts before processing them. If you don't do that, you can get: 1. Interrupt happens 2. You look at system state and process interrupt 3. A new interrupt happens 4. You clear interrupt without processing it. This patch was actually a first attempt to fix missing device insertions as described in (usb: dwc2: host: Fix missing device insertions) and it did solve some of the signal bouncing problems but not all of them (which is why I submitted the other patch). Specifically, this patch itself would sometimes change: 1. hardware sees connect 2. hardware sees disconnect 3. hardware sees connect 4. dwc2_port_intr() - clears connect interrupt 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() ...to: 1. hardware sees connect 2. hardware sees disconnect 3. dwc2_port_intr() - clears connect interrupt 4. hardware sees connect 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() ...but with different timing then sometimes we'd still miss cable insertions. In any case, though this patch doesn't fix any (known) problems, it still seems wise as a general policy to clear interrupt before handling them. Note that for dwc2_handle_usb_port_intr(), instead of moving the clear of PRTINT to the beginning of the function we remove it completely. The only way to clear PRTINT is to clear the sources that set it in the first place. Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: Add missing spinlock in dwc2_hcd_reset_func()Douglas Anderson1-0/+6
The dwc2_hcd_reset_func() function is only ever called directly by a delayed work function. As such no locks are already held when the function is called. Doing a read-modify-write of CPU registers and setting fields in the main hsotg data structure is a bad idea without locks. Let's add locks. The bug was found by code inspection only. It turns out that the dwc2_hcd_reset_func() is only ever called today if the "host_support_fs_ls_low_power" parameter is enabled and no code in mainline enables that parameter. Thus no known issues in mainline are fixed by this patch, but it's still probably wise to fix the function. Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: of: add an api to get dr_mode by the phy nodeBin Liu1-6/+54
Some USB phy drivers have different handling for the controller in each dr_mode. But the phy driver does not have visibility to the dr_mode of the controller. This adds an api to return the dr_mode of the controller which associates the given phy node. Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: f_sourcesink: quit if usb_ep_queue returns errorPeter Chen1-0/+1
Since now, we may have more than one request during the test, and it is better we just quit once the error occurs instead of try queueing further requests. Signed-off-by: Peter Chen <[email protected]> Suggested-by: Krzysztof Opasiak <[email protected]> Reviewed-by: Krzysztof Opasiak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: composite: remove redundant bcdUSB setting in legacyIgor Kotrasinski16-16/+16
Since composite now overwrites bcdUSB for any gadget, remove setting it in legacy gadgets. All legacy gadgets set 0x0200, the same as the value additionally set by composite, so there is no behaviour change. Signed-off-by: Igor Kotrasinski <[email protected]> Rebase onto current balbi/next Signed-off-by: Krzysztof Opasiak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: Support immediate retries for split transactionsDouglas Anderson1-2/+12
In some cases, like when you've got a "Microsoft Wireless Keyboard 2000" connected to dwc2 with a hub, expected that we'll get some transfer errors sometimes. The controller is expected to try at least 3 times before giving up. See figure "Figure A-67. Normal HS CSPLIT 3 Strikes Smash" in the USB spec. The dwc2 controller has a way to support this by using the "EC_MC" field. The Raspberry Pi driver has logic for setting this right. See fiq_fsm_queue_split_transaction() in their "dwc_otg_hcd.c". Let's use the same logic. After making this change, we no longer get dropped characters from the above mentioned keyboard. Other devices on the same bus as the keyboard also behave more properly. Thanks for Julius Werner for the expert analysis and suggestions. Acked-by: John Youn <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: Fix missing device insertionsDouglas Anderson4-11/+45
If you've got your interrupt signals bouncing a bit as you insert your USB device, you might end up in a state when the device is connected but the driver doesn't know it. Specifically, the observed order is: 1. hardware sees connect 2. hardware sees disconnect 3. hardware sees connect 4. dwc2_port_intr() - clears connect interrupt 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() Now you'll be stuck with the cable plugged in and no further interrupts coming in but the driver will think we're disconnected. We'll fix this by checking for the missing connect interrupt and re-connecting after the disconnect is posted. We don't skip the disconnect because if there is a transitory disconnect we really want to de-enumerate and re-enumerate. Notes: 1. As part of this change we add a "force" parameter to dwc2_hcd_disconnect() so that when we're unloading the module we avoid the new behavior. The need for this was pointed out by John Youn. 2. The bit of code needed at the end of dwc2_hcd_disconnect() is exactly the same bit of code from dwc2_port_intr(). To avoid duplication, we refactor that code out into a new function dwc2_hcd_connect(). Signed-off-by: Douglas Anderson <[email protected]> Acked-by: John Youn <[email protected]> Tested-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: add support of hi6220Zhangfei Gao1-0/+33
Support hisilicon,hi6220-usb for HiKey board Acked-by: Rob Herring <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Zhangfei Gao <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: use kmem cache to allocate descriptorsGregory Herrero3-3/+71
Kmem caches help to get correct boundary for descriptor buffers which need to be 512 bytes aligned for dwc2 controller. Two kmem caches are needed for generic descriptors and for hs isochronous descriptors which doesn't have same size. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: fix descriptor list address maskingMian Yousaf Kaukab2-11/+3
Masks for HCDMA.CTD and HCDMA.DMAAddr are incorrect. As we always start from first descriptor, no need to mask the address anyway. Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: avoid usage of dma_alloc_coherent with irqs disabledGregory Herrero5-25/+94
Use Streaming DMA mappings to handle cache coherency of frame list and descriptor list. Cache are always flushed before controller access it or before cpu access it. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: enable descriptor dma for fs devicesMian Yousaf Kaukab6-3/+84
As descriptor dma mode does not support split transfers, it can't be enabled for high speed devices. Add a core parameter to enable it for full speed devices. Ensure frame list and descriptor list are correctly freed during disconnect. Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: misc: usbtest: Remove timeval usageDeepa Dinamani1-82/+147
timeval is deprecated and not y2038 safe. Its size also changes according to 32 bit/ 64 bit compilation. Replace it with 32 and 64 bit versions of its individual fields, giving two ioctls with different code values. The two ioctls are necessary to maintain the 32 bit and 64 bit userspace compatibility with a 64/32 bit kernel. Change unsigned to __u32 types for a definitive userspace interface. This is in accordance with the psABI that the unsigned type is always 32 bits. Also use motonic timer instead of real time to ensure positive delta values. Refactor usbtest_ioctl for readability to isolate the handling of the testing timing measurement. The official testusb userspace tool can be changed in a separate patch to reflect the __u32 changes as well. It can use the usbtest_param_32 struct, since 32 bit seconds is long enough for test durations. Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: gmidi: Cleanup legacy codeFelipe F. Tonello1-8/+0
Remove unnecessary headers and variables. Reviewed-by: Robert Baldyga <[email protected]> Signed-off-by: Felipe F. Tonello <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: define free_ep_req as universal functionFelipe F. Tonello5-16/+8
This function is shared between gadget functions, so this avoid unnecessary duplicated code and potentially avoid memory leaks. Reviewed-by: Robert Baldyga <[email protected]> Signed-off-by: Felipe F. Tonello <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: f_midi: remove duplicated codeFelipe F. Tonello1-19/+0
This code is duplicated from f_midi_start_ep(midi, f, midi->out_ep). Reviewed-by: Robert Baldyga <[email protected]> Signed-off-by: Felipe F. Tonello <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: renesas_usbhs: Modify ep.caps.type_xxx and usb_ep_maxpacket_limit()Yoshihiro Shimoda1-7/+12
This patch modifies the ep.caps.type_{iso,bulk,int} setting and the second argument of usb_ep_maxpacket_limit() using the dparam.pipe_configs. In the previous code, all the type_{iso,bulk,int} were set to true. However, to avoid waste time for finding suitable pipe in usb_ep_enable(), this driver should set correct type. Also the second argument of usb_ep_maxpacket_limit() was set to 512 even if the pipe is isochronous or interrupt. So, this driver could not bind a gadget driver like the g_audio driver. Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: renesas_usbhs: Modify pipe configurationYoshihiro Shimoda4-127/+66
The current code has info->bufnmb_last to calculate the BUFNMB bits of PIPEBUF register. However, since the bufnmb_last is initialized in the usbhs_pipe_init() only, this driver is possible to set unexpected value to the register if usb_ep_{enable,disable}() are called many times. So, this patch modifies the pipe configuration via struct renesas_usbhs_driver_param to simplify the code. Also this patch changes: - a double buffer configuration - isochronous buffer size from 512 to 1024 Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: process all completed urbsGregory Herrero1-2/+36
Process all completed urbs, if more urbs are complete by the time driver processes completion interrupt. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: always increment available host channel during releaseGregory Herrero1-0/+1
When releasing a channel, increment hsotg->available_host_channels even in case a periodic channel is released. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: program descriptor for next frameGregory Herrero2-2/+32
Isochronous descriptor is currently programmed for the frame after the last descriptor was programmed. If the last descriptor frame underrun, then current descriptor must take this into account and must be programmed on the current frame + 1. This overrun usually happens when system is loaded and dwc2 can't init descriptor list in time. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: add function to compare frame indexGregory Herrero1-0/+13
This function allow comparing frame index used for descriptor list which has 64 entries. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: spinlock release channelGregory Herrero1-0/+4
Prevent dwc2 driver from accessing channel while it frees it. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: fix use of qtd after free in desc dma modeGregory Herrero1-1/+4
When completing non isoc xfer, dwc2_complete_non_isoc_xfer_ddma() is relying on qtd->n_desc to process the corresponding number of descriptors. During the processing of these descriptors, qtd could be unlinked and freed if xfer is done and urb is no more in progress. In this case, dwc2_complete_non_isoc_xfer_ddma() will read again qtd->n_desc whereas qtd has been freed. This will lead to unpredictable results since qtd->n_desc is no more valid value. To avoid this error, return a result != 0 in dwc2_process_non_isoc_desc(), so that dwc2_complete_non_isoc_xfer_ddma() stops desc processing. This has been seen with Slub debug enabled. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: rework isochronous halt pathGregory Herrero1-1/+21
When a channel is halted because of urb dequeue during transfer completion, no other qtds must be scheduled until halt is done. Moreover, all in progress qtds must be given back. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: set active bit in isochronous descriptorsGregory Herrero1-8/+3
Active bit must be enabled in all scheduled descriptors. Else transfer never start. Remove previous code which was not correctly configuring descriptors. Active bit was set before calling dwc2_fill_host_isoc_dma_desc() which is erasing dma_desc->status. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: ensure filling of isoc desc is correctly doneGregory Herrero1-2/+3
Increment qtd->isoc_frame_index_last before testing it, else below check will never be true and IOC (Interrupt On Complete) bit for last frame will never be set in descriptor status. /* Set IOC for each descriptor corresponding to last frame of URB */ if (qtd->isoc_frame_index_last == qtd->urb->packet_count) dma_desc->status |= HOST_DMA_IOC; Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: misc: usbtest: improve the description for error messagePeter Chen1-2/+2
Now the function of complicated_callback is not only used for iso transfer, improve the error message to reflect it. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: gadget: f_sourcesink: add queue depthPeter Chen3-33/+127
Add queue depth for both iso and bulk transfer, with more queues, we can do performance and stress test using sourcesink, and update g_zero accordingly. Reviewed-by: Krzysztof Opasiak <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: remove dwc3-qcom in favor of dwc3-of-simpleFelipe Balbi3-139/+0
Now that we have a generic dwc3-of-simple.c, we can use that instead of maintaining dwc3-qcom.c which is extremely similar. Cc: Ivan T. Ivanov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: add generic OF glue layerFelipe Balbi3-0/+188
For simple platforms which merely enable some clocks and populate its children, we can use this generic glue layer to avoid boilerplate code duplication. For now this supports Qcom and Xilinx, but if we find a way to add generic handling of regulators and optional PHYs, we can absorb exynos as well. Tested-by: Subbaraya Sundeep Bhatta <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: ep0: fix setup_packet_pending initializationFelipe Balbi2-5/+7
It just ocurred to me that dwc3 already gives a really hint of when a setup packet is pending and that's the SETUP_PENDING TRB Status for EP0 IRQs. Fix setup_packet_pending initialization based on that. While at that, also make sure the comment in gadget.c matches what code is doing. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: gadget: simplify next_request() return checkFelipe Balbi1-3/+2
In dwc3_cleanup_done_reqs() we expect that all iterations of our while (1) loop will find a valid struct dwc3_request *. In case we don't, we're dumping a WARN_ON_ONCE() splat so that people report the failure. This patch is a simple cleanup converting: if (!req) { WARN_ON_ONCE(1); return 1; } to: if (WARN_ON_ONCE(!req)) return 1; which is a little easier to read. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: ep0: purge dev_dbg() callsFelipe Balbi1-2/+2
The last few dev_dbg() messages are converted to tracepoints and we can finally ignore dev_dbg() messages during debug sessions. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: core: purge dev_dbg() callsFelipe Balbi1-3/+5
The last few dev_dbg() messages are converted to tracepoints and we can finally ignore dev_dbg() messages during debug sessions. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: gadget: purge dev_dbg() callsFelipe Balbi1-16/+21
The last few dev_dbg() messages are converted to tracepoints and we can finally ignore dev_dbg() messages during debug sessions. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc3: gadget: simplify dwc3_gadget_ep_queue()Felipe Balbi1-15/+11
By moving our sanity checks our internal function __dwc3_gadget_ep_queue() we can simplify the externally visible API while also making sure that callers of __dwc3_gadget_ep_queue() also make use of the same checks. Signed-off-by: Felipe Balbi <[email protected]>
2015-12-13Merge 4.4-rc5 into usb-next as we want those fixes here for testingGreg Kroah-Hartman27-68/+194
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2015-12-11USB: add quirk for devices with broken LPMAlan Stern2-1/+12
Some USB device / host controller combinations seem to have problems with Link Power Management. For example, Steinar found that his xHCI controller wouldn't handle bandwidth calculations correctly for two video cards simultaneously when LPM was enabled, even though the bus had plenty of bandwidth available. This patch introduces a new quirk flag for devices that should remain disabled for LPM, and creates quirk entries for Steinar's devices. Signed-off-by: Alan Stern <[email protected]> Reported-by: Steinar H. Gunderson <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2015-12-11xhci: fix usb2 resume timing and races.Mathias Nyman2-6/+44
According to USB 2 specs ports need to signal resume for at least 20ms, in practice even longer, before moving to U0 state. Both host and devices can initiate resume. On device initiated resume, a port status interrupt with the port in resume state in issued. The interrupt handler tags a resume_done[port] timestamp with current time + USB_RESUME_TIMEOUT, and kick roothub timer. Root hub timer requests for port status, finds the port in resume state, checks if resume_done[port] timestamp passed, and set port to U0 state. On host initiated resume, current code sets the port to resume state, sleep 20ms, and finally sets the port to U0 state. This should also be changed to work in a similar way as the device initiated resume, with timestamp tagging, but that is not yet tested and will be a separate fix later. There are a few issues with this approach 1. A host initiated resume will also generate a resume event. The event handler will find the port in resume state, believe it's a device initiated resume, and act accordingly. 2. A port status request might cut the resume signalling short if a get_port_status request is handled during the host resume signalling. The port will be found in resume state. The timestamp is not set leading to time_after_eq(jiffies, timestamp) returning true, as timestamp = 0. get_port_status will proceed with moving the port to U0. 3. If an error, or anything else happens to the port during device initiated resume signalling it will leave all the device resume parameters hanging uncleared, preventing further suspend, returning -EBUSY, and cause the pm thread to busyloop trying to enter suspend. Fix this by using the existing resuming_ports bitfield to indicate that resume signalling timing is taken care of. Check if the resume_done[port] is set before using it for timestamp comparison, and also clear out any resume signalling related variables if port is not in U0 or Resume state This issue was discovered when a PM thread busylooped, trying to runtime suspend the xhci USB 2 roothub on a Dell XPS Cc: stable <[email protected]> Reported-by: Daniel J Blueman <[email protected]> Tested-by: Daniel J Blueman <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>