aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/core.h
AgeCommit message (Collapse)Author
2012-06-25usb: dwc3: rename res_trans_idx to resource_indexFelipe Balbi
resource_index is more human readable. No functional changes. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-06usb: dwc3: Correct DWC3_DCTL_HIRD_THRES definitionPratyush Anand
The definition of DWC3_DCTL_HIRD_THRES macro is completely wrong. It will only work for when we want to read the register's contents for that bitfield. Change the macro so that it can be used to writing to the register, and when we need to read, we can add extra right shift of 24 bits. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> [ balbi@ti.com: add a commit log ] Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-04usb: dwc3: Fix missed isoc IN transactionPratyush Anand
If an IN transfer is missed on isoc endpoint, then driver must insure that next ep_queue is properly handled. This patch fixes this issue by starting a new transfer for next queued request. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-04USB: DWC3: Correct DWC3_DSTS_SOFFN_MASK definitionPratyush Anand
SOF Number is bit16:3 of DSTS. Correct the mask accordingly. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-04USB: DWC3: Correct DWC3_TRB_SIZE_TRBSTS definitionPratyush Anand
Correct define for DWC3_TRB_SIZE_TRBSTS. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-03usb: dwc3: add definitions for new registersPaul Zimmerman
This patch adds definitions for some new registers that have been added to later versions of the controller, up to v2.10a. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-07Merge tag 'dwc3-for-v3.5' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next usb: dwc3: patches for v3.5 merge window This pull request contains one workaround for a Silicon Issue found on all RTL releases prior to 2.20a, which would cause a metastability state on Run/Stop bit. We also have some patches implementing a few extra Standard requests introduced by USB3 spec (Set SEL and Set Isoch Delay), as well as one patch, which has been pending for a long time, implementing LPM support. Last, but not least, we are splitting the host address space out of the dwc3 core driver otherwise xHCI won't be able to request_mem_region() its own address space. This patch is only needed because we are (as we should) re-using the xHCI driver, which is a completely separate module. Together with these three big changes, come a few extra preparatory patches which most move code around, define macros and so on, as well as a fix for Isochronous transfers which hasn't been triggered before. [ resolved conflicts and build error in drivers/usb/dwc3/gadget.c - gregkh]
2012-05-04usb: dwc3: Update dwc3 udc to use usb_endpoint_descriptor inside the struct ↵Ido Shayevitz
usb_ep Remove redundant pointer to struct usb_endpoint_descriptor. Signed-off-by: Ido Shayevitz <idos@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-04usb: dwc3: define DWC3_EP0_BOUNCE_SIZEdwc3-for-v3.5Felipe Balbi
to avoid sprinkling magic constants on the driver we define a constant to be used when allocating setup_buffer and ep0_bounce buffer. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-02usb: dwc3: ep0: implement support for Set Isoch Delay requestFelipe Balbi
This is basically a noop for DWC3. We don't have to do anything. Basically we test if the request parameters are correct, cache the Isochronous Delay and return success. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-02usb: dwc3: ep0: implement Set SEL supportFelipe Balbi
This patch implements Set SEL Standard Request support for dwc3 driver. It needs to issue a command to the controller passing the timing we received on the data phase of the Set SEL request. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-02usb: dwc3: gadget: implement Global Command supportFelipe Balbi
This will be used by the ep0 layer for implementing Set SEL Standard Request. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-04-30usb: dwc3: ep0: add LPM handlingSebastian Andrzej Siewior
On device loading the driver enables LPM and the acceptance of U1 and U2 states. The [Set|Clear]Feature requests for "U1/U2" are forwarded directly to the hardware and allow / forbid the initiation of the low power links. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-04-24usb: dwc3: core: split host address spaceIdo Shayevitz
This fix prevents a problem with dwc3 and host mode where we were requesting the entire memory region in dwc3/core.c, thus preventing xhci-plat from ever ioremapping its own address space. Signed-off-by: Ido Shayevitz <idos@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-04-11usb: dwc3: core: define more revision macrosFelipe Balbi
We have other revisions already released, let's define revision macros for those so we can do runtime detection of known erratas. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-03-02Merge tag 'dwc3-for-v3.4' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next usb: dwc3: changes for v3.4 merge window Here are the changes for v3.4 merge window. It includes a new glue layer for Samsung's Exynos platform, a simplification of memory management on DWC3 driver by using dev_xxx functions, a few optimizations to IRQ handling by dropping memcpy() and using bitshifts, a fix for TI's OMAP5430 TX Fifo Allocation, two fixes on USB2 test mode implementation (one on debugfs and one on ep0), and several minor changes such as whitespace cleanups, simplification of a few parts of the code, decreasing a long delay to something a bit saner, dropping a header which was included twice and so on. The highlight on this merge is the support for Samsung's Exynos platform, increasing the number of different users for this driver to three. Note that Samsung Exynos glue layer will only compile on platforms which provide implementation for the clk API for now. Once Samsung supports pm_runtime, that limitation can be dropped from the Makefile. Conflicts: drivers/usb/dwc3/gadget.c
2012-03-02usb: dwc3: replace hard-coded constant in DWC3_GCTL_SCALEDOWN(3)Paul Zimmerman
Define DWC3_GCTL_SCALEDOWN_MASK and use it in place of DWC3_GCTL_SCALEDOWN(3). Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-03-02usb: dwc3: clean up whitespace damage, typos, missing parens, etc.Paul Zimmerman
trivial patch, no functional changes Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-28usb: dwc3: gadget: use generic map/unmap routinesFelipe Balbi
those routines have everything we need to map/unmap USB requests and it's better to use them. In order to achieve that, we had to add a simple change on how we allocate and use our setup buffer; we cannot allocate it from coherent anymore otherwise the generic map/unmap routines won't be able to easily know that the GetStatus request already has a DMA address. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-13usb: dwc3: convert TRBs into bitshiftsFelipe Balbi
this will get rid of a useless memcpy on IRQ handling, thus improving driver performance. Tested with OMAP5430 running g_mass_storage on SuperSpeed and HighSpeed. Note that we are removing the little endian access of the TRB and all accesses will be in System endianness, if there happens to be a system in BE, bit 12 of GSBUSCFG0 should be set so that HW does byte invariant BE accesses when fetching TRBs. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-10usb: dwc3: ep0: fix SetFeature(TEST)Gerard Cauvy
When host requests us to enter a test mode, we cannot directly enter the test mode before Status Phase is completed, otherwise the core will never be able to deliver the Status ZLP to host, because it has already entered the requested Test Mode. In order to fix the error, we move the actual start of Test Mode right after we receive Transfer Complete event of the status phase. Signed-off-by: Gerard Cauvy <g-cauvy1@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-06usb: dwc3: gadget: start core on Rx.DetectFelipe Balbi
When we set Run/Stop bit, we also move the core to Rx.Detect state so that USB3 handshake can start from a known location. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-06usb: dwc3: gadget: dynamically re-size TxFifosFelipe Balbi
We need to dynamically re-size TxFifos for the cases where default values will not do. While at that, we create a simple function which, for now, will just allocate one full packet fifo space for each of the enabled endpoints. This can be improved later in order to allow for better throughput by allocating more space for endpoints which could make good use of that like isochronous and bulk. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-06usb: dwc3: gadget: fix XferNotReady debug printFelipe Balbi
Only bit 3 of the event status bitfield is valid and the others should not be considered. Make sure SW matches documentation on that case to avoid bogus debugging prints which would confuse an engineer. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: gadget: fix stream enable bitFelipe Balbi
ep->max_streams is a mere hint to the gadget driver that 'ep' supports stream handling. Using that as a decision variable for enabling streams was my worst brain-fart to date. Instead, we should check from the Superspeed Endpoint Companion Descriptor if the endpoint has requested streams. For that we need a little re-factoring but it is now correct. Debugged-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_requestSebastian Andrzej Siewior
Instead of special functions and shortcuts for sending our internal answers to the host we started doing what the gadget does and used the public API for this. Since we only were using a few fields the usb_request was enough. Later added the list handling in order to synchronize the host / gadget events and now we require to have the dwc3_request struct around our usb_request or else we touch memory that does not belong to us. So this patch does this. Reported-by: Partha Basak <p-basak2@ti.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: workaround: missing disconnect eventFelipe Balbi
DWC3 revisions <1.88a have an issue which would case a missing Disconnect event if cable is disconnected while there's a Setup packet pending the FIFO. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: workaround: U1/U2 -> U0 transitonFelipe Balbi
RTL revisions <1.83a have an issue where, depending on the link partner, the USB link might do multiple entry/exit of low power states before a transfer takes place causing degraded throughput. The suggested workaround is to clear bits 12:9 of DCTL register if we see a transition from U1|U2 to U0 and only re-enable that on a transfer complete IRQ and we have no pending transfers on any of the enabled endpoints. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: ep0: handle delayed_status againSebastian Andrzej Siewior
Since the re-worked ep0 handling (which uses HW's hints to recognize the ep0 status) we lost the delayed status handling. This is used by the file and mass storage gadget to gain some extra time so setup its internal status before it can proceed further requests. In particular the storage gadget does nothing on USB_REQ_SET_CONFIGURATION but wakes up a thread which handles the request. If the udc driver continues ep0 handling before the thread did its work then then endpoint is not yet configured and further requests will fail. Once the gadget is ready, it will enqueue an empty packet which is used for synchronization. In order to fix this issue, the patch does the following: Set ->delayed_status once the delayed_status has been notices and do not continue on the next XferNotReady event. We will continues ep0 processing once the gadget enqueued the zero packet for synchronization. A cleaner approach would be to enforce the gadget to enqueue an empty (zero) request even for the status phase but this would do for now. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: use a helper function for operation mode settingSebastian Andrzej Siewior
There are two where need to set operational mode: - during initialization while we decide to run in host,device or DRD mode - at runtime via the debugfs interface. This patch provides a new function which sets the operational mode and moves its initialiation to the mode switch instead in the gadget code itself. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAXFelipe Balbi
hardware will tell us how many event buffers we need to support, so let's allocate the array dynamically too. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: move dwc3 device ID bitmap to core.cFelipe Balbi
if we want to support situations where we have both SoC and PCIe versions of the IP on the same platform, we need to have sequential numbers between them, otherwise we will still have name collisions. Because of that, we need to move dwc3_get/put_device_id() to core.c and export that symbol to be used by glue layers. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: remove special status request handling in ep0Sebastian Andrzej Siewior
The GetStatus (STD)-request is handled the driver and uses a tiny hack to send the two bytes long answer. This patch removes the custom hack uses the normal usb_ep_queue() for that. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: debugfs: add support for changing port modeFelipe Balbi
This makes testing a lot easier when trying to switch between host and device modes. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: move gadget prototypes to core.hFelipe Balbi
host prototypes are there, let's move gadget's closer. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: add xHCI Host supportFelipe Balbi
The Designware USB3 IP can be configured with an internal xHCI. If we're running on such a version, let's start the xHCI stack. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: fetch mode of operation from HWFelipe Balbi
There's no need to add driver_data for something we can fetch from HW. This also makes our id_table unnecessary - at least for now -, so we also remove it on the same patch. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: calculate number of event buffers dynamicallyFelipe Balbi
This will allow us to only allocate memory when we actually need. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12usb: dwc3: allow forcing a maximum speedFelipe Balbi
this is mainly for testing. In order to be able to test if we're enumerating correctly on all speeds, let that be controlled by a module parameter. Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-10-04usb: dwc3: gadget: allow clock gating to workFelipe Balbi
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>
2011-10-04usb: dwc3: add struct dwc3_hwparamsFelipe Balbi
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>
2011-10-04usb: dwc3: gadget: implement streams supportFelipe Balbi
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>
2011-10-04usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPsPaul Zimmerman
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>
2011-10-04usb: dwc: remove "All rights reserved" statement.Sebastian Andrzej Siewior
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>
2011-09-09usb: dwc3: ep0: introduce ep0_expect_in flagFelipe Balbi
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>
2011-09-09usb: dwc3: define ScaleDown macro helperFelipe Balbi
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>
2011-09-09usb: dwc3: Fix definition of DWC3_GCTL_U2RSTECNFelipe Balbi
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>
2011-09-09usb: dwc3: core: add ep0_next_event fieldFelipe Balbi
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>
2011-09-09usb: dwc3: drop EP0_STALL stateFelipe Balbi
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>
2011-09-09usb: dwc3: gadget: rework the dequeue on RESET & DISCONNECTSebastian Andrzej Siewior
- 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>