aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
Commit message (Collapse)AuthorAgeFilesLines
* usb: dwc3: Reset the transfer resource index on SET_INTERFACEJohn Youn2015-08-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit aebda618718157a69c0dc0adb978d69bc2b8723c upstream. This fixes an issue introduced in commit b23c843992b6 (usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs) that made sure we would only use DEPSTARTCFG once per SetConfig. The trick is that we should use one DEPSTARTCFG per SetConfig *OR* SetInterface. SetInterface was completely missed from the original patch. This problem became aparent after commit 76e838c9f776 (usb: dwc3: gadget: return error if command sent to DEPCMD register fails) added checking of the return status of device endpoint commands. 'Set Endpoint Transfer Resource' command was caught failing occasionally. This is because the Transfer Resource Index was not getting reset during a SET_INTERFACE request. Finally, to fix the issue, was we have to do is make sure that our start_config_issued flag gets reset whenever we receive a SetInterface request. To verify the problem (and its fix), all we have to do is run test 9 from testusb with 'testusb -t 9 -s 2048 -a -c 5000'. Tested-by: Huang Rui <ray.huang@amd.com> Tested-by: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com> Fixes: b23c843992b6 (usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs) Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> [bwh: Backported to 3.2: use dev_vdbg() instead of dwc3_trace()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: gadget: return error if command sent to DEPCMD register failsSubbaraya Sundeep Bhatta2015-08-121-0/+2
| | | | | | | | | | | | commit 76e838c9f7765f9a6205b4d558d75a66104bc60d upstream. We need to return error to caller if command is not sent to controller succesfully. Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com> Fixes: 72246da40f37 (usb: Introduce DesignWare USB3 DRD Driver) Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: core: fix order of PM runtime callsFelipe Balbi2014-11-051-3/+3
| | | | | | | | | | | | | | | | | | commit fed33afce0eda44a46ae24d93aec1b5198c0bac4 upstream. Currently, we disable pm_runtime before all register accesses are done, this is dangerous and might lead to abort exceptions due to the driver trying to access a register which is clocked by a clock which was long gated. Fix that by moving pm_runtime_put_sync() and pm_runtime_disable() as the last thing we do before returning from our ->remove() method. Fixes: 72246da (usb: Introduce DesignWare USB3 DRD Driver) Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: core: use pm_runtime_put_sync() on removeFelipe Balbi2014-11-051-1/+1
| | | | | | | | | | | commit 16b972a592ea2c9a3c2a3c12238de650fd4043a9 upstream. We are going to disable runtime_pm and we're removing the driver, we must disable the device now. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: fix wrong bit mask in dwc3_event_devtHuang Rui2014-04-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 06f9b6e59661cee510b04513b13ea7927727d758 upstream. Around DWC USB3 2.30a release another bit has been added to the Device-Specific Event (DEVT) Event Information (EvtInfo) bitfield. Because of that, what used to be 8 bits long, has become 9 bits long. Per dwc3 2.30a+ spec in the Device-Specific Event (DEVT), the field of Event Information Bits(EvtInfo) uses [24:16] bits, and it has 9 bits not 8 bits. And the following reserved field uses [31:25] bits not [31:24] bits, and it has 7 bits. So in dwc3_event_devt, the bit mask should be: event_info [24:16] 9 bits reserved31_25 [31:25] 7 bits This patch makes sure that newer core releases will work fine with Linux and that we will decode the event information properly on new core releases. [ balbi@ti.com : improve commit log a bit ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: fix implementation of endpoint wedgeAlan Stern2014-01-032-4/+3
| | | | | | | | | | | | | | | | commit a535d81c92615b8ffb99b7e1fd1fb01effaed1af upstream. The dwc3 UDC driver doesn't implement endpoint wedging correctly. When an endpoint is wedged, the gadget driver should be allowed to clear the wedge by calling usb_ep_clear_halt(). Only the host is prevented from resetting the endpoint. This patch fixes the implementation. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: add support for MerrifieldDavid Cohen2013-10-261-0/+2
| | | | | | | | | | commit 85601f8cf67c56a561a6dd5e130e65fdc179047d upstream. Add PCI id for Intel Merrifield Signed-off-by: David Cohen <david.a.cohen@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: pci: add support for BayTrailHeikki Krogerus2013-10-261-0/+2
| | | | | | | | | | commit b62cd96de3161dfb125a769030eec35a4cab3d3a upstream. Add PCI id for Intel BayTrail. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: fix wrong bit mask in dwc3_event_typeHuang Rui2013-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | commit 1974d494dea05ea227cb42f5e918828801e237aa upstream. Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the bit is 1, the event is represented Device-Specific Event, then use [7:1] bits as Device Specific Event to marked the type. It has 7 bits, and we can see the reserved8_31 variable name which means from 8 to 31 bits marked reserved, actually there are 24 bits not 25 bits between that. And 1 + 7 + 24 = 32, the event size is 4 byes. So in dwc3_event_type, the bit mask should be: is_devspec [0] 1 bit type [7:1] 7 bits reserved8_31 [31:8] 24 bits This patch should be backported to kernels as old as 3.2, that contain the commit 72246da40f3719af3bfd104a2365b32537c27d83 "usb: Introduce DesignWare USB3 DRD Driver". Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: gadget: don't prevent gadget from being probed if we failFelipe Balbi2013-08-021-0/+1
| | | | | | | | | | | | | | | commit cdcedd6981194e511cc206887db661d016069d68 upstream. In case we fail our ->udc_start() callback, we should be ready to accept another modprobe following the failed one. We had forgotten to clear dwc->gadget_driver back to NULL and, because of that, we were preventing gadget driver modprobe from being retried. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: gadget: free trb pool only from epnum 2George Cherian2013-06-191-3/+12
| | | | | | | | | | | | | | | | | commit 5bf8fae33d14cc5c3c53a926f9079f92c8b082b0 upstream. we never allocate a TRB pool for physical endpoints 0 and 1 so trying to free it (a invalid TRB pool pointer) will lead us in a warning while removing dwc3.ko module. In order to fix the situation, all we have to do is skip dwc3_free_trb_pool() for physical endpoints 0 and 1 just as we while deleting endpoints from the endpoints list. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: gadget: fix ep->maxburst for ep0Pratyush Anand2013-02-061-0/+1
| | | | | | | | | | | commit 6048e4c69d80600baba35856651056860d5d8f5a upstream. dwc3_gadget_set_ep_config expects maxburst as incremented by 1. So, by default initialize ep->maxburst to 1 for ep0. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: ep0: increment "actual" on bounced ep0 caseFelipe Balbi2012-05-111-1/+2
| | | | | | | | | | | | | | | commit cd423dd3634a5232a3019eb372b144619a61cd16 upstream. due to a HW limitation we have a bounce buffer for ep0 out transfers which are not aligned with MaxPacketSize. On such case we were not increment r->actual as we should. This patch fixes that mistake. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* usb: dwc3: use proper function for setting endpoint nameAnton Tikhomirov2012-04-021-4/+4
| | | | | | | | | | | | commit 27a78d6a283d6782438f72306746afe4bf44c215 upstream. It's wrong to use the size of array as an argument for strncat. Memory corruption is possible. strlcat is exactly what we need here. Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: dwc3: fix bogus test in dwc3_gadget_start_isocPaul Zimmerman2012-04-021-11/+5
| | | | | | | | | | | | commit 9bafa56c7cee5c6fa68de5924220abb220c7e229 upstream. Zero is a valid value for a microframe number. So remove the bogus test for non-zero in dwc3_gadget_start_isoc(). Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: dwc3: ep0: tidy up Pending Request handlingFelipe Balbi2012-02-031-10/+4
| | | | | | | | | | | | | | | | | commit 68d8a781575d7be490f97eb2c403fb13b083da6a upstream. The way our code was written, we should never have a DWC3_EP_PENDING_REQUEST flag set out of a Data Phase and the code in __dwc3_gadget_ep0_queue() did not reflect that situation properly. Tidy up that case to avoid any possible mistakes when starting requests for IRQs which are long gone. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: dwc3: core: fix cached revision on our structureFelipe Balbi2011-12-141-1/+1
| | | | | | | | | | | | All our revision macros are defined with the entire 32-bits which we read from GSNPSID register, so we must cache all 32-bits properly rather than masking the top 16-bits. This will fix all revision checks we have on current driver. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: initialize max_streamsSebastian Andrzej Siewior2011-11-141-0/+1
| | | | | | | | | | | Without this the gadget will never be able to allocate a stream capable endpoint. The manual says that the stream id is a 16bit id. It does not talk about an upper limit in any other way. So I think 15 is a reasonable limit :) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: Add module.h to various dwc3 driversPaul Gortmaker2011-10-042-0/+2
| | | | | | | | These files uses the full set of MODULE_ macros and so need to include module.h directly. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: convert structures into bitshiftsFelipe Balbi2011-10-043-137/+48
| | | | | | | | | our parameter structures need to be written to HW, so instead of assuming little endian, we convert those into bit shifts. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: allow clock gating to workFelipe Balbi2011-10-042-0/+14
| | | | | | | | | | The dwc3 core has internal clock gating support. Let's allow that to happen by clearing the disable bit in GCTL register. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: core: cache GHWPARAMS* registersFelipe Balbi2011-10-041-0/+17
| | | | | | | | cache the contents of GHWPARAMS* registers in our device structure for easy access. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: add struct dwc3_hwparamsFelipe Balbi2011-10-041-0/+26
| | | | | | | | | That structure will hold a copy of readonly GHWPARAMS* registers for ease accessing by the driver. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: implement streams supportFelipe Balbi2011-10-042-4/+36
| | | | | | | | | | | | | The following patch adds support for streams to dwc3 driver. While at that, also fix one small issue on endpoint disable where we should clear all flags not only ENABLED. Reviewied-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: add support for BurstsFelipe Balbi2011-10-041-0/+1
| | | | | | | | We already have the value from gadget drivers, just need to pass it to our controller. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: fix DMA offset calculationPaul Zimmerman2011-10-041-1/+1
| | | | | | | | Fix offset calculation in dwc3_trb_dma_offset() Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: make DWC3_EP_WEDGE do the right thingPaul Zimmerman2011-10-041-1/+5
| | | | | | | | | | | | | This makes DWC3_EP_WEDGE do the right thing, which is prevent DWC3_EP_WEDGE from ever being cleared by a ClearFeature(HALT) command. [ balbi@ti.com : allowed set_wedge to send SetHalt command to controller ] Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: driver should not wait for RxFIFO to drainPaul Zimmerman2011-10-041-19/+0
| | | | | | | | | | | | | | | An older version of the databook said to wait for the FIFO to drain, but that has been removed from the newer databooks. Waiting for RxFIFO to drain caused problems when testing against one of the host controllers available in the market. After talking to one of the RTL engineers, he stated that we should _not_ wait for RxFIFO to drain. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPsPaul Zimmerman2011-10-043-1/+12
| | | | | | | | | | DEPSTARTCFG for non-EP0 EPs must only be sent once per config [ balbi@ti.com : changed config_start to start_config_issued ] Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc: remove "All rights reserved" statement.Sebastian Andrzej Siewior2011-10-0410-10/+0
| | | | | | | | | | Some people think that this line is not compatible with the GPL. The statement was required due to the Buenos Aires Convention and is now deprecated. I remove it because it is said that it is pointless nowdays. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: ep0: fix debug outputSebastian Andrzej Siewior2011-10-041-1/+1
| | | | | | | | | Use "ep0in" and "ep0out" instead "ep1in" and "ep0out" which is confusing and not consistent with the remaining output. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: ep0: remove second giveback in error caseSebastian Andrzej Siewior2011-10-041-1/+0
| | | | | | | | | We already give requests back in dwc3_ep0_stall_and_restart() so doing it again here will most likely corrupt the list. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: ep0: fix debug messageFelipe Balbi2011-10-041-4/+4
| | | | | | | | The way it was before was really meaningless. Now it looks saner. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: ep0: ignore direction on 2-stage transferFelipe Balbi2011-10-041-4/+4
| | | | | | | | We don't need to care about direction on a two stage transfer. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: ep0: Make USB30CV happy with SetAddressFelipe Balbi2011-10-041-22/+9
| | | | | | | | | | | | | According to USB 3.0 Specification, a SetAddress() while device is in Configured State has an unspecified behavior (see Section 9.4.6). Still USB30CV wasn't happy with my Stall reply. To make that thing happy, just accept the SetAddress() always. No problems have been observed thus far. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: dwc3: gadget: improve debug on link state changeFelipe Balbi2011-09-091-2/+2
| | | | | | | | It's useful to know which states core is going through, as it might help us figure out misbehavior on specific link states. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: set idle and standby modesFelipe Balbi2011-09-091-0/+24
| | | | | | | For now, let's disable IDLE and STANDBY transitions until we have a real HW to validate against. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: introduce ep0_expect_in flagFelipe Balbi2011-09-092-0/+18
| | | | | | | | | | This flag will tell us which direction we're expecting on the next (data or status) phase. It will help us catching errors of host going crazy and requesting data of the wrong direction. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: giveback requests on stall_and_restartFelipe Balbi2011-09-091-0/+10
| | | | | | if we don't, the list will be busy forever. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: drop the useless dma_sync_single* callsFelipe Balbi2011-09-091-9/+0
| | | | | | | | if req->dma isn't DMA_ADDR_INVALID it means gadget driver mapped the request or allocated from coherent, so it's unnecessary to do anything. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: fix GCTL programmingFelipe Balbi2011-09-091-6/+3
| | | | | | | ensure a few bits are cleared before enabling what we need. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: define ScaleDown macro helperFelipe Balbi2011-09-091-0/+1
| | | | | | | We must ensure that those bits aren't set as they should only be used in simulation. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: Fix definition of DWC3_GCTL_U2RSTECNFelipe Balbi2011-09-091-1/+1
| | | | | | | that should be 1 << 16, not 16. Caused so many problems and we never caught it before. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: do not map/unmap ZLP transfersSebastian Andrzej Siewior2011-09-091-0/+10
| | | | | | | | | If the gadget drivers sends a ZLP we are trying to map this this request which does not work on all implementations. So we simply skip mapping it. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: fix IRQ handlingFelipe Balbi2011-09-091-27/+12
| | | | | | | In order to ACK the IRQ we must write back to the same register the bits we read. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: change IRQ name to dwc3-omapFelipe Balbi2011-09-091-1/+1
| | | | | | | | dwc3-wrapper can be used by any other wrapper, using dwc3-omap makes it clear that we're running on OMAP SoC. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: add module.h to dwc3-omap.c and core.cFelipe Balbi2011-09-092-0/+2
| | | | | | | We need that header because of THIS_MODULE. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: distinguish between SW and HW modesFelipe Balbi2011-09-091-0/+22
| | | | | | | | | | | | The OMAP wrapper allows us to either control internal OTG signals via SW or HW. Different boards might wish to use one or the other mode of operation. Let's have have that information passed via platform_data for now. After DT conversion is finished for OMAP, we can easily convert this to a DT attribute. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: drop DEV_PM_OPS for nowFelipe Balbi2011-09-091-41/+0
| | | | | | | | We need to have actual HW in order to implement and test that part of the code anyway. Until then it's best to remove it. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: use the macro we already haveFelipe Balbi2011-09-091-1/+2
| | | | | | trivial patch, no functional changes. Signed-off-by: Felipe Balbi <balbi@ti.com>