summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
Commit message (Collapse)AuthorAgeFilesLines
* usb: dwc3: of-simple: fix build warning on !PMFelipe Balbi2015-12-231-0/+2
| | | | | | | | if we have a !PM kernel build, our runtime suspend/resume callbacks will be left defined but unused. Add a ifdef CONFIG_PM guard. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: don't send extra ZLPJohn Youn2015-12-231-1/+2
| | | | | | | | | If the request->length is zero, a ZLP should already be sent due to that and another ZLP is not needed to terminate the transfer. Fixes: 04c03d10e507 ("usb: dwc3: gadget: handle request->zero") Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: pass a condition to dev_WARN_ONCE()Felipe Balbi2015-12-161-8/+6Star
| | | | | | | | | | | | | | | | instead of using: if (condition) { dev_WARN_ONCE(dev, true, "foo"); return -EINVAL; } let's use: if (dev_WARN_ONCE(dev, condition, "foo")) return -EINVAL; Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: trace: show request flagsFelipe Balbi2015-12-151-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 <balbi@ti.com>
* usb: dwc3: gadget: handle request->zeroFelipe Balbi2015-12-152-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 <ravibabu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: remove dwc3-qcom in favor of dwc3-of-simpleFelipe Balbi2015-12-153-139/+0Star
| | | | | | | | | 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 <iivanov@mm-sol.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: add generic OF glue layerFelipe Balbi2015-12-153-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 <subbaraya.sundeep.bhatta@xilinx.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: fix setup_packet_pending initializationFelipe Balbi2015-12-152-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 <balbi@ti.com>
* usb: dwc3: gadget: simplify next_request() return checkFelipe Balbi2015-12-151-3/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | 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 <balbi@ti.com>
* usb: dwc3: ep0: purge dev_dbg() callsFelipe Balbi2015-12-151-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 <balbi@ti.com>
* usb: dwc3: core: purge dev_dbg() callsFelipe Balbi2015-12-151-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 <balbi@ti.com>
* usb: dwc3: gadget: purge dev_dbg() callsFelipe Balbi2015-12-151-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 <balbi@ti.com>
* usb: dwc3: gadget: simplify dwc3_gadget_ep_queue()Felipe Balbi2015-12-151-15/+11Star
| | | | | | | | | | 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 <balbi@ti.com>
* usb: dwc3: gadget: don't prestart interrupt endpointsFelipe Balbi2015-11-301-0/+1
| | | | | | | | | | | | | Because interrupt endpoints usually transmit such small amounts of data, it seems pointless to prestart transfers and try to get speed improvements. This patch also sorts out a problem with CDC ECM function where its notification endpoint gets stuck in busy state and we continuously issue Update Transfer commands. Fixes: 8a1a9c9e4503 ("usb: dwc3: gadget: start transfer on XFER_COMPLETE") Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: let us set lower max_speedBen McCauley2015-11-171-1/+23
| | | | | | | | | | | | | | | | | | | | | | | In some SoCs, dwc3 is implemented as a USB2.0 only core, meaning that it can't ever achieve SuperSpeed. Currect driver always sets gadget.max_speed to USB_SPEED_SUPER unconditionally. This can causes issues to some Host stacks where the host will issue a GetBOS() request and we will reply with a BOS containing Superspeed Capability Descriptor. At least Windows seems to be upset by this fact and prints a warning that we should connect $this device to another port. [ balbi@ti.com : rewrote entire commit, including source code comment to make a lot clearer what the problem is ] Cc: <stable@vger.kernel.org> Signed-off-by: Ben McCauley <ben.mccauley@garmin.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: add support for Intel Broxton SOCHeikki Krogerus2015-11-161-0/+4
| | | | | | | PCI IDs for Broxton based platforms. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* Revert "usb: dwc3: gadget: drop unnecessary loop when cleaning up TRBs"Ville Syrjälä2015-10-121-16/+21
| | | | | | | | | | | | | | | | | | | This reverts commit 8f2c9544aba636134303105ecb164190a39dece4. As it breaks g_ether on my Baytrail FFRD8 device. Everything starts out fine, but after a bit of data has been transferred it just stops flowing. Note that I do get a bunch of these "NOHZ: local_softirq_pending 08" when booting the machine, but I'm not really sure if they're related to this problem. Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* Revert "usb: dwc3: gadget: remove unnecessary _irqsave()"Felipe Balbi2015-10-121-2/+3
| | | | | | | | | This reverts commit 70f3a9caa11665e9f9aace581d85d8483716a4c8. That commit was causing a lockdep splat with g_ether and that was interfering with proper functionality. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: Set enblslpm quirk for Synopsys platformsJohn Youn2015-10-091-0/+1
| | | | | | | | | | Certain Synopsys prototyping PHY boards are not able to meet timings constraints for LPM. This allows the PHY to meet those timings by leaving the PHY clock running during suspend. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: Add dis_enblslpm_quirkJohn Youn2015-10-093-0/+11
| | | | | | | | | Add a quirk to clear the GUSB2PHYCFG.ENBLSLPM bit, which controls whether the PHY receives the suspend signal from the controller. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: Add platform data for Synopsys HAPSJohn Youn2015-10-091-0/+15
| | | | | | | | Add platform data and set usb3_lpm_capable and has_lpm_erratum. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: trivial: FormattingJohn Youn2015-10-091-8/+8
| | | | | | | | | Fix the alignment of the PCI device definitions. Also change the hex digit capitalization of one constant to make it consistent with the rest of the file and driver. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: Support Synopsys USB 3.1 IPJohn Youn2015-10-092-2/+26
| | | | | | | | | | | | | | | | | | | | | | | This patch allows the dwc3 driver to run on the new Synopsys USB 3.1 IP core, albeit in USB 3.0 mode only. The Synopsys USB 3.1 IP (DWC_usb31) retains mostly the same register interface and programming model as the existing USB 3.0 controller IP (DWC_usb3). However the GSNPSID and version numbers are different. Add checking for the new ID to pass driver probe. Also, since the DWC_usb31 version number is lower in value than the full GSNPSID of the DWC_usb3 IP, we set the high bit to identify DWC_usb31 and to ensure the values are higher. Finally, add a documentation note about the revision numbering scheme. Any future revision checks (for STARS, workarounds, and new features) should take into consideration how it applies to both the 3.1/3.0 IP. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1John Youn2015-10-091-0/+5
| | | | | | | | | This adds the PCI product ID for the Synopsys USB 3.1 IP core (DWC_usb31) on a HAPS-based PCI development platform. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: Add the Synopsys HAPS AXI Product IDJohn Youn2015-10-091-0/+5
| | | | | | | | | | This ID is for the Synopsys DWC_usb3 core with AXI interface on PCIe HAPS platform. This core has the debug registers mapped at a separate BAR in order to support enhanced hibernation. Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: remove unnecessary _irqsave()Felipe Balbi2015-09-281-3/+2Star
| | | | | | | | We *know* our threads executes with our IRQs disabled. We really don't need to use the _irqsave() variant of spin_lock(). Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: use Update Transfer from Xfer In ProgressFelipe Balbi2015-09-281-2/+2
| | | | | | | | Instead of limiting __dwc3_gadget_kick_transfer() to Xfer Complete, we can try to issue Update Transfer command from Xfer In Progress too. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: use update transfer commandFelipe Balbi2015-09-281-4/+5
| | | | | | | | | | If we get a Xfer Not Ready event with reason "Transfer Active" it means endpoint is still transferring data and we can use that to issue update transfer for this particular endpoint in case we have pending requests in our queue. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: start transfer on XFER_COMPLETEFelipe Balbi2015-09-281-0/+8
| | | | | | | | | | if by the time we get to XFER_COMPLETE we have pending requests to be processed, instead of waiting for a following XFER_NOT_READY, let's start the request right away and, maybe, save the time of a few NAKs due to lack of started transfers. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: pci: passing forward the ACPI companionHeikki Krogerus2015-09-271-0/+1
| | | | | | | | Sharing the ACPI companion with dwc3 core so it has access to the properties defined for DWC3 in ACPI tables. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: core: convert to unified device property interfaceHeikki Krogerus2015-09-271-26/+24Star
| | | | | | | | | No functional affect on existing platforms, but the driver is now ready to extract the properties also from ACPI tables as well as from DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: common: of_usb_get_dr_mode to usb_get_dr_modeHeikki Krogerus2015-09-272-2/+2
| | | | | | | | | By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: st: prepare the driver for generic usb_get_dr_mode functionHeikki Krogerus2015-09-271-2/+10
| | | | | | | | | | | | | | | of_usb_get_dr_mode will be converted into more generic usb_get_dr_mode function that will take struct device instead of struct device_node as its parameter. To make the conversion possible later, waiting for the platform device for dwc3 to be populated before calling of_usb_get_dr_mode. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> CC: Giuseppe Cavallaro <peppe.cavallaro@st.com> CC: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: common: of_usb_get_maximum_speed to usb_get_maximum_speedHeikki Krogerus2015-09-271-1/+2
| | | | | | | | | By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: support for pinctrl state change during system sleepSekhar Nori2015-09-271-0/+5
| | | | | | | | | Add support for USB DRVVBUS pinctrl state change during suspend/resume. This helps is conserving power during system sleep. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: Add frame length adjustment quirkNikhil Badola2015-09-273-0/+41
| | | | | | | | | | Add adjust_frame_length_quirk for writing to fladj register which adjusts (micro)frame length to value provided by "snps,quirk-frame-length-adjustment" property thus avoiding USB 2.0 devices to time-out over a longer run Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: improve ep_queue's error reportingFelipe Balbi2015-09-271-19/+12Star
| | | | | | | | | | | We shouldn't return -EBUSY, that's used only internally when the core still has transfers in flight on a given endpoint. Also, combine the error reporting so that we don't have to duplicate it. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: clear DWC3_PENDING_REQUEST when request is queuedFelipe Balbi2015-09-271-1/+4
| | | | | | | | | Instead of clearing DWC3_PENDING_REQUEST when we start transfer, let's do it when the request is actually queued, that way we know for sure that we're clearing in the right time. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: start requests as soon as they comeFelipe Balbi2015-09-271-0/+16
| | | | | | | | | In an attempt to make dwc3 slightly faster, let's start usb_requests as soon as they come as that will let us avoid a XFER_NOT_READY event and save a little bit of time. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: move trace_dwc3_ep_queue()Felipe Balbi2015-09-271-2/+2
| | | | | | | | | by moving trace_dwc3_ep_queue() from dwc3_gadget_ep_queue() to __dwc3_gadget_ep_queue() after usb_request is properly initialized, makes for a better output always showing a request with 0 actual and -115 (-EINPROGRESS) status. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: Fix BUG in RT configRoger Quadros2015-09-211-4/+0Star
| | | | | | | | | | | | | Using spin_lock() in hard irq handler is pointless and causes a BUG() in RT (real-time) configuration so get rid of it. The reason it's pointless is because the driver is basically accessing register which is, anyways, atomic. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: enable irqs latelyFelipe Balbi2015-09-141-2/+2
| | | | | | | | | If we enable IRQs before requesting our extcon device, we might fall into a situation where and IRQ fires before we're ready to handle it. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: add ep capabilities supportRobert Baldyga2015-08-041-0/+11
| | | | | | | Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: handle non maxpacket aligned transfers > 512Kishon Vijay Abraham I2015-07-301-14/+28
| | | | | | | | | | Use chained TRB mechanism to handle non maxpacket aligned transfers greater than bounce buffer size. With this the first TRB will be programmed to receive 'ALIGN(ur->length - maxp, maxp)' data and the second TRB will be programmed to receive the remaining data using bounce buffer. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: Add chained TRB supportKishon Vijay Abraham I2015-07-302-4/+14
| | | | | | | | Add chained TRB support to ep0. Now TRB's can be chained just by invoking _dwc3_ep0_start_trans_ with 'chain' parameter set to true. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3; ep0: Modify _dwc3_ep0_start_trans_ API to take 'chain' parameterKishon Vijay Abraham I2015-07-301-7/+8
| | | | | | | | | No functional change. Added a new parameter in _dwc3_ep0_start_trans_ to indicate whether the TRB is a chained TRB or last TRB. This is in preparation for adding chained TRB support for ep0. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: preparation for handling non maxpacket aligned transfers > 512Kishon Vijay Abraham I2015-07-301-8/+17
| | | | | | | | | | No functional change. This is in preparation for handling non maxpacket aligned transfers greater than bounce buffer size. This is basically to avoid code duplication when using chained TRB transfers to handle non maxpacket aligned transfers greater than bounce buffer size. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: use _roundup_ to calculate the transfer sizeKishon Vijay Abraham I2015-07-301-3/+1Star
| | | | | | | | | No functional change. Used _roundup_ macro to calculate the transfer size aligned to maxpacket in dwc3_ep0_complete_data. It also makes it similar to how transfer size is calculated in __dwc3_ep0_do_control_data. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytesKishon Vijay Abraham I2015-07-301-2/+10
| | | | | | | | | | | | | | | | DWC3 uses bounce buffer to handle non max packet aligned OUT transfers and the size of bounce buffer is 512 bytes. However if the host initiates OUT transfers of size more than 512 bytes (and non max packet aligned), the driver throws a WARN dump but still programs the TRB to receive more than 512 bytes. This will cause bounce buffer to overflow and corrupt the adjacent memory locations which can be fatal. Fix it by programming the TRB to receive a maximum of DWC3_EP0_BOUNCE_SIZE (512) bytes. Cc: <stable@vger.kernel.org> # 3.4+ Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: defer endpoint name changeFelipe Balbi2015-07-291-21/+21
| | | | | | | We should only change endpoint names when we actually manage to enable/disable it. Signed-off-by: Felipe Balbi <balbi@ti.com>