summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/dwc_otg.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Add support for host mode to the DWC OTG controller driver.hselasky2012-09-091-183/+1138
| | | | | | | The DWC OTG host mode support should still be considered experimental. Isochronous support for DWC OTG is not fully implemented. Some code added derives from Aleksandr Rybalko's dotg.c driver.
* Preparations for adding USB HOST mode to the DWC OTG driver.hselasky2012-08-301-222/+223
| | | | | | | Merge register file with external one and put all register definitions in a separate file. Submitted by: ray @
* Add support for the so-called streams feature of BULK endpointshselasky2012-08-121-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in SUPER-speed mode, USB 3.0. This feature has not been tested yet, due to lack of hardware. This feature is useful when implementing protocols like UASP, USB attached SCSI which promises higher USB mass storage throughput. This patch also implements support for hardware processing of endpoints for increased performance. The switching to hardware processing of an endpoint is done via a callback to the USB controller driver. The stream feature is implemented like a variant of a hardware USB protocol. USB controller drivers implementing device mode needs to be updated to implement the new "xfer_stall" USB controller method and remove the "xfer" argument from the "set_stall" method. The API's toward existing USB drivers are preserved. To setup a USB transfer in stream mode, set the "stream_id" field of the USB config structure to the desired value. The maximum number of BULK streams is currently hardcoded and limited to 8 via a define in usb_freebsd.h. All USB drivers should be re-compiled after this change. LibUSB will be updated next week to support streams mode. A new IOCTL to setup BULK streams as already been implemented. The ugen device nodes currently only supports stream ID zero. The FreeBSD version has been bumped. MFC after: 2 weeks
* Fix compiler warnings, mostly signed issues,hselasky2012-04-021-4/+3
| | | | | | when USB modules are compiled with WARNS=9. MFC after: 1 weeks
* Fix for DWC OTG interrupt register programming.hselasky2012-03-051-18/+41
| | | | | | | Fix a compiler warning. Add missing header file. MFC after: 1 week
* Add support for the DesignWare USB 2.0 OTG controller chipset.hselasky2012-01-211-0/+2612
Currently the code is not built by any modules. That will be fixed later. The Atmel ARM bus interface file part of this commit is just for sake of example. All registers and bits are declared like macros and not C-structures like in official Synopsis header files. This driver mostly origins from the musb_otg.c driver in FreeBSD except that the chip specific programming has been replaced by the one for DWC 2.0 USB OTG. Some parts related to system suspend and resume have been left like empty functions for the future. USB suspend and resume is fully supported.
OpenPOWER on IntegriCloud