Commit Graph

3444 Commits

Author SHA1 Message Date
Hans Petter Selasky
f5bf22f3b5 Disable configuration of the host frame interval register until
further, hence it breaks USB support on some non-RPI platforms.
2014-05-14 11:32:15 +00:00
Hans Petter Selasky
40ba168d27 - Isochronous transfers should use the alternate next transfer
descriptor upon receiving a short packet, in host and device mode.
- Correct some comments.
2014-05-13 13:46:38 +00:00
Hans Petter Selasky
1d6b6e9d46 Create driver file templates, kernel module Makefile and add initial
version of register definitions for ISP1761 and SAF1761 compatible
chips.

Sponsored by:	DARPA, AFRL
2014-05-12 09:05:07 +00:00
Hans Petter Selasky
4541f27356 Optimise host mode data roundtrip time. When BULK data is submitted to
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
2014-05-11 08:17:46 +00:00
Hans Petter Selasky
e2192fdfc6 Optimise host channel disabling:
- 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
2014-05-10 07:37:32 +00:00
Hans Petter Selasky
897b7965df Fix a regression issue:
- ACK can be received before data arrives in RX FIFO. Handle this.
- Remove obsolete comment.
- Some minor code styling.

MFC after:	2 weeks
2014-05-09 16:40:41 +00:00
Hans Petter Selasky
81c36cd940 Fix for NULL pointer.
MFC after:	1 week
2014-05-09 14:28:11 +00:00
Hans Petter Selasky
db4300da10 Multiple DWC OTG host mode related fixes and improvements:
- 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
2014-05-09 14:23:06 +00:00
Hans Petter Selasky
42fabcc35c Reduce the number of interrupts in USB host mode for the DWC OTG
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
2014-05-06 09:12:32 +00:00
Michael Tuexen
5a1a4f754a Fill in csum_data only for UDP or TCP packets. This fixes a bug where
SCTP were reported to have always a correct checksum if they don't
contain any ethernet padding.

MFC after: 3 days
2014-05-05 17:30:05 +00:00
Hans Petter Selasky
bc99048296 Improve DWC OTG USB host side support for isochronous FULL and HIGH
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
2014-05-05 11:50:52 +00:00
Hans Petter Selasky
8237c62b5d Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel
LynxPoint USB 3.0 controllers found in MacBookPro 2013's.

MFC after:	2 days
Tested by:	Huang Wen Hui <huanghwh@gmail.com>
2014-04-27 15:41:44 +00:00
Andreas Tobler
269aedcff5 Fix gcc build, initialize off variable. 2014-04-26 19:30:04 +00:00
Ian Lepore
a7fa939bb3 Stop calling imx51_ccm_foo() clock functions from imx6 code. Instead
define a few imx_ccm_foo() functions that are implemented by the imx51 or
imx6 ccm code.  Of course, the imx6 ccm code is still more a wish than
reality, so for now its implementations just return hard-coded numbers.
2014-04-26 16:48:09 +00:00
Kevin Lo
11a4d354a2 Initialize rssi variable. 2014-04-26 14:39:58 +00:00
Ian Lepore
0a34210d99 The FTDI product ID we've been calling BEAGLEBONE is actually TI XDS100V2,
a jtag debugging product, which was used on early Beaglebone boards (later
boards used a standard FTDI 2232C product ID).  Change the name accordingly,
and also add an entry for XDS100V3, the latest version of that product
which has its own new product ID number.
2014-04-25 19:47:27 +00:00
Ian Lepore
74855db616 Remove device type from the uftdi_devs table, enhance the jtag-skip feature.
Device type and revision is now determined from the bcdDevice field and
doesn't need to be in the table at all.  The feature that skips creation
of /dev/ttyU* entries for jtag and gpio interfaces is enhanced:

 - The feature is now optional, but enabled by default.  A tunable and
   sysctl are available to control it: hw.usb.uftdi.skip_jtag_interfaces.
 - We no longer assume interface #0 is the only jtag interface.  Up to
   eight interfaces per chip can be flagged as jtag.  (Current ftdi chips
   support a max of 4 interfaces; this leaves room for growth.)
 - Some manufacturers don't change the product ID or use the same ID for
   different devices intended for both serial-comms and jtag/gpio use.
   Often while the product ID is the same, the product name string is
   different, so it's now possible to search for the product name in a
   table of strings and get the set of non-tty interfaces from that table.
2014-04-25 19:13:57 +00:00
Kevin Lo
28bc7834e0 Add preliminary support for the Realtek RTL8188EUS and RTL8188ETV chipsets.
Committed over the TP-LINK TL-WN725N v2 (RTL8188EUS) on amd64 with WPA.
2014-04-25 08:01:22 +00:00
Kevin Lo
d0cc98c0b1 Fix panic by adding mtx_assert() to urtwn_init_locked() and
urtwn_stop_locked().

Tested by:	Anthony Jenkins <scoobi_doo at yahoo dot com>
2014-04-24 03:16:47 +00:00
Kevin Lo
66b8205e11 Oops, revert r264801. 2014-04-23 05:54:55 +00:00
Kevin Lo
0f009f73b9 Add a missing break. 2014-04-23 05:53:03 +00:00
Hans Petter Selasky
543b6e5899 - Get transmit loop more in line with the other serial drivers.
- Add a comment about FTDI and ZLPs.
- Correctly check odditiy of baud rate divisor.
- Correct IOCTL handling for "error" and "event" char.

MFC after:	1 weeks
2014-04-23 05:50:55 +00:00
Hans Petter Selasky
ba2188af87 Add new USB quirk.
Submitted by:	kwm @
MFC after:	1 week
2014-04-18 16:19:33 +00:00
Hans Petter Selasky
491d5d0577 Add support for specifying USB controller mode via FDT.
Add FDT support to the DWC OTG kernel module.

Submitted by:	John Wehle <john@feith.com>
PR:		usb/188683
MFC after:	1 week
2014-04-18 08:31:55 +00:00
Hans Petter Selasky
67eb1bdac2 Correct IMOD default value according to comment.
Reported by:	Daniel O'Connor <doconnor@gsoft.com.au>
MFC after:	1 week
2014-04-11 08:25:54 +00:00
Kevin Lo
ed8023f58b Add the Asus USB-N10 NANO.
Tested by:	Kuan-Chung Chiu <buganini@gmail.com>
2014-04-10 14:37:37 +00:00
Hans Petter Selasky
a955cde712 Fix for infinite XHCI reset loops when the set address USB request fails.
MFC after:	2 days
2014-04-09 06:27:04 +00:00
Ian Lepore
a9d84a2ba7 Add ioctl(2) calls to uftdi(4) to access bitbang, MPSSE, CPU_FIFO, and
other modes supported by the FTDI serial adapter chips.

In addition to adding the new ioctls, this change removes all the code
that reset the chip at attach and open/close time, and also the code
that turned on RTS/CTS flow control on open without any permission to do
so (that was just always a bug in the driver).

When FTDI chips are configured as GPIO or MPSSE or other special-purpose
uses by an attached serial eeprom, the chip will power on with certain
pins driven or floating, and it's important that the driver not do
anything to the chip to perturb that unless it receives a specific
command to do so.  When used for "plain old serial comms" the chip
powers on into the right mode and never needs to be reset while it's
running to operate properly, so this change is transparent to most users.
2014-04-05 16:08:13 +00:00
Joerg Wunsch
9f7fef595d Add the Dresden Elektronik "USB Levelshifter Stick Low Cost" to the
list of known FTDI devices.

https://shop.dresden-elektronik.de/accessories/levelshifter/usb-pegelwandler-stick-basic.html

MFC after:	1 week
2014-04-03 20:00:02 +00:00
Pyun YongHyeon
759d456324 Correct endianness handling in getting station address from EEPROM.
While I'm here, remove aue_eeprom_getword() as its only usage is to
read station address and make it more readable.  This change is
inspired by NetBSD.
With this change, aue(4) should work on big endian architectures.

PR:	188177
2014-04-03 01:32:43 +00:00
Ian Lepore
07a5254736 Use 2K buffers for IO to help achieve full device speed, rather than the
default wMaxPacketSize (64 or 512 bytes).  This actually helps older FTDI
devices (which were USB 1/full speed) more than the new H-series high
speed, but even for the new chips it helps cut the number of interrupts
when doing very high speed (3-12mbaud).
2014-04-02 01:58:54 +00:00
Ian Lepore
9537ab6cc8 Support serial speeds up to 12mbaud with newer FTDI chips.
Recent FDTI chips have the ability to operate at up to 12mbps.  The newer
chips with faster clocks have the same usb vendor/product IDs as the older
chips; the bcdDevice field must be used to detect the newer versions.  This
change includes a new function to do that instead of using just the IDs from
the vendor/product table.

The code to choose the baud clock divisor is completely rewritten.  In
addition to supporting the new higher clock rates, the rewrite fixes a
longstanding bug in the old code which put the high bits of the fractional
part of the divisor into the wrong place in the wIndex field.  That bug
was mostly harmless -- it accidentally didn't affect standard baud rates
and would only show up when using relatively fast non-standard rates.
2014-04-01 15:56:31 +00:00
Hans Petter Selasky
4ebc1ddf98 Add new USB ID.
Submitted by:	Tuomo Latto <djv+fbpr@iki.fi>
PR:		usb/188046
MFC after:	1 week
2014-04-01 10:34:39 +00:00
Hans Petter Selasky
d008478e28 Try to resolve a possible deadlock when detaching USB devices which
create character devices. The deadlock can happen if an application is
issuing IOCTLs which require USB refcounting, at the same time the USB
device is detaching.

There is already a counter in place in the USB device structure to
detect this situation, but it was not always checked ahead of invoking
functions that might destroy character devices, like detach, set
configuration, set alternate interface or detach active kernel driver.

Reported by:	Daniel O'Connor <doconnor@gsoft.com.au>
MFC after:	1 week
2014-03-20 13:53:24 +00:00
Ed Maste
0fcefb433d Update NetBSD Foundation copyrights to 2-clause BSD
The NetBSD Foundation states "Third parties are encouraged to change the
license on any files which have a 4-clause license contributed to the
NetBSD Foundation to a 2-clause license."

This change removes clauses 3 and 4 from copyright / license blocks that
list The NetBSD Foundation as the only copyright holder.

Sponsored by:	The FreeBSD Foundation
2014-03-18 01:40:25 +00:00
Hans Petter Selasky
ed25d0e833 Fix spelling.
Reported by:	Kevin P. Neal <kpneal@pobox.com>
2014-03-17 07:19:19 +00:00
Hans Petter Selasky
e91fe3a904 Workaround for USB MIDI adapters which use non-supported values of
wMaxPacketSize for BULK endpoints.

MFC after:	1 week
2014-03-14 08:42:30 +00:00
Kevin Lo
a275e26512 Reset the bit of the R92C_MCUFWDL associated with checksum report
before loading firmware page.  It may fix this problem:
"urtwn0: timeout waiting for checksum report"
2014-03-14 06:38:22 +00:00
Kevin Lo
9602062e96 Similar to r246614, fix panic on removing urtwn(4). It happens because
nodes are freed after the adapter is gone.
2014-03-14 06:37:08 +00:00
Hans Petter Selasky
cdea3bef22 Ignore USB keyboard driver calls from critical sections.
Reported by:	Oliver Pinter <oliver.pntr@gmail.com>
MFC after:	1 week
2014-03-10 08:52:30 +00:00
Kevin Lo
22584722c6 Fix a logic error when enabling MAC. 2014-03-06 06:39:55 +00:00
Hans Petter Selasky
44bf877e1a - Temporary fix for race in RUN driver which can
cause freed memory to be accessed.
- Properly lock callout_reset()'s.

MFC after:	1 week
2014-03-05 18:39:27 +00:00
Hans Petter Selasky
827f71dc20 Add new quirk.
MFC after:	1 week
PR:		usb/187188
Submitted by:	Hiroo Ono <hiroo.ono+freebsd@gmail.com>
2014-03-04 12:33:18 +00:00
Hans Petter Selasky
119aeb7241 - Make pointer easier to control when moving slowly.
- Increase chance of vertical scrolling as vertical scrolling is used more often.

Submitted by:	Huang Wen Hui <huanghwh@gmail.com>
MFC after:	2 weeks
2014-03-01 18:56:50 +00:00
Warner Losh
c04f8bc023 Add device and gadget bindings for fdt. These are preliminary and will
need work before they work, especially the gadget bindings.
2014-02-28 03:00:31 +00:00
Hans Petter Selasky
a6609003d4 Clear the knote list before destroying it.
Add seldrain() to wakeup any pollers.

Submitted by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
MFC after:	2 weeks
2014-02-27 12:11:43 +00:00
Hans Petter Selasky
e2723934d6 Add missing call to "knlist_destroy()".
Found by:	John-Mark Gurney <jmg@funkthat.com>
MFC after:	2 weeks
2014-02-27 09:15:58 +00:00
Hans Petter Selasky
0b6d54d450 Add support for kqfilter to USB character devices.
Submitted by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
MFC after:	2 weeks
2014-02-27 08:57:37 +00:00
Hans Petter Selasky
358e903857 Don't generate devd rules for WSP device ID's found in the ATP driver yet.
MFC after:	2 weeks
2014-02-25 09:34:30 +00:00
Hans Petter Selasky
eaef7dbdab Updates for WSP driver:
1) Add support for page back/forward.
2) While doing HOR scrolling, disable VER scrolling.
3) Checking dx_sum and dy_sum before emulate right button, this can
avoids unexpected right button press.
4) Fix stable pointer operation when emulating middle button.

Submitted by:	Huang Wen Hui <huanghwh@gmail.com>
MFC after:	2 weeks
2014-02-25 08:37:06 +00:00
Kevin Lo
5c5e99d273 Add a flag to run's device list which uses a standard scsi eject.
The flag indicates that the mcu doesn't need to load firmware.

Tested by:	Alex Deiter <alex dot deiter at gmail.com>, myself
Tested on:	ASUS USB-N66
2014-02-25 01:42:02 +00:00
Hans Petter Selasky
973650a472 Fix compiler warning.
Reported by:	David Wolfskill <david@catwhisker.org>
MFC after:	2 weeks
2014-02-24 19:19:35 +00:00
Hans Petter Selasky
266ffc1f40 Update ATP driver:
- Add support for emulating a mouse wheel, Z-axis.

Submitted by:	Rohit Grover <rgrover1@gmail.com>
MFC after:	2 weeks
2014-02-24 10:44:42 +00:00
Hans Petter Selasky
37247d72eb Update ATP driver:
- Support for double-tap and drag.
- Support for 2-finger horizontal scrolling which translates to page-back/forward events.
- Single finger tap is equivalent to a left-button press.
- Two-finger taps are mapped to the right-button click.
- Three fingers are mapped to middle button.
- Add sysctl to disable single finger tapping.
- Fix for multiple open of /dev/atp0
- Enhanced support for the Fountain/Geyser family by adding Geyser4.
- Update manual page.

Submitted by:	Rohit Grover <rgrover1@gmail.com>
MFC after:	2 weeks
2014-02-23 23:36:32 +00:00
Craig Rodrigues
458a36d594 In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
Before this patch, curvnet was NULL.
When the VIMAGE kernel option is enabled, this eliminates
kernel panics when USB ethernet devices are plugged in.

PR: 183835
Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>
2014-02-18 01:20:26 +00:00
Hans Petter Selasky
e4dfeb5bb1 Our quirk table is almost full. Add some room for more quirks.
MFC after:	1 week
2014-02-17 20:30:29 +00:00
Hans Petter Selasky
860fe6b9fb Adjust USB quirk.
MFC after:	1 week
Submitted by:	Volodymyr Kostyrko <arcade@b1t.name>
2014-02-17 20:26:13 +00:00
Dimitry Andric
ea7f47f524 In sys/dev/usb/controller/uss820dci.c, similar to r261977, fix a warning
about uss820dci_odevd being unused, by adding it to the part that
handles getting descriptors.

Reported by:	loos
Reviewed by:	hselasky
MFC after:	3 days
2014-02-17 20:08:11 +00:00
Hans Petter Selasky
77bea00c5e Add new PCI ID for hardware which needs port routing for USB 3.0.
PR:		usb/186811
MFC after:	1 week
Submitted by:	Philipp Maechler <philipp.maechler@mamo.li>
2014-02-16 14:37:23 +00:00
Dimitry Andric
bc28228951 In sys/dev/usb/controller/musb_otg.c, fix a warning about musbotg_odevd
being unused, by adding it to the part that handles getting descriptors.

Reviewed by:	hselasky
MFC after:	3 days
2014-02-16 12:41:57 +00:00
Hans Petter Selasky
c4a1e93fa6 Fix minor logical error in the XHCI driver. Set correct SETUP packet
direction value.

MFC after:	2 days
Reported by:	Horse Ma <HMa@wyse.com>
2014-02-14 07:17:36 +00:00
Rui Paulo
a999ce6abf Add urtwn_start_locked() to avoid unlocking during TX. 2014-02-14 01:47:12 +00:00
Hans Petter Selasky
4e7b9cba60 - Remove not needed definitions from driver.
- Get USB input report length from HID descriptor.
- Use 1 finger TAP for devices which has no integrated button.
- Move data buffer to softc instead of allocating it.

MFC after:	1 week
2014-02-13 09:09:14 +00:00
Hans Petter Selasky
4a6af12570 Issue doorbell twice before finally freeing the DMA descriptors. This
should fix DMA descriptor caching issues seen with the EHCI controller
found in Google Chromebook C720 during removal and insertion of USB
devices.

MFC after:	1 week
Reported by:	Matthew Dillon at DragonFlyBSD
2014-02-12 08:04:38 +00:00
Warner Losh
6efc5b1db6 Remove FreeBSD 6 support 2014-02-08 04:29:36 +00:00
Hans Petter Selasky
7a7e829428 Resolve probe conflict for now.
MFC after:	2 weeks
2014-02-06 10:47:47 +00:00
Hans Petter Selasky
99b5dd8fbe Fix kernelbuild when full debugging features are enabled.
Pointyhat:	hselasky @
MFC after:	2 weeks
2014-02-06 10:38:40 +00:00
Hans Petter Selasky
2931122745 Import USB RNDIS driver to FreeBSD from OpenBSD.
Useful for so-called USB tethering.
- Imported code from OpenBSD
- Adapted code to FreeBSD
- Removed some unused functions
- Fixed some buffer encoding and decoding issues
- Optimised data transport path a bit, by sending multiple packets at a time
- Increased receive buffer to 16K

Obtained from:	OpenBSD
Requested by:	eadler @
MFC after:	2 weeks
2014-02-06 08:47:14 +00:00
Kevin Lo
c1033bd401 Correct setting R92C_TXAGC_MCS11_MCS08 register. 2014-02-05 08:09:02 +00:00
Hans Petter Selasky
5fb878a957 Fix a regression issue. Contiguous single segment allocations above
PAGE_SIZE bytes should only use one USB page structure. Fixes a
problem with some external drivers.

MFC after:	2 days
2014-02-05 08:02:52 +00:00
Ian Lepore
add35ed5b8 Follow r261352 by updating all drivers which are children of simplebus
to check the status property in their probe routines.

Simplebus used to only instantiate its children whose status="okay"
but that was improper behavior, fixed in r261352.  Now that it doesn't
check anymore and probes all its children; the children all have to
do the check because really only the children know how to properly
interpret their status property strings.

Right now all existing drivers only understand "okay" versus something-
that's-not-okay, so they all use the new ofw_bus_status_okay() helper.
2014-02-02 19:17:28 +00:00
Hans Petter Selasky
b1a93b386c Add a comment about the origin of some structures, defines and so on.
MFC after:	1 week
2014-02-01 06:58:16 +00:00
Hans Petter Selasky
198fc7c37f Fix a range check for maximum transmit length. The existing code was
off by 4 bytes in one case.

Approved by:	kevlo @
MFC after:	2 weeks
2014-01-31 22:42:26 +00:00
Hans Petter Selasky
4e8bc8514d Fix for unexpected selection with two fingers sometimes.
Fix for unexpected scrolling when click with two fingers.

Submitted by:	Huang Wen Hui <huanghwh@gmail.com>
MFC after:	1 week
2014-01-31 07:14:21 +00:00
Nick Hibma
16bf0e5da1 Fix the ordering of the arguments to printf in
uhub_child_location_string(). This produced bogus information in

	dev.<USB driver>.<id>.%location

output from sysctl.

MFC after:	2 weeks
2014-01-29 16:24:50 +00:00
Hans Petter Selasky
cc47735350 - Remove some dead code.
- Use system provided functions for HID report requests.
- Nice the mode setting, because the USB hardware does appear to
handle the commands right away.

MFC after:	1 week
2014-01-29 12:34:05 +00:00
Hans Petter Selasky
eed447b59b Add support for trackpads found in Apple MacBook products. While at it
add some missing devd entries.

Submitted by:	Huang Wen Hui <huanghwh@gmail.com>
MFC after:	1 week
2014-01-29 10:42:01 +00:00
Hans Petter Selasky
1c006b57f6 When detaching a [USB] keyboard, keys might still be pressed. Ensure
that all pressed keys are released before completing the USB keyboard
detach. This will prevent so-called "ghost-keys" from appearing after
that the USB device generating the key event(s) has been detached.

MFC after:	1 week
2014-01-28 09:55:07 +00:00
Hans Petter Selasky
ef3187d5f5 Revert r260622:
To be implemented a bit differently.
2014-01-28 08:49:00 +00:00
Hans Petter Selasky
3525f1dbf2 Add more USB quirks.
Submitted by:	Gerrit Kuehn <gerrit.kuehn@aei.mpg.de>
MFC after:	1 week
2014-01-24 18:52:04 +00:00
Kevin Lo
51fcfa2666 Fix comment. 2014-01-24 15:34:22 +00:00
Hans Petter Selasky
5c8c627bf9 Hide now harmless warning from dmesg.
MFC after:	1 week
2014-01-24 15:05:28 +00:00
Kevin Lo
56ae078529 Get rid of memmove(). It's not portable.
Tested on RT3071, RT3573, RT3570, RT3572, and RT5572.

Reviewed by:	hselasky
2014-01-24 09:17:29 +00:00
Hans Petter Selasky
2719d9c909 Revert r261014. Let Kevin fix it.
MFC after:	1 week
2014-01-23 10:18:28 +00:00
Hans Petter Selasky
dfd7cd8014 We are using the old callout API and should also add one extra tick in
the FreeBSD 10 case.

Suggested by:	mav @
MFC after:	1 week
2014-01-22 17:50:43 +00:00
Hans Petter Selasky
2e74d8c857 - Fix some non-portable code with regard to endianness. Don't use memmove().
- Fix a range check for maximum transmit length.
- Fix read from missing field when transmitting data.

MFC after:	2 weeks
2014-01-22 09:57:26 +00:00
Hans Petter Selasky
924b1f5db0 Ensure that the DMA delay does not get rounded down to zero ticks when
a timeout value of a single tick is given. With FreeBSD-10 and newer
the current system time is used as a starting point, and the minimum
callout time of a single tick will be guaranteed. This patch mostly
affect the DMA delay timeouts, which are typically in the range from
0.125 to 2ms.

MFC after:	1 week
2014-01-22 07:48:39 +00:00
Hans Petter Selasky
3448548027 Wait a bit more before we free any EHCI DMA descriptors. Some USB
controllers need more time than others.

MFC after:	1 week
2014-01-22 07:32:55 +00:00
Hans Petter Selasky
338b63a918 Add new quirk.
PR:		usb/185968
MFC after:	1 week
2014-01-22 07:22:42 +00:00
Hans Petter Selasky
62b97a9adf Add support for GPS ports to UHSO driver.
Submitted by:	Lundberg, Johannes <johannes@brilliantservice.co.jp>
MFC after:	1 week
2014-01-20 07:09:19 +00:00
Hans Petter Selasky
f97da128ab Fix a possible memory use after free and leak situation associated
with USB device detach when using character device handles. This also
includes LibUSB. It turns out that "usb_close()" cannot always get a
reference to clean up its USB transfers and such, if called during the
kernel USB device detach.

Analysis by:	hselasky @
Reported by:	Juergen Lock <nox@jelal.kn-bremen.de>
MFC after:	1 week
2014-01-17 10:35:18 +00:00
Hans Petter Selasky
c7d8c1c6e0 Close a minor deadlock.
MFC after:	1 week
2014-01-17 08:21:09 +00:00
Hans Petter Selasky
8af981a406 Don't output any modifier keys before we see a valid
non-modifier key press. This prevents so-called "ghost
keyboards" keeping modifier keys pressed while not
actually seen as a real keyboard.

MFC after:	2 weeks
2014-01-14 08:43:38 +00:00
Hans Petter Selasky
a0d53e0b38 Implement better error recovery for Transaction Translators, TTs,
found in High Speed USB HUBs which translate from High Speed USB into
FULL or LOW speed USB. In some rare cases SPLIT transactions might get
lost, which might leave the TT in an unknown state. Whenever we detect
such an error try to issue either a clear TT buffer request, or if
that is not possible reset the whole TT.

MFC after:	1 week
2014-01-13 15:21:11 +00:00
Hans Petter Selasky
a148d44fb5 Separate I/O errors from reception of STALL PID.
MFC after:	1 week
2014-01-13 15:06:03 +00:00
Hans Petter Selasky
9ae7f7c13c Make sure reserved fields of the EHCI DMA descriptors are not dirty
after previous transfers.

MFC after:	1 week
2014-01-12 13:16:25 +00:00
Hans Petter Selasky
b353507895 Don't do synchronous USB requests inside USB transfer callbacks. It is
technically OK, but not recommended.

MFC after:	1 weeks
2014-01-12 11:44:28 +00:00
Kevin Lo
030dda5d1d Fix a logic error when checking if Tx power entries are greater than 31. 2014-01-11 14:48:16 +00:00
Hans Petter Selasky
67fd1a8fb6 Optimise interrupt logic. Technically writing a zero to the XHCI USB
status register has no effect. Can happen when the interrupt vector is
shared.

MFC after:	1 week
2014-01-11 08:16:31 +00:00
Hans Petter Selasky
13156a5241 Force clearing of event ring interrupts. The "Intel Lynx Point" XHCI
controller found in the MBP2013 has been observed to not work properly
unless this operation is performed.

MFC after:	1 week
Tested by:	Huang Wen Hui <huanghwh@gmail.com>
2014-01-11 08:10:01 +00:00
Hans Petter Selasky
5199761b66 Move USB ID from u3g driver to uhso driver.
Submitted by:	Lundberg, Johannes <johannes@brilliantservice.co.jp>
MFC after:	1 week
2014-01-11 07:53:03 +00:00
Kevin Lo
107f00c0b9 Use m_get2() instead of m_getcl().
Spotted by:	glebius
2014-01-10 14:47:20 +00:00
Kevin Lo
569dfed32c Use m_getcl() instead of MGETHDR/MCLGET macros.
Suggested by:	glebius
2014-01-10 02:47:20 +00:00
Kevin Lo
115ea7c105 Replace deprecated M_DONTWAIT with M_NOWAIT. 2014-01-09 01:48:33 +00:00
Kevin Lo
5945b5f5ab Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.
The origin of WEP comes from IEEE Std 802.11-1997 where it defines
whether the frame body of MAC frame has been encrypted using WEP
algorithm or not.
IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates
whether the frame is protected by a cryptographic encapsulation
algorithm.

Reviewed by:	adrian, rpaulo
2014-01-08 08:06:56 +00:00
Hans Petter Selasky
d08bc9e548 Check the XHCI event ring regardless of the XHCI status register
value. The "Intel Lynx Point" XHCI controller found in the MBP2013 has
been observed to not always set the event interrupt bit while there
are events to consume in the event ring.

MFC after:	1 week
Tested by:	Huang Wen Hui <huanghwh@gmail.com>
2014-01-07 09:52:26 +00:00
Kevin Lo
7a7e01caa4 Add support for the MediaTek/Ralink RT3593 chipset.
Committed over the ZyXEL NWD2705 on amd64 with WPA.
2014-01-03 06:01:05 +00:00
Hans Petter Selasky
682d7ab884 Minor correction for the XHCI reset logic.
MFC after:	1 week
Found by:	Horse Ma <HMa@wyse.com>
2014-01-02 08:02:57 +00:00
Dimitry Andric
96106c9665 In sys/dev/usb/wlan/if_urtw.c, #if 0 a static const variable, which has
been unused since r198194.

MFC after:	3 days
2013-12-29 20:05:48 +00:00
Kevin Lo
959af34776 Add D-Link DWA-140 rev D1, another RT5372/run(4).
From Anton Mazunin.
2013-12-27 08:03:53 +00:00
Kevin Lo
7dc4b90e74 Some devices have a dual mode such as Tenda W326U and ZyXEL NWD2705,
add the product id and use a standard scsi eject.

Tested on the ZyXEL NWD2705 wlan dongle.
2013-12-24 07:02:05 +00:00
Don Lewis
ccdfa3b5f1 Add quirks to make my old SanDisk Cruzer Mini 128MB happy.
MFC after:	1 week
2013-12-21 03:05:13 +00:00
Kevin Lo
9df3ee0758 Use 'val' instead of 'val & 0xff' since the last argument of run_bbp_write()
is uint8_t.

Spotted by:	yongari
2013-12-18 08:53:40 +00:00
Kevin Lo
fd8fcee579 Fix style: add tab after #define. 2013-12-18 08:39:12 +00:00
Kevin Lo
c48c6bf8fc Fix typo in comment. 2013-12-18 07:47:50 +00:00
Kevin Lo
010b13fa94 Add support to IQ calibration. 2013-12-18 07:34:57 +00:00
Hans Petter Selasky
6f0468df7a Fix regression issue after r259248:
Some Intel XHCI controlles timeout processing so-called "TRBs" when
the final LINK TRB of a so-called "TD" has the CHAIN-BIT set.

MFC after:	1 week
Tested by:	glebius @
2013-12-16 10:50:13 +00:00
Hans Petter Selasky
27ce2fd67c Set chain bit correctly. This will fix some problems sending and
receiving Zero Length Packets, ZLPs. See comment in code for more
information.

MFC after:	1 week
Reported by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
2013-12-12 08:34:51 +00:00
Hans Petter Selasky
e892b3fe36 USB method structures for USB controllers and USB pipes should be
constant and does not need to be modified. This also saves a small
amount of RAM.
2013-12-11 13:20:32 +00:00
Hans Petter Selasky
468f354b0e Fix typos.
Found by:	remko
2013-12-08 06:52:22 +00:00
Hans Petter Selasky
daab849b2c Fix compilation when the "USB_DEBUG" option is set. 2013-12-06 22:13:51 +00:00
Kevin Lo
242dbae34c Add support for the MediaTek/Ralink RT5572 chipset.
Committed over the TP-LINK TL-WDN3200 (RT5572) on amd64 with WPA.

While here, add my copyright.
2013-12-06 15:26:39 +00:00
Kevin Lo
e0790ad8eb Replace the magic numbers with something more readable. 2013-12-06 15:17:28 +00:00
Kevin Lo
b8161ff3c1 Cosmetic changes. 2013-12-06 15:15:58 +00:00
Kevin Lo
1d66c7a9cf Remove daft KASSERT. 2013-12-06 15:14:18 +00:00
Hans Petter Selasky
563ab08139 Improve the XHCI command timeout recovery handling code.
MFC after:	1 week
2013-12-06 08:42:41 +00:00
Hans Petter Selasky
bce421e9f7 Fix external compiler warning about write-only assigned variable. 2013-12-05 07:18:06 +00:00
Hans Petter Selasky
0aff597a1f Fix what looks like a typo after r258732. 2013-12-04 12:30:51 +00:00
Hans Petter Selasky
8cfe54400e Fix external compiler warning(s). Avoid pointer dereferencing. 2013-12-04 12:07:46 +00:00
Kevin Lo
405886883d The RUN_MAX_TXSZ constat is defined as Tx desc + Tx wireless info + MCLBYTES +
max padding.  We were lucky in that run(4) working fine since both
rt2860_rxwi and rt2860_txwi structure sizes are the same.
2013-12-02 09:07:43 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with:	-arch, rdivacky
Reviewed by:	cperciva
2013-11-30 22:17:27 +00:00
Kevin Lo
5b7514646c Change run_rt2870_rf_write() prototype (no functional change) 2013-11-29 07:08:17 +00:00
Kevin Lo
5f7e329cec On the RT2870, rf registers are now 64-bit, not 32-bit after r257955.
Committed over a Buffalo WLI-UC-AG300N (RT2870).
2013-11-29 06:10:44 +00:00
Hans Petter Selasky
361f264ba0 Style changes. 2013-11-26 11:11:24 +00:00
Hans Petter Selasky
beb13f0407 Add missing static keyword.
MFC after:	2 weeks
2013-11-26 10:53:12 +00:00
Hans Petter Selasky
5c0f828a07 Comply to the XHCI specification. Certain input context fields should
always be zero.

MFC after:	1 week
2013-11-25 10:58:02 +00:00
Don Lewis
3ca52b0d34 Add alternate ID for Novatel MiFi 2200 CDMA, which is used by my
Virgin Mobile branded device.  It needs the U3GINIT_SCSIEJECT quirk.

Reviewed by:	hselasky
MFC after:	1 month
2013-11-20 02:16:47 +00:00
Mark Johnston
da089c1410 Import the axge(4) driver for the ASIX AX88178A and AX88179 USB Ethernet
adapters. Both devices support Gigabit Ethernet and USB 2.0, and the AX88179
supports USB 3.0. The driver was written by kevlo@ and lwhsu@, with a few
bug fixes from me.

MFC after:	2 months
2013-11-19 00:37:53 +00:00
Alexander Motin
eda36fb4f5 Add some more IDs for Intel ATA, AHCI and USB controllers. 2013-11-15 10:28:59 +00:00
Kevin Lo
0f3728be20 Remove a couple of unused macros. 2013-11-13 05:22:39 +00:00
Kevin Lo
28dfd8415b - Use bit twiddling macro to set IEEE80211_MODE_11A
- On the RT3572 chipset, there's no need to configure BBP register 86
2013-11-13 05:21:41 +00:00
Mark Johnston
aae2e36cd5 Add IDs for the ASIX 88179 and 88178A USB to GigE adapters. 2013-11-12 06:14:12 +00:00
Kevin Lo
bf124fcf1e Use the real product name for Edimax rsu(4) id. 2013-11-12 02:34:48 +00:00
Kevin Lo
67e73b2b2d Remove r257748 by accident. 2013-11-11 10:00:19 +00:00
Kevin Lo
64891211ca Add support for the MediaTek/Ralink RT5370/RT5372 chipset.
Tested with the TP-Link TL-WN727N (RT5370) and the D-Link DWA-140 (RT5372)
on i386/amd64/arm with WPA.
2013-11-11 09:47:33 +00:00
Hans Petter Selasky
415fd8a3dc Implement a working write region function to speed up loading of the
firmware. You can test this change by switching the "#if 1" statement
right above in the patched code to "#if 0" !

MFC after:	1 week
2013-11-06 15:32:37 +00:00
Hans Petter Selasky
bb2f69e83f Check for "ieee80211_vap_setup()" failure in all USB WLAN drivers.
MFC after:	1 week
2013-11-06 12:57:01 +00:00
Kevin Lo
ae7d66f220 Reading the RT2860_ASIC_VER_ID register is not needed and returns
completely bogus value.
2013-11-06 02:49:16 +00:00
Hans Petter Selasky
2764a2784f Protect the "ratectl_ch" callout in the "run" driver by the "run"
softc's "sc->sc_mtx" mutex. Currently the callout was marked
multi-processor safe, which is fine, but it is better to
start/stop/reset callouts while holding the "run" drivers own
mutex. While at it add a missing "ULL" at end of the 64-bit unsigned
integer constant.

MFC after:	1 week
2013-11-05 18:27:25 +00:00
Hans Petter Selasky
7815365774 Add description of two EHCI PCI IDs.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2013-11-03 21:33:42 +00:00
Alfred Perlstein
50903998f0 Add device ID for 'Sanoxy 802.11N' usb 2013-11-02 11:37:16 +00:00
Adrian Chadd
c48efaecf6 Allow the Arduino Leonardo to work by supporting CDC=0 devices.
CDC=0 simply means "no command codes", CDC=1 means "AT command codes."
There's no driver change required!  It's purely to tell the application
layer whether to speak AT commands or not.  Things are all still serial.

PR:		usb/183505
Reviewed by:	hps
MFC after:	1 week
2013-10-31 13:54:51 +00:00
Hans Petter Selasky
645826bef4 Fix a potential memory leak.
MFC after:	1 week
2013-10-31 11:03:36 +00:00
Hans Petter Selasky
35a2489852 Fix some types. Compilation for external target complains that "u_int"
is not idential to "uint32_t" when defining set channel prototype
functions. The WLAN channel range should be from 0 to 65535
inclusivly, and u_int should be fine for this purpose.
2013-10-31 09:20:30 +00:00
Kevin Lo
30dfa97944 Add RT2860_BCN_OFFSET1 and RT2860_MAX_LEN_CFG register initialization to
match with the vendor driver.  While here, remove unused RT2860_DEF_MAC
definition.
2013-10-31 02:03:30 +00:00
Kevin Lo
1365315d41 Initialize BBP68 to improve rx sensitivity. 2013-10-31 02:02:14 +00:00
Kevin Lo
c513ecfd12 Enable DC filter in RT3071 Version E. 2013-10-31 02:00:58 +00:00
Ian Lepore
f26c810514 Rework the imx ehci driver so that it's four separate ehci units rather
than one unit with four busses attached to it.  This allows us to use
existing fdt data which describes separate devices with separate resources.
It also allows any combination of the units to be en/disabled in the
board dts files.

Adjust our dts code to match what's used by linux and u-boot now that
we're structured to do so.

Document lots of interesting stuff learned whiling doing this with a big
comment block in the driver, so I don't have to re-learn it for the next
round of changes.
2013-10-30 18:26:18 +00:00
Ian Lepore
22aa1751eb Add a vendor entry for Freescale Semiconductor. 2013-10-30 16:34:26 +00:00
Nathan Whitehorn
123055f01f Adjust various SCSI drivers to handle either a 32-bit or 64-bit lun_id_t,
mostly by adjustments to debugging printf() format specifiers. For high
numbered LUNs, also switch to printing them in hex as per SAM-5.

MFC after: 2 weeks
2013-10-30 14:04:47 +00:00
Gleb Smirnoff
c3322cb91c Include necessary headers that now are available due to pollution
via if_var.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-28 07:29:16 +00:00
Hans Petter Selasky
d6f4a9f9f6 Fix a deadlock when trying to power off a USB device. The deadlock
happens because the code in question is trying to modify the parent
USB port registers outside the USB explore thread.

MFC after:	3 days
2013-10-27 10:09:53 +00:00
Gleb Smirnoff
61a3ac6e27 The MII layer shouldn't care about administrative status of an
interface. Make MII drivers forget about 'struct ifnet'.

Later plan is to provide an administrative downcall from ifnet
layer into drivers, to inform them about administrative status
change. If someone thinks that processing MII events for an
administratively down interface is a big problem, then drivers
would turn MII processing off.

The following MII drivers do evil things, like strcmp() on
driver name, so they still need knowledge of ifnet and thus
include if_var.h. They all need to be fixed:

sys/dev/mii/brgphy.c
sys/dev/mii/e1000phy.c
sys/dev/mii/ip1000phy.c
sys/dev/mii/jmphy.c
sys/dev/mii/nsphy.c
sys/dev/mii/rgephy.c
sys/dev/mii/truephy.c

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-26 18:40:17 +00:00
Gleb Smirnoff
76039bc84f The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-26 17:58:36 +00:00
Nick Hibma
d884c4ddaa Add id for GTM661W. 2013-10-25 19:39:22 +00:00
Kevin Lo
d4d0412bc9 Fix the RT2860_TX_SW_CFG2 init value on older revisions of RT3070 chip. 2013-10-23 09:53:37 +00:00
Ganbold Tsagaankhuu
8f011d4075 Move and rename dwc otg driver to more
generic one as it appears to work
for rk3188 SoC based board too.

No objections from: hselasky@
Reviewed by: ray@
2013-10-21 09:34:04 +00:00
Gavin Atkinson
ee0d8611db Add 26 new device IDs to uslcom(4). This brings us in sync with Linux
v3.12 rc5.

MFC after:	3 days
2013-10-20 11:19:37 +00:00
Hans Petter Selasky
2c452d7400 Improve XHCI stability. When a command timeout happens, the command
should be aborted else the command queue can stop. Refer to section
"4.6.1.2" of the XHCI specification.

MFC after:	1 week
2013-10-18 17:38:57 +00:00
Kevin Lo
d48971d0d2 Correct tx mixer gain value for RT3070 and RT3071.
Correctly value in EEPROM/EFUSE is one or more for RT3070 and
two or more for other RT3071 chips.
2013-10-18 07:48:20 +00:00
Kevin Lo
6bf8d884ad Since the DAC issue has been fixed in RT3070(F), the voltage raising fix
is no longer needed.
2013-10-18 07:46:28 +00:00
Kevin Lo
5d534170af Fix lower bits of RF_R3 for RT3370 and newer. This change doesn't affect
older chipsets.
2013-10-18 07:43:49 +00:00
Kevin Lo
9648d6ae84 Fix rf registers for RT3070. 2013-10-18 07:42:16 +00:00
Hans Petter Selasky
5c767719b0 Correct programming of XXX_MAXP register. This register is 16-bit wide
and not 8-bit. Fix support for isochronous transfers in USB host mode.
Fix a whitespace while at it.

MFC after:	1 week
Reported by:	SAITOU Toshihide <toshi@ruby.ocn.ne.jp>
PR:		usb/181987
2013-10-15 17:11:13 +00:00
Hans Petter Selasky
57733723fe Add new USB ID.
PR:		usb/182936
Submitted by:	Keith White <kwhite@site.uottawa.ca>
MFC after:	1 week
2013-10-15 06:23:54 +00:00
Hans Petter Selasky
4c5d13237f Stability fixes for Intel LynxPoint XHCI controllers. Disable XHCI port
routing if we get certain errors. Poll for command completion upon
command timeouts. The XHCI error events might not generate interrupts.

MFC after:	1 week
Reported by:	Daniel Gerzo <danger@rulez.sk>, Antonis Anastasiadis <anastasiadis@datalive.gr>
PR:		usb/181159
Approved by:	re (gjb)
2013-09-21 21:40:57 +00:00
Hans Petter Selasky
418b87f8e6 Don't issue USB resume signalling in USB device mode, if the USB power
mode is ON and suspend is detected. This confuses iPads running in USB
host mode at least.

MFC after:	1 week
Approved by:	re (hrs)
2013-09-12 10:39:38 +00:00
Hans Petter Selasky
3dc1e567e5 Clear correct data structure.
MFC after:	1 week
Approved by:	re (hrs)
2013-09-11 10:18:36 +00:00
Gleb Smirnoff
540b1a7238 Clean up SIOCSIFDSTADDR usage from ifnet drivers. The ioctl itself is
extremely outdated, and I doubt that it was ever used for ifnet drivers.
It was used for AF_INET sockets in pre-FreeBSD time.

Approved by:	re (hrs)
Sponsored by:	Nginx, Inc.
2013-09-11 09:19:44 +00:00
Hans Petter Selasky
c6fe3731df Revert parts of r245132 and r245175. We don't need to write to the
IMAN register to clear the pending interrupt status bits. This patch
tries to solve problems seen on the MacBook Air, as reported by
Johannes Lundberg <johannes@brilliantservice.co.jp>

MFC after:	1 week
2013-09-07 10:42:00 +00:00
Hans Petter Selasky
549c5c8798 Disable USB 3.0 streams mode by default, hence not all XHCI chipsets
implement it to avoid undefined behaviour.
2013-09-07 06:53:59 +00:00
Ruslan Bukin
c7e4729da4 Add support for DLINK DWA-127 Wireless Adapter
Approved by:	cognet (mentor)
2013-09-05 10:09:24 +00:00
Ian Lepore
e5efecdbeb Add the device ID for a new flavor of FTDI serial adapter (model 232EX). 2013-09-01 14:15:31 +00:00
Hans Petter Selasky
33f4aa115d Sync USB bluetooth product list with Linux.
MFC after:	1 week
2013-08-31 06:47:53 +00:00
Hans Petter Selasky
8f39f442c9 Bugfix: The endpoint profile should only be checked in device mode when
allocating USB transfers and not in host mode.

Reported by:	George Mitchell <george+freebsd@m5p.com>
2013-08-25 08:42:50 +00:00
Hans Petter Selasky
3a8f0c444a Force keyboards which don't have the required
HID fields to use the USB BOOT protocol for now.

PR:		usb/181425
Submitted by:	Andrey Zholos <aaz@q-fu.com>
MFC after:	4 weeks
2013-08-20 16:21:05 +00:00
Hans Petter Selasky
3147331e16 Fix some USB controller names according to pciconf output.
MFC after:	1 week
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2013-08-17 06:29:45 +00:00
Kevin Lo
612cf1ca01 Bring datasheet URL up to date. 2013-08-16 07:42:06 +00:00
Hans Petter Selasky
62a963c5f5 - Try to fix build of 32-bit compatibility USB support for FreeBSD and
Linux targets without breaking the existing IOCTL API.

- Remove some not-needed header file inclusions.

- Wrap a long line.

MFC after:	1 week
Reported by:	Damjan Jovanovic <damjan.jov@gmail.com>
2013-08-12 09:17:48 +00:00
Hans Petter Selasky
fcd51bb4fa Correct an EHCI register write.
MFC after:	1 week
Reported by:	aseem.jolly@gmail.com
2013-08-12 06:09:28 +00:00
Rui Paulo
53dfd5c108 Cleanup the allocations when the attachment fails. 2013-07-31 06:05:34 +00:00
Rui Paulo
6d9b2f85f8 Unbreak sparc64 LINT. Need to fix this correctly at some point in the future. 2013-07-30 16:17:30 +00:00
Rui Paulo
31d9867769 Import OpenBSD's rsu(4) WLAN driver.
Support chipsets are the Realtek RTL8188SU, RTL8191SU, and RTL8192SU.

Many thanks to Idwer Vollering for porting/writing the man page and for
testing.

Reviewed by:	adrian, hselasky
Obtained from:	OpenBSD
Tested by:	kevlo, Idwer Vollering <vidwer at gmail.com>
2013-07-30 02:07:57 +00:00
Hans Petter Selasky
e8353a7a69 Fix alignment of USB WLAN radiotap headers. This makes USB WLAN adapters
work on ARM, MIPS and similar platforms, where alignment matters.

MFC after:	1 week
Reported by:	XiaoQI Ge <ghw@7axu.com>
2013-07-29 05:54:13 +00:00
Hans Petter Selasky
06fc83e85b Assume that all Apple products using interface class 255, subclass 253
and protocol 1 are USB ethernet adapters. This avoids keeping and updating
the product list every now and then. This patch will add support for the
USB ethernet interface found in the IPAD.

MFC after:	1 week
2013-07-26 09:58:56 +00:00
David E. O'Brien
1ae56a1ce4 per style(9):
Kernel include files (i.e. sys/*.h) come first; normally, include
   <sys/types.h> OR <sys/param.h>, but not both.  <sys/types.h> includes
   <sys/cdefs.h>, and it is okay to depend on that.
2013-07-24 18:32:15 +00:00
Hans Petter Selasky
46902503bc Add some USB gadget example drivers for USB audio, USB keyboard,
USB mouse and USB modem classes. Hopefully someone will find
these examples useful when implementing USB device side drivers
using the FreeBSD USB stack.
2013-07-22 13:39:33 +00:00
Hans Petter Selasky
25cedb6f51 Fix an XHCI regression:
The Block Event Interrupts, BEI, feature does not
work like expected with the Renesas XHCI chipsets.
Revert feature.

While at it correct the TD SIZE computation in
case of Zero Length Packet, ZLP, in the end of a
multi frame USB transfer.

MFC after:	1 week
PR:		usb/180726
2013-07-21 20:45:23 +00:00
Navdeep Parhar
b564fe858c There's nothing to free if the unit wasn't allocated. 2013-07-19 21:54:48 +00:00
Konstantin Belousov
31b67ab26e Add a tunable to force disable MSI use for xhci(4).
Requested and tested by:	delphij
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2013-07-16 20:14:23 +00:00
Rui Paulo
fc4153c26f Revert r252725 as it breaks WPA.
We need to fix wpa_supplicant because it checks whether the card has
ic_cryptocaps set. Since net80211 can do software encryption this check in
wpa_supplicant is wrong.
2013-07-14 18:26:47 +00:00
Hans Petter Selasky
0ccd2fb09e Allow regular off-the-shelf keyboards to be overclocked like so-called
"Gamers Keyboards" by adding a tunable, "hw.usb.ukbd.pollrate", which
can fix the polling rate of the attached USB keyboards in the range
1..1000Hz. A similar feature already exists in the USB mouse
driver. Use with care! Might leave you without keyboard input. This
feature is only available when the USB_DEBUG option is set in the
kernel configuration file.

Correct "unit" type to "int" while at it.
2013-07-13 22:39:56 +00:00
Hiren Panchasara
3c9d5a037d Adding urtwn(4) firmware and related changes.
Reviewed by:	rpaulo
Approved by:	sbruno (mentor)
2013-07-10 08:21:09 +00:00
Konstantin Belousov
89d02670ab Use MSI for xhci(4), if supported.
Reviewed by:	jhb
Tested by:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2013-07-09 12:55:01 +00:00
Oleksandr Tymoshenko
860e12e971 - Add initial host mode support for Mentor Graphics USB OTG controller
- Sync musb_otg_atmelarm with new core logic API
2013-07-07 04:18:35 +00:00
Rui Paulo
2173825bac Set ic_cryptocaps to make sure wpa_supplicant works with WEP. 2013-07-04 20:57:15 +00:00
Hiroki Sato
52d5f34490 Add Planex MZK-UE150N.
Submitted by:	Yusuke Tanaka
MFC after:	3 days
2013-07-02 07:35:57 +00:00
Rui Paulo
a5dcb0640f Add RealTek 8192SU product IDs. 2013-07-02 06:49:05 +00:00
Rui Paulo
efb6af5c24 Fix a typo. 2013-06-30 06:05:32 +00:00
Rui Paulo
d718126e58 Fix the RSSI calculation. 2013-06-30 06:04:00 +00:00
Rui Paulo
bd3d8bed6c Fix the ni_txrate calculation. 2013-06-30 05:25:24 +00:00
Rui Paulo
fd57292555 Fix a reference count bug in urtwn_ra_init(). 2013-06-30 05:10:33 +00:00
Remko Lodder
c68a57b8f6 Add support for the NTT Docomo L-02C card.
(This file didn't get along in the previous commit)

PR:		180017
Submitted by:	Masaharu FUJITA
Glanced at by:	imp
MFC after:	1 week
2013-06-27 09:08:07 +00:00
Remko Lodder
80196fbd91 Add support for the NTT Docomo L-02C card.
PR:		180017
Submitted by:	Masaharu FUJITA
Glanced at by:	imp
MFC after:	1 week
2013-06-27 09:06:00 +00:00
Kevin Lo
1d02cf7c8d Add support for D-Link DWA-131. 2013-06-25 06:43:04 +00:00
Pyun YongHyeon
7008404ddd Add Lenovo USB 2.0 Ethernet adapter.
PR:		usb/179920
MFC After:	1 week
2013-06-25 00:26:30 +00:00
Pyun YongHyeon
fec40c2d03 When RX checksum offloading is active, AX88772B will prepend a
checksum header.  The header contains a received frame length but
the defined length for AX88772B is different with other ASIX
controllers.  When the RX checksum is off, AX88772B controller does
not prepend a checksum header so driver has to use normal header
length mask.
This change should fix RX errors when RX checksum offloading is
off.

Tested by:	kevlo
MFC After:	1 week
2013-06-24 05:18:31 +00:00
Thomas Quinot
73ecbbb39c Revert previous change to uark.c (restore previous rev), which was
committed by mistake.
2013-06-23 20:22:49 +00:00
Thomas Quinot
9aa5c929ba Fix minor typo in comment 2013-06-23 20:19:51 +00:00
Kevin Lo
ebe0102309 - Use the consistenly PHY-specific reset routine PHY_RESET() rather than
generic mii_phy_reset().
- Return the result of mii_mediachg() rather than blindly returning 0.
- on smsc(4), driver lock should be held to get current
  mii_media_active/mii_media_status value.

Reviewed by:	yongari
2013-06-14 05:36:47 +00:00
Kevin Lo
85edd2e8f9 Remove unused variable sc_tx_bufsz.
The variable is initialized but not used.

Reviewed by:	yongari
2013-06-13 05:46:19 +00:00
Kevin Lo
f08b3a501a Fix a typo: s/KLSI/CATC/ 2013-06-13 01:33:01 +00:00
Rui Paulo
71c50b9ef2 Use STRUCT_USB_HOST_ID to make sure we have the right ELF section. 2013-06-10 05:45:16 +00:00
Rui Paulo
c2c2fc4d86 Import Kevin Lo's port of urtwn(4) from OpenBSD. urtwn(4) is a driver for the
Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless cards.
This driver requires microcode which is available in FreeBSD ports:
net/urtwn-firmware-kmod.

Hiren ported the urtwn(4) man page from OpenBSD and Glen just commited a port
for the firmware.

TODO:
- 802.11n support
- Stability fixes - the driver can sustain lots of traffic but has trouble
coping with simultaneous iperf sessions.
- fix debugging

MFC after:	2 months
Tested by:	kevlo, hiren, gjb
2013-06-08 16:02:31 +00:00
Hans Petter Selasky
d5d96494f8 Fix some recent regression issues:
1) Only multi-TD isochronous transfers should use NORMAL
type after specific type as per XHCI specification.

2) BEI bit is only available in NORMAL and ISOCHRONOUS
TRB types. Don't use this bit for other types to avoid
hardware asserts. Reserved bits should be don't care
though ...

MFC after:	1 week
PR:		usb/179342
2013-06-07 22:35:58 +00:00
Hans Petter Selasky
97d729cf33 Add support for polling the XHCI interrupt handler when
the regular interrupt handler is not working properly or
in case of MSI interrupts which are not yet supported.
Remove interrupt setup code for FreeBSD versions older
than 700031.

MFC after:	1 week
PR:		usb/179342
2013-06-07 14:30:06 +00:00
Hiren Panchasara
15e45369fe Fixing a typo.
Approved by:	sbruno (mentor)
MFC after:	3 days
2013-06-03 22:22:53 +00:00
Hans Petter Selasky
e45547006e Correct the TD size computation. npkt should reflect the number of packets
remaining after the current TRB has been executed. Refer to section 4.11.2.4
of the XHCI specification for USB.

MFC after:	1 week
2013-06-02 12:28:29 +00:00
Hans Petter Selasky
c82b624fdc Correct TRB type for multi TRB transfers of non-NORMAL type, like isochronous.
Only the first TRB should be markes as special. Subsequent ones should be
marked as NORMAL. Optimise away TD first variable.

MFC after:	1 week
2013-06-02 12:16:58 +00:00
Hans Petter Selasky
fc66305366 Use the correct constant for 8000 IRQ/s.
MFC after:	1 week
2013-06-02 12:00:16 +00:00
Hans Petter Selasky
60decf203d Block event interrupts when we don't need it as soon as possible.
Typically this feature is used for isochronous transfers.
This reduces the amount of XHCI interrupting.

MFC after:	1 week
2013-06-02 11:58:31 +00:00
Hans Petter Selasky
ef32af2180 Don't set the start ISOC ASAP bit for non-isochronous TRBs.
MFC after:	1 week
2013-06-02 10:54:47 +00:00
Hans Petter Selasky
cfa00b0d75 Correct some XHCI streams mode transfer handling found by code inspection.
The existing streams mode support is not working and has not been tested
due to lack of hardware which supports the given feature.

MFC after:	1 week
2013-06-02 10:32:57 +00:00
Eitan Adler
8753048d82 Add support for tethering on the iPhone 4S
PR:	usb/179078
Submitted by:	Christopher Sean Hilton <chris@vindaloo.com>
MFC After:	1 week
2013-05-29 20:36:51 +00:00
Hans Petter Selasky
8c93cb8131 Revert r251023 until a more proper solution is found
for ATI based USB controllers.

MFC after:	1 week
2013-05-28 18:51:30 +00:00
Hans Petter Selasky
6e7bc5b60d Workaround for for a problem seen with ATI Technologies EHCI
controller hardware most likely present on UHCI chipsets aswell. The
bug manifests itself when issuing isochronous transfers and bulk
transfers towards the same device simultaneously. From time to time it
happens that either the completion IRQ was missing or that the
completion IRQ was happening before the ITD/SITD was completely
written back to memory. The workaround assumes that double buffered
isochronous transfers are used, and that a second interrupt is
generated at the beginning of the next isochronous transfer to
complete the previous one. Possibly skipping the interrupt at the last
isochronous frame is possible, but will then break single buffered
isochronous transfers. For now we can live with some extra interrupts.

MFC after:	1 week
2013-05-27 06:32:07 +00:00
Hans Petter Selasky
273c749c93 Fix some statical clang analyzer warnings. 2013-05-25 17:09:58 +00:00
Hans Petter Selasky
6d5ae34a44 Add new USB quirk.
MFC after:	1 week
PR:		usb/178771
2013-05-21 06:13:38 +00:00
Warner Losh
8b18cb1c23 For ARM, MIPS, and PowerPC, default to 32-byte alignment, but allow it
to be as small as 8.
2013-05-17 20:53:15 +00:00
Gavin Atkinson
1c6951aeb6 o Retrive the part number (CP2103 etc) from the hardware on attach.
o  The CP2101 and CP2102 do not support GPIO pin use at all, enforce this.
o  Support reading the GPIO status on the second port of the CP2105.  More
   work is needed before the CP2105 GPIO pins can be used as outputs.

Hardware donated by:	Silicon Labs
MFC after:		3 weeks
2013-05-17 19:13:31 +00:00
Eitan Adler
a164074fc4 Fix several typos
PR:		kern/176054
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	3 days
2013-05-12 16:43:26 +00:00
Hans Petter Selasky
6c21893360 Fix compile warning. 2013-05-03 13:33:36 +00:00
Hans Petter Selasky
2c79a775ed - Add more defines to limit USB memory usage and number of allocations
in reduced memory systems.

- Split allocation and freeing of the configuration descriptor into a separate
function, so that the configuration descriptor can be made fixed size
to save memory allocations. This applies for both device and host mode.
2013-05-03 11:10:04 +00:00
Hans Petter Selasky
6a4dd49e2c Always put space before the comma before ##__VA_ARGS__ due to subtle compiler
differences.
2013-05-03 10:13:29 +00:00
Hans Petter Selasky
5b0752bbc1 Add some defines to limit USB memory usage in reduced memory systems. 2013-05-03 09:23:06 +00:00
Hans Petter Selasky
fa49bce566 Allow the default USB template to be specified at compile time. 2013-05-03 08:19:09 +00:00
Hans Petter Selasky
c77a24c24a Add new USB API to get the port path of a USB device.
MFC after:	2 weeks
Requested by:	emaste @
2013-05-03 07:44:58 +00:00
Gleb Smirnoff
47e8d432d5 Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
Hans Petter Selasky
751aaf5a93 Add convenience wrapper functions to run callbacks in the context of the
USB explore thread.
2013-04-23 10:42:15 +00:00
Hans Petter Selasky
0cfbd57ebc Add descriptive comment. 2013-04-23 06:26:54 +00:00