summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/dwc_otg.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid using the bounce buffer when the source or destination buffer ishselasky2015-11-081-37/+139
| | | | | | | | 32-bits aligned. Merge the two bounce buffers into a single one. Some rough tests showed that the DWC OTG throughput on RPI2 increased by 10% after this patch. MFC after: 1 week
* Reduce the DWC OTG interrupt load by not reading all the host channelhselasky2015-10-301-6/+11
| | | | | | | | | status registers for every interrupt. Check a common host channel status interrupt register first, then conditionally read the individual host channel status registers. Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de> MFC after: 1 week
* Fixes for HIGH speed ISOCHRONOUS traffic. HS ISOCHRONOUS traffic athselasky2015-08-151-213/+234
| | | | | | | | | intervals less than 250us was not handled properly. Add support for high-bandwidth ISOCHRONOUS packets. USB webcams, USB audio and USB DVB devices are expected to work better. High-bandwidth INTERRUPT endpoints is not yet supported. MFC after: 2 weeks
* Handle NYET high speed tokens and predict NAK'ing is up next.hselasky2015-08-141-7/+13
| | | | MFC after: 2 weeks
* Minor code refactor to avoid duplicating code.hselasky2015-08-141-18/+9
| | | | MFC after: 2 weeks
* Limit the number of times we loop inside the DWC OTG poll handler tohselasky2015-07-311-1/+7
| | | | | | | avoid starving other fast interrupts. Fix a comment while at it. MFC after: 1 week Suggested by: Svatopluk Kraus <onwahe@gmail.com>
* Optimise the DWC OTG host mode driver's receive path:hselasky2015-07-281-48/+29
| | | | | | | | | Remove NAKing limit and pause IN and OUT transactions for 125us in case of NAK response for BULK and CONTROL endpoints. This gets the receive latency down and improves USB network throughput at the cost of some CPU usage. MFC after: 1 month
* Optimise the DWC OTG host mode driver's transmit path:hselasky2015-07-161-107/+73
| | | | | | | | | | | | | | | | | | | | | | | | 1) Use the TX FIFO empty interrupts to poll the transmit FIFO usage, instead of using own software counters and waiting for SOF interrupts. Assume that enough FIFO space is available to execute one USB OUT transfer of any kind when the TX FIFO is empty. 2) Use the host channel halted event to asynchronously wait for host channels to be disabled instead of waiting for SOF interrupts. This results in less turnaround time for re-using host channels and at the same time increases the performance. The network transmit performance measured by "iperf" for the "RPi-B v1 2011/12" board, increased from 45MBit/s to 65Mbit/s after applying the changes above. No regressions seen using: - High Speed (BULK, CONTROL, INTERRUPT) - Full Speed (All transfer types) - Low Speed (Control and Interrupt) MFC after: 1 month Submitted by: Daisuke Aoyama <aoyama@peach.ne.jp>
* Fix for control endpoint handling in the DWC OTG driver. The datahselasky2015-06-021-56/+52
| | | | | | | | stage processing is only allowed after the setup complete event has been received. Else a race may occur and the OUT data can be corrupted. While at it ensure resetting a FIFO has the required wait loop. MFC after: 3 days
* Fix for DWC OTG device side isochronous transfers. The even or oddhselasky2015-05-191-2/+31
| | | | | | isochronous frame bit needs to be flipped. MFC after: 3 days
* Make the FIFO configuration a bit more flexible for the DWC OTG inhselasky2015-05-181-22/+19
| | | | device side mode.
* Disable multi process interrupts, because the current code doesn't usehselasky2015-04-231-9/+7
| | | | | | | them. Else we can end up in an infinite interrupt loop in USB device mode. MFC after: 3 days
* Add support for the DWC OTG v2 chipset found in the STM32F4 series ofhselasky2015-02-231-11/+40
| | | | | | | processors. Make sure we pullup the data lines in device mode when we power on the port. MFC after: 1 week
* Pull in r267961 and r267973 again. Fix for issues reported will follow.hselasky2014-06-281-3/+2
|
* Revert r267961, r267973:gjb2014-06-271-2/+3
| | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifhselasky2014-06-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies
* Fix for USB specification compliance. We need to accept both DATA0 andhselasky2014-06-071-0/+16
| | | | | | DATA1 for INTERRUPT endpoints. MFC after: 3 days
* Some further DWC OTG improvements for full speed and low speed devices:hselasky2014-06-071-80/+58
| | | | | | | | | | | | | | | - Revert r265427. It appears we are halting the DWC OTG host controller schedule if we process events only at every SOF. When doing split transactions we rely on that events are processed quickly and waiting too long might cause data loss. - We are not always able to meet the timing requirements of interrupt endpoint split transactions. Switch from INTERRUPT to CONTROL endpoint type for interrupt endpoint events until further, hence CONTROL endpoint events are more relaxed, reducing the chance of data loss. See comment in code for more in-depth explanation. - Simplify TT scheduling. MFC after: 3 days
* Try to fix DWC OTG regression issues with full and low speed devices:hselasky2014-06-051-225/+281
| | | | | | | | | | | | | | | | | | | | | | | - Remove double buffering interrupt and isochronous traffic via the transaction translator. It can be avoided because the DWC OTG will always delay the start split transactions for interrupt and isochronous traffic, but will not delay the complete split transactions, if we set the odd frame bit correctly. - Need to check the transfer cache field in the device done function to be sure all allocated channels are freed and not the transfer first one. This seems to resolve the control endpoint transfer type quirk which is now removed. - Make sure any received data upon TX is dumped else RX path will stop. - Transmit isochronous data before receiving isochronous data as a means to optimise the TT schedule. - Implement a simple TT bandwidth scheduler. - Cleanup use of old "td->error" variable. - On interrupt IN traffic via the transaction translator we simply ignore missed transfer opportunities and silently retry the transaction upon next available time slot. MFC after: 3 days
* The external USB HUB in the RPI-B rejects control endpoint traffichselasky2014-06-041-3/+12
| | | | | | | using the BULK endpoint type, while other USB HUBs do not. Disable endpoint type workaround for TT traffic. MFC after: 3 days
* Add some more spinlocks to protect the state of the USB transferhselasky2014-05-291-27/+38
| | | | | | queue. Rename some functions to indicate locking requirements. MFC after: 1 week
* - Add softc pointer argument to FIFO functions as an optimisation.hselasky2014-05-181-112/+164
| | | | | | | | - Implement support for interrupt filters in the DWC OTG driver, to reduce the amount of CPU task switching when only feeding the FIFOs. - Add common spinlock to the USB bus structure. MFC after: 2 weeks
* Disable configuration of the host frame interval register untilhselasky2014-05-141-0/+7
| | | | further, hence it breaks USB support on some non-RPI platforms.
* Optimise host mode data roundtrip time. When BULK data is submitted tohselasky2014-05-111-25/+69
| | | | | | | | | | the main processing queue, clear the NAK counter for any associated BULK or CONTROL transfers and poll the endpoint(s) for 1 millisecond at 125us rate interval, before going into slow, 10ms, NAK polling mode again. This has the effect that typical ping-ping protocols respond quicker when initiated from the USB host. MFC after: 2 weeks
* Optimise host channel disabling:hselasky2014-05-101-38/+67
| | | | | | | | | | | - For non-periodic traffic we only need to wait two SOFs before disabling the channel. - Make sure we release the TX FIFO tracking level after the host channel is disabled. - Make sure the host channel state gets reset/disabled initially. - Two minor code style changes. MFC after: 2 weeks
* Fix a regression issue:hselasky2014-05-091-7/+7
| | | | | | | | - ACK can be received before data arrives in RX FIFO. Handle this. - Remove obsolete comment. - Some minor code styling. MFC after: 2 weeks
* Multiple DWC OTG host mode related fixes and improvements:hselasky2014-05-091-711/+580
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rework how we allocate and free USB host channels, so that we only allocate a channel if there is a real packet going out on the USB cable. - Use BULK type for control data and status, due to instabilities in the HW it appears. - Split FIFO TX levels into one for the periodic FIFO and one for the non-periodic FIFO. - Use correct HFNUM mask when scheduling host transactions. The HFNUM register does not count the full 16-bit range. - Correct START/COMPLETION slot for TT transactions. For INTERRUPT and ISOCHRONOUS type transactions the hardware always respects the ODDFRM bit, which means we need to allocate multiple host channels when processing such endpoints, to not miss any so-called complete split opportunities. - When doing ISOCHRONOUS OUT transfers through a TT send all data payload in a single ALL-burst. This deacreases the likelyhood for isochronous data underruns. - Fixed unbalanced unlock in case of "dwc_otg_init_fifo()" failure. - Increase interrupt priority. MFC after: 2 weeks
* Reduce the number of interrupts in USB host mode for the DWC OTGhselasky2014-05-061-83/+145
| | | | | | | | | | | | | | controller driver by piggybacking the SOF interrupt when issuing new and checking old transfers. Number of interrupts was reduced by 30% when doing Isochronous transfers. Use correct GINTMSK_XXX macros when accessing the DWC OTG interrupt mask register. Add code to adjust the frame interval register which influences the SOF rate. MFC after: 2 weeks
* Improve DWC OTG USB host side support for isochronous FULL and HIGHhselasky2014-05-051-253/+736
| | | | | | | | | speed data traffic going directly to a USB device or through a so-called USB transaction translator. Add checks that we are not overusing the TX FIFO. MFC after: 2 weeks
* Add support for specifying USB controller mode via FDT.hselasky2014-04-181-2/+7
| | | | | | | | Add FDT support to the DWC OTG kernel module. Submitted by: John Wehle <john@feith.com> PR: usb/188683 MFC after: 1 week
* USB method structures for USB controllers and USB pipes should behselasky2013-12-111-6/+6
| | | | | constant and does not need to be modified. This also saves a small amount of RAM.
* Bugfix: The endpoint profile should only be checked in device mode whenhselasky2013-08-251-8/+12
| | | | | | allocating USB transfers and not in host mode. Reported by: George Mitchell <george+freebsd@m5p.com>
* Use string literals in string descriptors for marginallyhselasky2013-01-301-4/+2
| | | | | | better readability. Submitted by: Christoph Mallon
* Provide one global language string descriptor forhselasky2013-01-301-6/+2
| | | | | | | american english instead of giving each module its own. Submitted by: Christoph Mallon
* Modify the FreeBSD USB kernel code so that it can be compiled directlyhselasky2013-01-301-3/+5
| | | | | | | | | | | | | | | | | | | | | | into the FreeBSD boot loader, typically for non-USB aware BIOSes, EFI systems or embedded platforms. This is also useful for out of the system compilation of the FreeBSD USB stack for various purposes. The USB kernel files can now optionally include a global header file which should include all needed definitions required to compile the FreeBSD USB stack. When the global USB header file is included, no other USB header files will be included by default. Add new file containing the USB stack configuration for the FreeBSD loader build. Replace some __FBSDID()'s by /* $FreeBSD$ */ comments. Now all USB files follow the same style. Use cases: - console in loader via USB - loading kernel via USB Discussed with: Hiroki Sato, hrs @ EuroBSDCon
* Fix LOW and FULL speed USB INTERRUPT endpoint support for thehselasky2012-11-091-40/+155
| | | | | | | | | DWC OTG driver. Fix a hang issue when using LOW and FULL speed BULK traffic. Make sure we don't ask for data in the last microframe. This allows using devices like USB mice and USB keyboards connected to the RPI-B. Suggested by: gonzo @
* Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.hselasky2012-10-261-2/+1
| | | | | | | | Rearrange the tunables and belonging sysctl declarations, so that they are next to eachother. Submitted by: n_hibma @ MFC after: 1 week
* Correct NYET handling. Remove superfluous transfer complete interrupt mask.hselasky2012-09-281-34/+23
|
* Make sure the "wMaxPacketSize" limitations are respected.hselasky2012-09-271-3/+28
|
* Make sure we record NAK tokens in the TD structure for IN direction.hselasky2012-09-271-61/+42
| | | | | Improve host channel disabling. Wait two times 125us for channel to be disabled. The DWC OTG doesn't like when channels are re-used too early.
* Make sure the DWC OTG host mode channels are given enough time to disable.hselasky2012-09-261-1/+17
|
* DWC OTG host mode improvements:hselasky2012-09-241-3/+36
| | | | | - Make HSIC selection dynamic. - Make LOW speed USB devices work through HIGH speed USB HUB.
* DWC OTG host mode improvements. Add support for the 3-strikes and you arehselasky2012-09-231-445/+602
| | | | | | | | | | gone rule. Optimise use of channels so that when a channel is not ready another channel is used. Instead of using the SOF interrupt use the system timer to drive the host statemachine. This might give lower throughput and higher latency, but reduces the CPU usage significantly. The DWC OTG host mode support should not be considered for serious USB host controller applications. Some problems are still seen with LOW speed USB devices.
* DWC OTG improvements. Implement full support for SPLIT transactions, in otherhselasky2012-09-141-205/+430
| | | | | words FULL/LOW speed devices through HIGH speed HUBs. Improve support for suspend and resume in host mode.
* Fix TX FIFO sizes. Correct FIFO handling in Host mode.hselasky2012-09-121-66/+83
|
* Reduce DWC OTG polling rate by using the SOF interrupt.hselasky2012-09-121-40/+75
|
* Fix missing parts of DWC OTG host mode support. The host mode supporthselasky2012-09-111-192/+164
| | | | | | of the DWC OTG is very simple in PIO mode, and we need to re-transmit data when NAK is received among other things. We probably will need to implement some kind of rate limitation on the NAK-ing.
* Fix for IRQ hang in DWC OTG host mode.hselasky2012-09-101-19/+27
|
* Cleanup interrupt handling in Host Mode.hselasky2012-09-101-44/+45
|
* Implement missing USB suspend and resume support for DWC OTG driver.hselasky2012-09-091-6/+60
|
OpenPOWER on IntegriCloud