summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* usb: dwc3: omap: do not enable DMA Disable Clear IRQFelipe Balbi2011-09-091-2/+1
| | | | | | | Otherwise that IRQ will trigger forever. It's quite unnecessary. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: omap: fix dev_dbg() callsFelipe Balbi2011-09-091-10/+10
| | | | | | | dev_dbg() macro expects a device pointer as argument, not a memory base address. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: use ep0_next_event fieldFelipe Balbi2011-09-091-4/+36
| | | | | | | Start tracking the next expected event and act on the error conditions as suggested by databook. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: core: add ep0_next_event fieldFelipe Balbi2011-09-091-0/+10
| | | | | | | | | | this field will hold the next expected event. In certain cases, host might fall into some error condition and ask from us the wrong Control phase. On such situations, we should stall and restart. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: drop EP0_STALL stateFelipe Balbi2011-09-093-5/+8
| | | | | | | | | | | Whenever we issue a Set Stall command on EP0, the state machine will be restarted and Stall is cleared automatically, when core receives the next SETUP packet. There's no need to track that EP0_STALL state. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: clear all EP0 flagsFelipe Balbi2011-09-091-1/+1
| | | | | | | | when we're going to issue Set Stall command, we should clear DWC3_EP_STALL flag, but also we should clear BUSY, HALTED and all others. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: fix Get Status handlingFelipe Balbi2011-09-091-1/+1
| | | | | | | data was prepared on setup_buf but transfer was started on ctrl_req, fix it. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: replace mdelay with udelay in the busy loopSebastian Andrzej Siewior2011-09-091-8/+4
| | | | | | | | | | | | | | | | | | There are two spots where we wait until the HW finishes processing a certain command. Initially we had a few problems and we used 500ms as a limit to be on a the safe side. Paul Zimmerman mentioned this is little too much. After a debugging session, we noticed that we hardly ever go over 20us and didn't pass 30usec so far. Using mdelay() seems way overloaded. Giving the current numbers 500usec as the upper limit is more than enough. Should it ever timeout then something is definitely wrong. While here, also replace the type with u32 since long does not really fit here. Cc: Paul Zimmerman <paul.zimmerman@synopsys.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: gadget: rework the dequeue on RESET & DISCONNECTSebastian Andrzej Siewior2011-09-092-20/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - since a while we are disabling an endpoint and purging every requests on RESET and DISCONNECT which leads to a warning since the endpoint was disabled twice (once by the UDC, and second time by the gadget). I think UDC should nuke all requests because all those requests become invalid. It's gadget driver's responsability, though, to disable its used endpoints. This is done by merging dwc3_stop_active_transfer() and dwc3_gadget_nuke_reqs() into dwc3_remove_requests(). - dwc3_stop_active_transfer() is now no longer called unconditionaly. This has the advantage that it is always called to disable an active transfer which means if res_trans_idx 0 than something went wrong and it is an error condition because we can't clean up the requests. - Remove the DWC3_EP_WILL_SHUTDOWN which was introduced while introducing the command complete part for dequeue. All requests on req_queued list should be removed during the dwc3_cleanup_done_reqs() callback so there is no reason to go through the list again. We consider it an error condition if requests are still on this list since we never queue TRB without LST=1 (the last requests has always LST=1, there are no requests with LST=0 behind it). [ balbi@ti.com : reworked commit log a bit, made patch apply ] Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: core: move the core check before soft resetSebastian Andrzej Siewior2011-09-091-10/+9
| | | | | | | | | | We read the DWC3_GSNPSID register to make sure we got the correct register offset passed. One of the recent commits moved the soft reset before this so in case of the wrong offset we end up with "reset timed out". This patch moves the "id" check before the reset again. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: debugfs: remove test mode interfaceSebastian Andrzej Siewior2011-09-091-94/+0
| | | | | | | | | | | | | | | | | | There are some issues around for enabling/disabling this mode and handling it. It does not work perfectly (yet). However we have a few gadgets tested successfuly so far. That means we are quite confident that we won't need this in near future. So I'm for removing it and bringing a working version back once there is a need for it. Thanks to Dan Carpenter who spotted the wrong memory handling here. [ balbi@ti.com : made it actually apply ] Cc: Dan Carpenter <error27@gmail.com> Cc: wharms@bfs.de Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: simplify EP0 state machineFelipe Balbi2011-09-093-215/+163
| | | | | | | | | | | | | | | | | | | | The DesignWare USB3 core tells us which phase of a control transfer should be started, it also tells us which physical endpoint needs that transfer. With these two informations, we have all we need to simply EP0 handling quite a lot and get rid rid of the SW state machine tracking ep0 states. For achieving this perfectly, we needed to add support for situations where we get XferNotReady while endpoint is still busy and XferNotReady while gadget driver still hasn't queued a request. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: core: add flag for EP0 directionFelipe Balbi2011-09-091-0/+3
| | | | | | | Add a flag to keep track of ep0 direction. This flag will be used on a following patch. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: ep0: add handling for unaligned OUT transfersFelipe Balbi2011-09-091-5/+32
| | | | | | | | | | | In case we have transfers which aren't aligned to wMaxPacketSize, we need to be careful with how we start the transfer with the HW. OUT transfers _must_ be aligned with wMaxPacketSize and in order to guarantee that, we use a bounce buffer. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: add a bounce buffer for control endpointsFelipe Balbi2011-09-092-7/+28
| | | | | | | | | | | This core cannot handle OUT transfers which aren't aligned to wMaxPacketSize, but that can happen at least on control endpoint with the USB Audio Class. This patch adds a bounce buffer to be used on the case of a non-aligned ep0out request is queued. Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: dwc3: core: add defines for XferNotReady event on Control EPsFelipe Balbi2011-09-091-0/+6
| | | | | | | | | | The status field of the Transfer Not Read event is different on Control Endpoints. On this patch we are just adding the defines to be used on a later patch which will re-work the control endpoint handling. Signed-off-by: Felipe Balbi <balbi@ti.com>
OpenPOWER on IntegriCloud