summaryrefslogtreecommitdiff
path: root/drivers/usb (follow)
Commit message (Collapse)AuthorAge
...
* | | DWC3: gadget: Report error if RX buffer not aligned to EP's MTUManu Gautam2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synopsys USB3 Controller (DWC3) has a restriction where size of OUT requests (TRB) queued to the controller must be aligned with the endpoint's max packet size. Hence, report error in case function driver tries to queue an unaligned request. Change-Id: Id5f4a0ff9d2f9c55bba936d683608c524eadd260 Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
* | | usb: dwc3: Fall back to high speed when SSPHY failsMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, it has been observed that SSPHY fails to initialized. This change detects this condition and configures controller to work into high speed mode only. Change-Id: I50c4041d8572d0cdc4535812eebd10fc18b78e98 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | usb: dwc3: gadget: Fix calculation of request.actual for SGJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a request completes, cleanup_done_trbs() tries to calculate request.actual by subtracting the TRB remainder from the original request.length, but does not account for scatter-gather requests that queued multiple TRBs. In this case, the request.length field may be used by the function to keep track of the aggregate length of all the provided SG entries, and thus will produce an incorrect request.actual. Instead, for scatter-gather, to find the pre-transfer buffer length of each TRB, get the length field of each SG entry. Then the number of bytes transfered can be correctly determined as the difference between that and the bytes remaining in the TRB. Change-Id: I4c197462ce5b804c9d684240e95c35b532976220 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: Do not call WARN_ON_ONCE from interrupt contextHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gadget driver calls WARN_ON_ONCE in some of the APIs which are called from interrupt context. This may lead to watchdog bark if repeated WARN_ON_ONCE condition occurs. Hence print error message and/or log it in debug buffer. CRs-Fixed: 747698 Change-Id: Ieecd6342135e7d2bad36c82a12958b78054150db Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: dwc3: gadget: Resolve recursive spinlock during remote wakeupJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a USB function wishes to send new data during USB suspend state, it needs to issue USB remote wakeup and send a function wakeup notification after then. This scenario leads to recursive spin locking inside the _usb_func_wakeup() function, because this function gets called recursively. This function issues remote wakeup, which internally calls the resume interrupt callback, which calls the _usb_func_wakeup() function again. This issue is resolved by performing the remote wakeup in a deferred work context, and this splits the recursion loop. CRs-fixed: 700667 Change-Id: I59c8efde098781587d29f08cd60e4aa3521949d8 Signed-off-by: Danny Segal <dsegal@codeaurora.org>
* | | usb: dwc3: gadget: Prevent tx fifo resize before set configHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If device took longer than expected time queuing zlp in status stage host issues bus reset. As a result tx fifio resize happens at status stage of first control transfer after bus reset. This causes null pointer dereference for config pointer as device is not in configured state yet. Hence clear the resize_fifos flag upon bus reset to avoid this situation. Also add NULL check in dwc3_gadget_resize_tx_fifos(). CRs-Fixed: 747688 Change-Id: Icd50eaa15f75c1b0bd7e2f8db5550ad54af47ef8 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | dwc3: gadget: Clear per endpoint ring buffer when disabling endpointMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code is not clearing ring buffer once it is being initialized. Issue is seen where xferinprogress interrupt is received with isochronous endpoint due to stale TRB (for isochronous endpoint we are using LINK TRB), we enqueue new request buffer using update transfer command. If stale TRB is having HWO bit being set, controller is trying to execute that particular TRB which results into error on bus as that request buffer is already being freed or used by other subsystem. Fix this issue by clearing per endpoint ring buffer when disabling endpoint. CRs-Fixed: 782340 Change-Id: I46e6a46400367d6ebf55bdb445a3330c0a4d77e1 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | USB: dwc3: Fix issues in isochronous endpoint handlingVijayavardhan Vennapusa2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there are no requests queued by function driver when XFRNRDY interrupt is recieved, pending flag will be set. Then if function driver queues request, don't queue ENDTXFR command and wait for XFRNRDY interrupt. START TRANSFER command will fail if the interval for which requests are being queued is already expired. Handle this case by queueing ENDXFER command and waiting till recieves XFRNRDY interrupt. Change-Id: I9498be3967e0f80b05cf0830affe5463f07e2976 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: Add error print messagesMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a possible race that arises when gadget events are processed before the resume routine has disabled the USB2 PHY autosuspend. Some of the gadget events issue endpoint commands which may time out since the PHY is still autosuspended. Add error messages to help debug these failurs. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | usb: dwc3: Adjust TX FIFO allocationJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize the dwc3_gadget_resize_tx_fifos() function to better allocate the per-endpoint FIFOs depending on a number of factors: - super- or non-super speed - bulk/isoc with bursting - reduced RAM (when QDSS uses some internal RAM) - endpoint enabled in composition Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc: Fix function wakeup during suspend on SW pathDanny Segal2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the SW wants to start USB traffic during USB bus suspend state, it needs to issue remote-wakeup signaling to the USB host before sending the function wakeup notification. This patch changes the function wakeup sending notification function to check whenter the USB bus is suspended and issue remote-wakeup if needed. CRs-Fixed: 678203 Change-Id: I1b09e7763c821a0a0e62095b4dc1c8621a2316b3 Signed-off-by: Danny Segal <dsegal@codeaurora.org>
* | | gadget: dwc: Support remote wakeup bit in GET_STATUS command in HS-USB modeDanny Segal2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | In High-Speed mode, the remote wakeup feature is enabled by a SET_FEATURE command sent from the host. This patch adds the logic reflect this configuration in the device GET_STATUS command response. Change-Id: I0c934d0330d2580f15b1307005dde7b4b7874a7d Signed-off-by: Danny Segal <dsegal@codeaurora.org>
* | | usb: dwc: add support for super-speed function suspendDanny Segal2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The USB 3.0 specification defines a new 'Function Suspend' feature. This feature enables the USB host to put inactive composite device functions in a suspended state even when the device itself is not suspended. This patch extends the existing framework of USB dwc driver to properly support the 'Function Resume' and 'Function Remote Wakeup' related features. Change-Id: If7bbfa7d6a4ff70d4b44ede5fc258370b890df47 Signed-off-by: Danny Segal <dsegal@codeaurora.org>
* | | usb: dwc3: gadget: allow running wakeup in delayed contextBar Weiner2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding the option of running the gadget wakeup function from the context in which it is called, or delaying it - in case it is called from an atomic context. This is required in order to support a case where the gadget is in lpm and the wakeup would result in a queue to the low-powered hardware. Change-Id: I09fc60e75c79202c97251146aab1539de3307424 Signed-off-by: Bar Weiner <bweiner@codeaurora.org> Signed-off-by: Danny Segal <dsegal@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | USB: dwc3: Add support for fixing superspeed enumeration issueVijayavardhan Vennapusa2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting SSPHY SUSP bit (bit 17) in GUSB3PIPECTL(0) register might cause device enumerating at high speed mode instead of superspeed mode on some platforms. Hence add workaround by clearing the SSPHY SUSP bit during disconnect and setting it after it is configured to fix this enumeration issue on those platforms. Also add support for disabling U1 and U2 low power modes which could also affect this enumeration issue. CRs-Fixed: 637902 Change-Id: I8668ced09a88b77f37265ab15e89fa9e964bfbe9 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> [jackp@codeaurora.org: only add u1/u2 disable bits] Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: add in_lpm flag to struct dwc3Bar Weiner2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change provides the gadget with awareness regarding the vendor-specific's low-power-mode status. This is done in order to enable proper decision making regarding cases where the gadget would potentially attempt to interface the hardware when it's in lpm. Change-Id: I1508fbddd13228fbb7d6d53d91d98a0acaaf3fd7 Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
* | | usb: dwc3: add support for pwr_event_irqBar Weiner2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for the pwr_event_irq in general, and for the L1_OUT pwr event specifically. The support consists of: 1. Enabling the pwr_event_irq based on the DT. 2. Adding a threaded irq handler as well as a centralized function (dwc3_pwr_event_handler()) for handling the various power events. 3. Enabling the L1_OUT pwr event. This is done on an arch-by-arch basis. The trigger for enabling this is dbm_l1_lpm_interrupt(). 4. Calling usb_gadget_wakeup() in order to initiate a wakeup sequence without sending a remote-wakeup indication to the host. 5. Adding a call from dwc3_msm_resume() to dwc3_pwr_event_handler(). This is done in order to overcome a situation where dwc3_msm_suspend() would have disabled the clocks, thereby disabling the ability to read the PWR_STAT register before calling the handler function. Change-Id: Ia548ec2e9ee4a7c6634c87ba24fe4cdbf1221000 Signed-off-by: Dov Levenglick <dovl@codeaurora.org> Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
* | | usb: dwc3: gadget: ignore suspend interrupt before connectDov Levenglick2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The controller sees a suspend event prior to the the cable connect or reset events. As a result, it runs through an unnecessary suspend sequence. Adding a check on the gadget's state avoids the overhead. The root cause of this appears to be a situation where the controller senses/is told that there is a VBUS, but the port reset is not forthcoming. In such a case, the line state is interpreted as suspend, and the event is generated. When VBUS detach is sensed/indicated, the state is returned to USB_STATE_NOTATTACHED, in preparation for the next cable connect. Change-Id: I639454ceb0ad3a8ff2c02d527c553a934b8639fc Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
* | | usb: dwc3: Add missing definesJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add bit definition for the GUSB2PHYCFG ENBLSLPM bit. Add definition for DWC3_GUCTL_REFCLKPER which is used to set the reference clock frequency. Also add definition for DWC3_GDBGLTSSM_LINKSTATE_MASK used to query the HW for the current LTSSM link state. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: gadget: allow remote-wakeup for SS-USBBar Weiner2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the restriction in the code that disables the possibility of device remote wakeup in SS-USB. Originally, this restriction was coded since suspend/resume in SS-USB is expected to be performed at the function level, rather than the device level. However, the suspend is currently done at the device level, and therefore the corresponding remote wakeup should also follow in suit. The concept of function suspend/resume may be revisited in the future. Change-Id: If071f38c03cf46290536cafad1a13a6818088eb7 Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
* | | usb: dwc3: Keep track of interrupt statisticsMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds debug support to log all received different events with endpoint0, other endpoints and gadget events. It tracks these events per endpoint and displays the same. For each of the endpoint event counters, add the rate (in Hz) at which it occurs in order to better analyze performance and aid in optimization. How to use: - Mount debugfs - To see received all dwc3 events/interrupts cat /sys/kernel/debug/<base_address>.dwc3/int_events - To clear all received dwc3 events/interrupts echo 0 > /sys/kernel/debug/<base_address>.dwc3/int_events Change-Id: Ibf5f3ee57f69c87f94f55a58f50792075be24fbb Signed-off-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | usb: dwc3: gadget: start resume sequence on remote-wakeupDov Levenglick2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per Synopsys databook, the USB controller does not trigger a wakeup event when remote-wakeup is used. Hence, after remote-wakeup sequence is complete, and the device is back at U0 state, it is required that the resume sequence is initiated manually by SW. Change-Id: I2f147d4a0644088b948b1798627c7717c35c0104 Signed-off-by: Bar Weiner <bweiner@codeaurora.org> Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
* | | usb: dwc3: gadget: Protect against ep disabling during completionJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dwc3_cleanup_done_reqs(), a potential race condition could arise when dwc3_gadget_giveback() temporarily releases the main spinlock. If during this window the very endpoint being handled becomes disabled, it would lead to a NULL pointer dereference in the code that follows. Guard against this by making sure the endpoint is still enabled after returning from the giveback call. CRs-fixed: 628972 Change-Id: Ifdb823fff12747f699217d871a5959c85b5340f7 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | dwc3: Disable USB Link state(U1/U2) change eventsMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently all USB Link state change events are enable which are triggering huge number of interrupts to the cpu. Disable U1/U2 Link state entry/exit events by using dwc_usb3_devten register. Below is one of test results showing the same. Test case: Run tethered RMNET UDP UL/DL Modem looback with 50M bandwidth Test duration: 120 seconds Test Results : - with USB Link state change events enable: CPU Idle : 42%, Number of USB Link state change events: 3769013 - with USB Link state change events disable: CPU Idle : 51%, Number of USB Link state change events: 0 These numbers (cpu usage, number of interrupts) are taken for 120 seconds duration of test execution. This change also does enable U3L2L1SuspEn event (BIT:6) to get U3 notification and handling suspend part. Wakeup event is already enabled which takes care of USB resuming. CRs-Fixed: 610718 Change-Id: Ied6da6699849a3136a35de0b9a27ee18086daeab Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | usb: dwc3: Stop processing more events after erratic errorJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In rare cases if the controller is unable to communicate with the PHY it will trigger an ERRATIC ERROR event, upon which it is recommended that the controller be reset. Currently the reset is scheduled to be performed in a workqueue, which relinquishes the dwc3_interrupt thread to continue to process the event buffer. Meanwhile if the reset runs concurrently, it would disable the core clock, which would result in unclocked I/O access if the gadget interrupt handling continues to run. Fix this by stopping the interrupt thread and prevent further interrupts from reading DWC3 registers until the reset sequence has completed. Change-Id: Ib9a2173867d2ce3c9dbc5f5cbff0dda554168b35 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: gadget: Handle erratic error event only onceJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWC3 databook suggests that upon receiving erratic error event software should reset the controller. The way in which the driver currently handles interrupts by offloading event processing to a threaded handler could result in a long sequence of received erratic errors in the event queue. dwc3_gadget_interrupt() could then end up processing a large number of the same event unnecessarily. In the case of dwc3-msm, this results in KERN_INFO messages flooding the console. Fix this by only handling erratic error once. Add a state variable to keep track of when it is seen, and clear it once a non-error event is processed. Change-Id: I5deeb2a614f9002867472a0e4aa26a61f0413ceb Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: gadget: Ensure core is not suspended when handling interruptJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since dwc3_thread_interrupt is part of interrupt handling that can be scheduled to run in thread context, it leaves open a window in which the controller might be placed into low power mode. In this state, clocks would be disabled, and by the time dwc3_thread_interrupt runs, would result in an unclocked I/O access when it tries to write to the GEVNTCOUNT register. Prevent this by calling pm_runtime_get() in dwc3_interrupt() in order to force the device to remain in active state, which increments the parent device's child count so that it too is prevented from entering suspend. Call pm_runtime_put() at the end of dwc3_thread_interrupt() after finishing processing the event buffers. CRs-fixed: 609233 CRs-fixed: 622850 Change-Id: Ia21c9ac74d74833a889081f41c93acec2a7ae011 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: Enable newer refclk-based SOF/ITP generationJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for refclk-based SOF and ITP generation, which is present on DWC3 cores starting in revision 2.50a. This supersedes the functionality provided by GCTL.SOFTITPSYNC which handled ITP generation only. This introduces the new GFLADJ register and writes its fields based on the reference clock period to the core, which can now be specified as a device tree parameter. Change-Id: I2c57586cd8b5275b77ebe64cf0835617f0340b62 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: core: Allow platform glue driver to handle PMManu Gautam2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWC3 platform glue driver on some targets is responsible for dealing with power management. They might even implement runtime suspend for DWC3 and want to keep devices in suspend during system PM state transitions. Also, DWC3 core driver doesn't implement runtime PM and carries out hardware read write operations assuming it is never put in LPM and clocks would always be ON. Hence, for platforms which implement aggressive power management of DWC3 from its glue driver, make core's PM ops as NO-OP and just notify them of the core PM states using callback. Change-Id: If82913ebe753236682e31ab351c991c3f855b2f1 Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
* | | USB: dwc3: Implement revised initialization sequenceJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revise initialization and power-on routines to be more consistent with recommended sequences. Since some of the same sequences are repeated during USB cable reconnection and exiting from power collapse, consolidate these into common routines to avoid duplicated code. Also don't perform controller and PHYs soft reset as they may result in unknown flip-flop state resulting in undefined issues. Soft reset is not required as Controller and PHY are reset using GCC anyway. Change-Id: I99856ac2ff01daa75b7e6d5a584c1b314402aa03 Signed-off-by: Mayank Rana <mrana@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | USB: dwc3: gadget: Reset device core before setting Run/stop bitWesley Cheng2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cable is disconnected, SW does device initiated disconnect by clearing run/stop bit in DCTL register. When software wants to reconnect to host, it has to do soft reset USB core and then do device reinitialization. By default max burst size for for control endpoints are initialized to zero. This leads to setting burst size to non zero value for control endpoints as part of reenabling endpoint 0 and 1 which results in command queued for ep0 out getting timed out. Hence fix this by initializing burst size to one in udc_start() API. CRs-Fixed: 494807 Change-Id: I0a23ae8bc80932f9f66f792a1149ad5d8ac7d4a2 Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
* | | usb: dwc3: Set elastic buffer modeJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a device tree property to allow setting the GUSB3PIPECTRL Elastic Buffer Mode (bit 0). By default set the buffer to half-full to work around SuperSpeed link errors. If the property is set, set the buffer to be nominally empty. This change is a combination of two previous commits: USB: dwc3: core: Set elastic buffer mode to zero Currently elastic buffer mode in GUSB3PIPE_CTRL(0) register is set to one. This results in high link error rates and superspeed mode transfer failures if VDDCX is at super turbo mode voltage 1.05V. Hence set elastic buffer mode to zero in GUSB3PIP_CTRL register. usb: dwc3: Do not set half-full elastic buffer On some platforms setting of half-full elastic buffer will cause data corruption and hence we need to avoid this setting. Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | USB: dwc3: Add debug support for DWC3 driverVijayavardhan Vennapusa2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for DWC3 driver to dump requests in SW queue list, requests queued to USB HW and trb list as well. Also add support for logging endpoint events through debugfs. Enable logging of EP0 control events by default. Example: To capture 2 in endpoint events echo -n 4 > /sys/module/dwc3/parameters/ep_addr_txdbg_mask To capture 3 out endpoint events echo -n 8 > /sys/module/dwc3/parameters/ep_addr_rxdbg_mask To print debug log events on endpoints cat /sys/kernel/debug/dwc3/events To dump requests in SW queue list for 6 out endpoint echo 6 0 > /sys/kernel/debug/dwc3/requests cat /sys/kernel/debug/dwc3/requests To dump requests queued to USB HW for 8 in endpoint echo 8 1 > /sys/kernel/debug/dwc3/queued_reqs cat /sys/kernel/debug/dwc3/queued_reqs To dump TRBs for 9 in endpoint echo 9 1 > /sys/kernel/debug/dwc3/trbs cat /sys/kernel/debug/dwc3/trbs Change-Id: I84e963b8299a1af76de9a35a6ea46ec34b9fe79e Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: Expose dwc3_trb_dma_offsetJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | Expose this function for use in the glue layer. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: gadget: Fail request submission if it was already queuedManu Gautam2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Function driver should not try to queue a busy request again to DCD until DCD returns it by calling its completion handler or it is explicitly dequeued. Some buggy function driver may try to submit a request again which is with DCD resulting in corruption of request_list leading to crash later in giveback. Catch such conditions and fail the request submission to DCD. CRs-Fixed: 447192 Change-Id: Id2a4a1720f61dffc50cc22598734f229caf07ff3 Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
* | | usb: dwc3: gadget: Introduce endless endpointsMayank Rana2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 3 different transport used for BAM communication and each BAM pipe can be BAM2BAM or SYS2BAM configuration. Currently all different per endpoint related interrupts/events are enabled with USB controller for this configuration. Hence although data transfer is happening through BAM hardware accerlation path, APPS is receiving interrupt for each completion from USB controller. This change binds property with each endpoint if it is being used in BAM2BAM mode, and enables required interrupts with USB controller. This significantly reduces number of interrupts received on APPS with keeping CPU idle in all tethered calls. Change-Id: I0185606f93996bf7a8c3f9451950b7c4cf9e21c7 Signed-off-by: Mayank Rana <mrana@codeaurora.org> [jackp@codeaurora.org: renamed subject, omitted u_bam.c and u_bam_data.c] Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: phy: msm: Use regulator_set_load()Jack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | regulator_set_optimum_mode() was renamed regulator_set_load(). Update the USB PHY drivers. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: phy: add snapshot of phy-msm driversJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a snapshot of phy-msm-{hsusb,ssusb,ssusb-qmp,qusb}.c taken as of msm-3.18 commit 9da4ddc18727 (Merge "clk: msm: clock-gcc: Associate gfx rail voting with gfx3d branch") Also replaced ARCH_MSM dependency with ARCH_QCOM in the Kconfig. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: phy: Add new OTG state OTG_STATE_B_SUSPENDEDHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This state is used to handle:- - Bus suspend followed by cable disconnect: pm usage count is incremented upon cable connect. Upon bus suspend, suspend interrupt kicks in otg state machine which moves device state to OTG_STATE_B_SUSPENDED from OTG_STATE_B_PERIPHERAL and decrements pm usage count. Upon cable unplug additional decrement of pm usage count is prevented. This state also takes care the handling of cable unplug followed by bus suspend interrupt. - Host initiated resume after bus suspend: Being in OTG_STATE_B_SUSPENDED after bus suspend, upon host initiated resume, wakeup interrupt kicks in otg state machine which moves device to OTG_STATE_B_PERIPHERAL state by incrementing pm usage count. - PC reboot with cable plugged in: After PC shutdown device goes to OTG_STATE_B_SUSPENDED state. After PC start power event irq thread kicks in otg state machine to move device to OTG_STATE_B_PERIPHERAL state and increments pm usage count. - Composition switch after bus suspend: dwc3_gadget_pullup() kicks in otg state machine to move device state from OTG_STATE_B_SUSPENDED to OTG_STATE_B_PERIPHERAL and increments pm usage count to prevent runtime suspend during device enumeration. Also, remove pm_runtime_set_active() which sets the PM runtime stauts as active to avoid pm_runtime_get_sync() failures which explicitly checks for runtime pm status. For example, if status is active, pm_runtime_get_sync() will just increments the counter without actually resuming the device. Change-Id: Id33b81911ef3894a00802b3e553840b9447f6269 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> [jackp@codeaurora.org: cherry-pick only phy.h and common.c] Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3-msm: Remove pmic_id_irqJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | irq_read_line() is no longer supported. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3-msm: Adapt to new power_supply interfaceJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [devm_]power_supply_register() was updated to receive power_supply_desc and power_supply_config parameters and returns a created power_supply object. Update dwc3-msm.c to conform. Also replace calls to custom power_supply_set_* functions with direct calls to power_supply_set_property(). Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3-msm: Compilation fixups for 4.4Jack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch includes a couple of fixups to compile against recent kernels: - replace CONFIG_PM_RUNTIME with CONFIG_PM - replace of_usb_get_dr_mode() with usb_get_dr_mode(). As a result it needs to be called after of_find_device_by_node() Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: dwc3: msm: Add snapshot of DWC3 MSM driversJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add dwc3-msm.c and associated driver files. Note these are based on the downstream implementation and will coexist (for the time being) with dwc3-qcom glue driver until they can eventually be merged. This snapshot is taken as of msm-3.18 commit a3883c356869 (Merge "input: touchscreen: correct condition checks in ITE tech touch driver") Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: gadget: f_gsi: Add support for configFSHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds APIs to allocate and instanciate multi instance gsi function driver using configFS. Add an entry in kconfig to select diag driver for configFS. This change fixes all compilation errors caused by moving gsi driver from android.c to compile independently. Change-Id: I0ddb2ca155fd29c6d58fb561cc197f8efee3495a Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: f_gsi: Use rndis params structureHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | rndis APIs are modified to pass rndis params structure instead of config index to load the rndis device parameters. Hence update the API calls in gsi driver. Change-Id: I1492752b315f57866ca39c6fe0021c4adce97c58 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: f_gsi: Configure fixed GSI endpoints and related EP OPsDevdutt Patnaik2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GSI endpoints are now fixed and need to be requested by name. As the specific GSI endpoints or ops do not change, it is not required to be updated on every connect/disconnect of the cable. This will also fix suspend/disconnect race conditions. Since GSI endpoints are fixed, gadget restart is no longer required upon composition switch. CRs-Fixed: 946385 Change-Id: I36de64ea95470cb19eb3f084b518618a2fe9f0df Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | usb: gadget: Support endpoint allocation by ep nameDevdutt Patnaik2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement support for allocating an EP based on name. This allows a function driver to request an EP using an ep name string. This is useful to request GSI specific EPs. CRs-Fixed: 946385 Change-Id: Id38e6e1e3c2d82f440c0507d24f18f808dc3e4dc Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | usb: gadget: Add snapshot of GSI function driverHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a generic function driver that will handle all functions that support h/w acceleration to IPA over GSI. This snapshot is taken as of msm-3.18 commit 30b0c37abcd9cf0 (Merge "msm: vidc: add support to set low latency property to venus") Change-Id: I4f78a4a36727fec24b1c5481acd6d3122eeb9150 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | USB: Debug: Add centralized debug buffer for USB driversHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a centralized debug buffer which can log events from all USB drivers in gadget directory. This will help in debugging issue from first instance rather than enabling dynamic debug log and reproducing again. Change-Id: Id0285d30bf640a63d904f1dd02dcd061f1819359 Signed-off-by: Tarun Gupta <tarung@codeaurora.org> Signed-off-by: Azhar Shaikh <azhars@codeaurora.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: rndis: Add new rndis parametersHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add pkt_alignment_factor rndis parameter. This parameter along with max_pkt_per_xfer allow rndis function driver to aggregate more than one IP packets per transfer. This is done by calling newly added API rndis_set_pkt_alignment_factor(). Change-Id: Ic9c543c388f872452e708a3a26be4ae82b54c082 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>