aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
AgeCommit message (Collapse)AuthorFilesLines
2017-03-06usb: dwc3: gadget: Fix system suspend/resume on TI platformsRoger Quadros1-6/+1
On TI platforms (dra7, am437x), the DWC3_DSTS_DEVCTRLHLT bit is not set after the device controller is stopped via DWC3_DCTL_RUN_STOP. If we don't disconnect and stop the gadget, it stops working after a system resume with the trace below. There is no point in preventing gadget disconnect and gadget stop during system suspend/resume as we're going to suspend in any case, whether DEVCTRLHLT timed out or not. [ 141.727480] ------------[ cut here ]------------ [ 141.732349] WARNING: CPU: 1 PID: 2135 at drivers/usb/dwc3/gadget.c:2384 dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3] [ 141.744299] Modules linked in: usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore dwc3 evdev udc_core m25p80 usb_common spi_nor snd_soc_davinci_mcasp snd_soc_simple_card snd_soc_edma snd_soc_tlv3e [ 141.792163] CPU: 1 PID: 2135 Comm: irq/456-dwc3 Not tainted 4.10.0-rc8 #1138 [ 141.799547] Hardware name: Generic DRA74X (Flattened Device Tree) [ 141.805940] [<c01101b4>] (unwind_backtrace) from [<c010c31c>] (show_stack+0x10/0x14) [ 141.814066] [<c010c31c>] (show_stack) from [<c04a0918>] (dump_stack+0xac/0xe0) [ 141.821648] [<c04a0918>] (dump_stack) from [<c013708c>] (__warn+0xd8/0x104) [ 141.828955] [<c013708c>] (__warn) from [<c0137164>] (warn_slowpath_null+0x20/0x28) [ 141.836902] [<c0137164>] (warn_slowpath_null) from [<bf27784c>] (dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3]) [ 141.848329] [<bf27784c>] (dwc3_stop_active_transfer.constprop.4 [dwc3]) from [<bf27ab14>] (__dwc3_gadget_ep_disable+0x64/0x528 [dwc3]) [ 141.861034] [<bf27ab14>] (__dwc3_gadget_ep_disable [dwc3]) from [<bf27c27c>] (dwc3_gadget_ep_disable+0x3c/0xc8 [dwc3]) [ 141.872280] [<bf27c27c>] (dwc3_gadget_ep_disable [dwc3]) from [<bf23b428>] (usb_ep_disable+0x11c/0x18c [udc_core]) [ 141.883160] [<bf23b428>] (usb_ep_disable [udc_core]) from [<bf342774>] (disable_ep+0x18/0x54 [usb_f_ss_lb]) [ 141.893408] [<bf342774>] (disable_ep [usb_f_ss_lb]) from [<bf3437b0>] (disable_endpoints+0x18/0x50 [usb_f_ss_lb]) [ 141.904168] [<bf3437b0>] (disable_endpoints [usb_f_ss_lb]) from [<bf343814>] (disable_source_sink+0x2c/0x34 [usb_f_ss_lb]) [ 141.915771] [<bf343814>] (disable_source_sink [usb_f_ss_lb]) from [<bf329a9c>] (reset_config+0x48/0x7c [libcomposite]) [ 141.927012] [<bf329a9c>] (reset_config [libcomposite]) from [<bf329afc>] (composite_disconnect+0x2c/0x54 [libcomposite]) [ 141.938444] [<bf329afc>] (composite_disconnect [libcomposite]) from [<bf23d7dc>] (usb_gadget_udc_reset+0x10/0x34 [udc_core]) [ 141.950237] [<bf23d7dc>] (usb_gadget_udc_reset [udc_core]) from [<bf276d70>] (dwc3_gadget_reset_interrupt+0x64/0x698 [dwc3]) [ 141.962022] [<bf276d70>] (dwc3_gadget_reset_interrupt [dwc3]) from [<bf27952c>] (dwc3_thread_interrupt+0x618/0x1a3c [dwc3]) [ 141.973723] [<bf27952c>] (dwc3_thread_interrupt [dwc3]) from [<c01a7ce8>] (irq_thread_fn+0x1c/0x54) [ 141.983215] [<c01a7ce8>] (irq_thread_fn) from [<c01a7fbc>] (irq_thread+0x120/0x1f0) [ 141.991247] [<c01a7fbc>] (irq_thread) from [<c015ba14>] (kthread+0xf8/0x138) [ 141.998641] [<c015ba14>] (kthread) from [<c01078f0>] (ret_from_fork+0x14/0x24) [ 142.006213] ---[ end trace b4ecfe9f175b9a9c ]--- Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-03-06usb: dwc3: Fix incorrect type for utmi modeFranck Demathieu1-1/+1
The utmi mode is unsigned according the dt-bindings. Fix sparse issue (-Wtypesign): drivers/usb/dwc3/dwc3-omap.c:391:50: warning: incorrect type in argument 3 (different signedness) drivers/usb/dwc3/dwc3-omap.c:391:50: expected unsigned int [usertype] *out_value drivers/usb/dwc3/dwc3-omap.c:391:50: got int *<noident> Signed-off-by: Franck Demathieu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-03-06usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeueFelipe Balbi1-0/+63
If request was already started, this means we had to stop the transfer. With that we also need to ignore all TRBs used by the request, however TRBs can only be modified after completion of END_TRANSFER command. So what we have to do here is wait for END_TRANSFER completion and only after that jump over TRBs by clearing HWO and incrementing dequeue pointer. Note that we have 2 possible types of transfers here: i) Linear buffer request ii) SG-list based request SG-list based requests will have r->num_pending_sgs set to a valid number (> 0). Linear requests, normally use a single TRB. For each of these two cases, if r->unaligned flag is set, one extra TRB has been used to align transfer size to wMaxPacketSize. All of these cases need to be taken into consideration so we don't mess up our TRB ring pointers. Tested-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-03-06usb: dwc3: gadget: make Set Endpoint Configuration macros safeFelipe Balbi1-7/+7
Some gadget drivers are bad, bad boys. We notice that ADB was passing bad Burst Size which caused top bits of param0 to be overwritten which confused DWC3 when running this command. In order to avoid future issues, we're going to make sure values passed by macros are always safe for the controller. Note that ADB still needs a fix to *not* pass bad values. Cc: <[email protected]> # v3.2+ Reported-by: Mohamed Abbas <[email protected]> Sugested-by: Adam Andruszak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-26Merge tag 'usb-for-v4.11' of ↵Greg Kroah-Hartman6-62/+197
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: USB: changes for v4.11 Here's the big pull request for the Gadget API. Again the majority of changes sit in dwc2 driver. Most important changes contain a workaround for GOTGCTL being wrong, a sleep-inside-spinlock fix and the big series of cleanups on dwc2. One important thing on dwc3 is that we don't anymore need gadget drivers to cope with unaligned OUT transfers for us. We have support for appending one extra chained TRB to align transfer ourselves. Apart from these, the usual set of typos, non-critical fixes, etc.
2017-01-26usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisionsFelipe Balbi1-3/+18
dwc3 revisions <=3.00a have a limitation where Port Disable command doesn't work. Set the quirk-broken-port-ped property for such controllers so XHCI core can do the necessary workaround. [[email protected]] Updated code from platform data to device property. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-25usb: dwc3: gadget: read IN ep FIFO size from HWFelipe Balbi1-0/+38
Instead of assuming all IN endpoints support 1024 bytes, let's read the actual value from HW and pass that to gadget API. Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: gadget: skip Set/Clear Halt when invalidFelipe Balbi1-0/+5
At least macOS seems to be sending ClearFeature(ENDPOINT_HALT) to endpoints which aren't Halted. This makes DWC3's CLEARSTALL command time out which causes several issues for the driver. Instead, let's just return 0 and bail out early. Cc: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: ep0: Fix the possible missed request for handling delay STATUS phaseBaolin Wang1-0/+14
When handing the SETUP packet by composite_setup(), we will release the dwc->lock. If we get the 'USB_GADGET_DELAYED_STATUS' result from setup function, which means we need to delay handling the STATUS phase. But during the lock release period, maybe the request for handling delay STATUS phase has been queued into list before we set 'dwc->delayed_status' flag or entering 'EP0_STATUS_PHASE' phase, then we will miss the chance to handle the STATUS phase. Thus we should check if the request for delay STATUS phase has been enqueued when entering 'EP0_STATUS_PHASE' phase in dwc3_ep0_xfernotready(), if so, we should handle it. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: omap: Replace the extcon APIChanwoo Choi1-13/+7
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Cc: [email protected] Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: gadget: align transfers to wMaxPacketSizeFelipe Balbi2-8/+63
Instead of passing quirk_ep_out_aligned_size, we can use one extra TRB to align transfer to wMaxPacketSize. Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: gadget: allocate bounce buffer for unaligned xfersFelipe Balbi2-2/+17
Allocate a coherent buffer of 1024 bytes (size of a single superspeed bulk packet) to serve as bounce buffer for an extra TRB needed to align transfers to wMaxPacketSize. Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: gadget: extract __dwc3_prepare_one_trb()Felipe Balbi1-22/+36
This new internal function will be used to solve a minor issue with dwc3 which exists in regards to short packets with OUT endpoints. Currently we're asking gadget driver to *always* send us aligned requests; however if we have enough TRBs we can easily append one extra TRB chained to the previous and keep a throw away 1024 byte buffer around for that. The actual fix will come in a separate patch, this is merely in preparation for such fix. Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: gadget: simplify dwc3_prepare_one_trb()Felipe Balbi1-17/+5
We are already passing struct dwc3_request * to dwc3_prepare_one_trb(), because of that there's no need to extract dma address and length in the caller. We can let dwc3_prepare_one_trb() itself handle that part. This simplifies the prototype of the function by removing two arguments. Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: exynos: Remove MODULE_ALIAS()Javier Martinez Canillas1-1/+0
Exynos is DT-only, so there's no need for a platform MODALIAS. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc3: exynos remove suspend clock unspecified debug messageShuah Khan1-3/+1
dwc3-exynos prints debug message when suspend clock is not specified. The suspend clock is optional and driver can work without it. This debug message doesn't add any value and leads to confusion and concern. Remove it. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-12usb: dwc3: exynos fix axius clock error path to do cleanupShuah Khan1-1/+3
Axius clock error path returns without disabling clock and suspend clock. Fix it to disable them before returning error. Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-03usb: dwc3: gadget: Fix full speed modeRoger Quadros2-7/+4
DCFG.DEVSPD == 0x3 is not valid and we need to set DCFG.DEVSPD to 0x1 for full speed mode. Same goes for DSTS.CONNECTSPD. Old databooks had 0x3 for full speed in 48MHz mode for USB1.1 transceivers which was never supported. Newer databooks don't mention 0x3 at all. Cc: John Youn <[email protected]> Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: pci: add Intel Gemini Lake PCI IDHeikki Krogerus1-0/+2
Intel Gemini Lake SoC has the same DWC3 than Broxton. Add the new ID to the supported Devices. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: pci: Add "linux,sysdev_is_parent" propertyJohn Youn1-10/+3
Calling platform_device_add_properties() replaces existing properties so the "linux,sysdev_is_parent" property doesn't get set. Add this property to each platform. Fixes: d64ff406e51e ("usb: dwc3: use bus->sysdev for DMA configuration") Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: omap: fix race of pm runtime with irq handler in probeGrygorii Strashko1-2/+4
Now races can happen between interrupt handler execution and PM runtime in error handling code path in probe and in dwc3_omap_remove() which will lead to system crash: in probe: ... err1: pm_runtime_put_sync(dev); ^^ PM runtime can race with IRQ handler when deferred probing happening due to extcon pm_runtime_disable(dev); return ret; in dwc3_omap_remove: ... dwc3_omap_disable_irqs(omap); ^^ IRQs are disabled in HW, but handler may still run of_platform_depopulate(omap->dev); pm_runtime_put_sync(&pdev->dev); ^^ PM runtime can race with IRQ handler pm_runtime_disable(&pdev->dev); return 0; So, OMAP DWC3 IRQ need to be disabled before calling pm_runtime_put() in probe and in dwc3_omap_remove(). Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Grygorii Strashko <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: skip interrupt when ep disabledJanusz Dziedzic1-3/+8
In case EP disabled pass only EPCPLT command to be handled. In other case we could hit Bug like below. BUG: unable to handle kernel NULL pointer dereference at 0000000000000003 IP: [<ffffffff81673428>] dwc3_thread_interrupt+0x11c8/0x1790 while dep->endpoint.desc is NULL. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: pci: Fix dr_mode misspellingHans de Goede1-1/+1
usb_get_dr_mode() expects the device-property to be spelled "dr_mode" not "dr-mode". Spelling it properly fixes the following warning showing up in dmesg: [ 8704.500545] dwc3 dwc3.2.auto: Configuration mismatch. dr_mode forced to gadget Signed-off-by: Hans de Goede <[email protected] Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: core: avoid Overflow eventsFelipe Balbi1-3/+1
Now that we're handling so many transfers at a time and for some dwc3 revisions LPM events *must* be enabled, we can fall into a situation where too many events fire and we start receiving Overflow events. Let's do what XHCI does and allocate a full page for the Event Ring, this will avoid any future issues. Cc: <[email protected]> # v4.9 Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: gadget: always unmap EP0 requestsFelipe Balbi1-4/+4
commit 0416e494ce7d ("usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced") introduced a bug where we would leak DMA resources which would cause us to starve the system of them resulting in failing DMA transfers. Fix the bug by making sure that we always unmap EP0 requests since those are *always* mapped. Fixes: 0416e494ce7d ("usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced") Cc: <[email protected]> Tested-by: Tomasz Medrek <[email protected]> Reported-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb()Felipe Balbi1-13/+15
Let's call dwc3_ep0_prepare_one_trb() explicitly because there are occasions where we will need more than one TRB to handle an EP0 transfer. A follow-up patch will fix one bug related to multiple-TRB Data Phases when it comes to mapping/unmapping requests for DMA. Cc: <[email protected]> Reported-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb()Felipe Balbi1-10/+16
For now this is just a cleanup patch, no functional changes. We will be using the new function to fix a bug introduced long ago by commit 0416e494ce7d ("usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced") and further worsened by commit c0bd5456a470 ("usb: dwc3: ep0: handle non maxpacket aligned transfers > 512") Cc: <[email protected]> Reported-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-12-14Merge branch 'for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial updates from Jiri Kosina. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: NTB: correct ntb_spad_count comment typo misc: ibmasm: fix typo in error message Remove references to dead make variable LINUX_INCLUDE Remove last traces of ikconfig.h treewide: Fix printk() message errors Documentation/device-mapper: s/getsize/getsz/
2016-12-14treewide: Fix printk() message errorsMasanari Iida1-1/+1
This patch fix spelling typos in printk and kconfig. Signed-off-by: Masanari Iida <[email protected]> Acked-by: Randy Dunlap <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2016-11-18Merge tag 'usb-for-v4.10' of ↵Greg Kroah-Hartman15-726/+1060
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v4.10 merge window One big merge this time with a total of 166 non-merge commits. Most of the work, by far, is on dwc2 this time (68.2%) with dwc3 a far second (22.5%). The remaining 9.3% are scattered on gadget drivers. The most important changes for dwc2 are the peripheral side DMA support implemented by Synopsys folks and support for the new IOT dwc2 compatible core from Synopsys. In dwc3 land we have support for high-bandwidth, high-speed isochronous endpoints and some non-critical fixes for large scatter lists. Apart from these, we have our usual set of cleanups, non-critical fixes, etc.
2016-11-18usb: dwc3: Do not set dma coherent maskArnd Bergmann2-11/+0
The dma mask is correctly set up by the DT probe function, no need to override it any more. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Sriram Dash <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: use bus->sysdev for DMA configurationArnd Bergmann6-43/+54
The dma ops for dwc3 devices are not set properly. So, use a physical device sysdev, which will be inherited from parent, to set the hardware / firmware parameters like dma. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Sriram Dash <[email protected]> Tested-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: ep0: avoid empty-body warningArnd Bergmann1-6/+7
Building with W=1, we get a warning about harmless empty statements: drivers/usb/dwc3/ep0.c: In function 'dwc3_ep0_handle_intf': drivers/usb/dwc3/ep0.c:491:4: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] Instead of adding empty braces which would introduce checkpatch.pl warnings, we're just removing the code which doesn't do anything and making sure we return 0 so USBCV tool is happy. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: pci: avoid build warningFelipe Balbi1-24/+26
dwc3_pci_dsm() is only needed if (PM || PM_SLEEP), we should make sure it's not defined if neither of those is defined. This fixes a randconfig build warning. Acked-by: Arnd Bergmann <[email protected]> Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: Workaround for irq mask issueJohn Youn1-0/+11
This is a workaround for STAR 9000961433 which affects only version 3.00a of the DWC_usb3 core. This prevents the controller interrupt from being masked while handling events. Enabling interrupt moderation allows us to work around this issue because once the GEVNTCOUNT.count is written the IRQ is immediately deasserted and won't be asserted again until GEVNTCOUNT.EHB is cleared. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: Implement interrupt moderationJohn Youn3-0/+47
Implement interrupt moderation which allows the interrupt rate to be throttled. To enable this feature the dwc->imod_interval must be set to 1 or greater. This value specifies the minimum inter-interrupt interval, in 250 ns increments. A value of 0 disables interrupt moderation. This applies for DWC_usb3 version 3.00a and higher and for DWC_usb31 version 1.20a and higher. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: gadget: clear events in top-half handlerJohn Youn1-2/+2
Now that all the infrastructure is in place, we can clear events in the top-half handler in order to bring IRQ line low ASAP. This is also a necessary step in order to implement workaround for known erratum in follow-up patches. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: gadget: use evt->cache for processing eventsJohn Youn1-1/+8
Let's start copying events from evt->buf to evt->cache and use evt->cache for processing events. A follow-up patch will be added to clear events in the top-half handler in order to bring IRQ line low as soon as possible. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: gadget: use evt->length as we shouldFelipe Balbi1-1/+1
Instead of always accessing the macro directly, let's rely on evt->length which is the actual length of current event buffer. While unlikely, we could change event buffer's size at any time. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: core: add a event buffer cacheJohn Youn2-0/+6
This extra buffer will be used so we can copy triggered events from our event buffer to this cache and process all of them later in bottom half handler. We need this in order to implement a workaround for a known erratum in recent DWC3 release. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: core: remove dwc3_soft_reset()Felipe Balbi1-39/+0
dwc3_soft_reset() is doing the same thing as dwc3_core_soft_reset(). Let's remove dwc3_soft_reset() since that's not needed anymore. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: Add a function to check propertiesJohn Youn1-26/+33
Add a function to check properties and call it from probe. This will allow us to add check code without bloating the probe function. This needs to be done after dwc3_get_properties() and dwc3_core_init() so that all the properties and hardware configs are available. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: Add a check for the DWC_usb3 coreJohn Youn1-0/+6
Add a helper function to check if we are running on a DWC_usb3 core. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: gadget: Fix dead code writing GCTL.RAMCLKSELJohn Youn1-27/+8
The register programming code in dwc2_updated_ram_clk_sel() will never be executed. And in fact the entire function can be removed as there is no way to override the default value of GCTL.RAMCLKSEL. Remove the function and add a comment explaining where GCTL.RAMCLKSEL should be programmed if needed in the future. This fixes dead code warnings in coverity. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: gadget: Remove descriptor arguments to ep_enableJohn Youn2-20/+25
The __dwc3_gadget_endpoint_enable() function has access to the endpoint descriptors via the usb_ep. So we don't need to pass them in as arguments. The descriptors should be set by the caller prior to calling usb_ep_enable(). Signed-off-by: John Youn <[email protected]> [[email protected] : minor improvements] Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: warn on once when no trbsJanusz Dziedzic1-1/+3
Seems last time we hit few issues where we get trb_left = 0, mainly because of HWO bit still set in previous TRB. Add warn on once to catch/fix such problems much faster. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: isoc clean DWC3_EP_PENDING_REQUEST flagJanusz Dziedzic1-0/+1
After we kick_transfer we should clean DWC3_EP_PENDING_REQUEST endpoint flag. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: fix post-incrementJanusz Dziedzic1-1/+1
Use pre-increment and set -ETIMEDOUT correctly. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: clean TRB if STARTTRANSFER failJanusz Dziedzic1-0/+2
In case STARTTRANSFER will fail, clean TRB. Seems HW in such case don't clean HWO bit. So, without this cleanup prev_trb still have HWO bit set. In my case (without patch), after first START failed: - dep->enqueue == 1 - dep->dequeue == 1 - prev_trb still have HWO set - left_trb() == 0 No way to send more data. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: decrement queued_requestsJanusz Dziedzic1-0/+1
In case we will fail to STARTTRANSFER we should also decrement queued_requests. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>