Commit Graph

3662 Commits

Author SHA1 Message Date
Hans Petter Selasky
b265897c37 Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.

MFC after:	1 week
2016-02-23 18:17:01 +00:00
Hans Petter Selasky
ecc7ce0f3e Be more verbose when truncating number of HID items.
Suggested by:	Larry Rosenman <ler@lerctr.org>
MFC after:	1 week
2016-02-23 14:58:20 +00:00
Kevin Lo
c9b6e63dd3 Add device ID for 'AboCom 802.11n' usb.
PR:	207412
Submitted by:	Philippe Michaud-Boudreault <pitwuu at gmail dot com>
2016-02-23 01:56:58 +00:00
Andriy Voskoboinyk
6e2ab41693 urtwn: shutdown the device properly
- R92C path: NetBSD (mostly)
- R88E path: TP-Link driver

Tested with RTL8188EU and RTL8188CUS.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5198
2016-02-22 01:15:02 +00:00
Andriy Voskoboinyk
7873b2abd6 urtwn: add an option to compile the driver without firmware specific code
- Add URTWN_WITHOUT_UCODE option (will disable any firmware specific code
when set).
- Do not exclude the driver from build when MK_SOURCELESS_UCODE is set
(URTWN_WITHOUT_UCODE will be enforced unconditionally).
- Do not abort initialization when firmware cannot be loaded;
behave like the URTWN_WITHOUT_UCODE option was set.
- Drop some unused variables from urtwn_softc structure.

Tested with RTL8188EU and RTL8188CUS in HOSTAP and STA modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4849
2016-02-22 00:48:53 +00:00
Hans Petter Selasky
d5fb67a401 Restore maximum number of host keys to 64.
Discussed with:	adrian @ and avos @
2016-02-14 16:18:39 +00:00
Hans Petter Selasky
8cb15594b3 Fix variable assignment inside if-clause in the smsc driver.
Found by D5245 / PVS.

MFC after:	1 week
2016-02-14 07:20:07 +00:00
Hans Petter Selasky
fe3e452399 Reduce the number of supported WLAN keys in the rum driver, else we
risk bit shifting overflows. Found by D5245 / PVS.

MFC after:	1 week
2016-02-14 07:16:36 +00:00
Hans Petter Selasky
4bc7e098c7 Correct PCI device description.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2016-02-10 08:03:10 +00:00
Gleb Smirnoff
8ec07310fa These files were getting sys/malloc.h and vm/uma.h with header pollution
via sys/mbuf.h
2016-02-01 17:41:21 +00:00
Michal Meloun
477aff3eae EHCI: Correct address of EHCI_USBMODE_LPM register is 0xC8, not 0xA8. 2016-01-30 08:27:09 +00:00
Michal Meloun
cdf4ec6873 EHCI: Make core reset and port speed reading more generic.
Use driver settable callbacks for handling of:
- core post reset
- reading actual port speed

Typically, OTG enabled EHCI cores wants setting of USBMODE register,
but this register is not defined in EHCI specification and different
cores can have it on different offset.

Also, for cores with TT extension, actual port speed must be determinable.
But again, EHCI specification not covers this so this patch provides
function for two most common variant of speed bits layout.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D5088
2016-01-28 14:11:59 +00:00
Andriy Voskoboinyk
218592ceed urtwn: add temperature calibration
Redo LC calibration if temperature changed significantly since last
calibration.

Tested with RTL8188EU/RTL8188CUS in STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Obtained from:	NetBSD (mostly)
Differential Revision:	https://reviews.freebsd.org/D4966
2016-01-20 23:55:39 +00:00
Andriy Voskoboinyk
01ff64089c urtwn: rework debug handling
- Use bitmap for debug output selection.
- Add few new messages (one for URTWN_DEBUG_BEACON
and another one for URTWN_DEBUG_INTR).
- Replace an undocumented URTWN_DEBUG definition with USB_DEBUG.

Tested with RTL8188EU / RTL8188CUS in IBSS / HOSTAP modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4959
2016-01-20 23:27:02 +00:00
Andriy Voskoboinyk
783c605101 urtwn: use ic_updateslot method to handle slot time change
(by default it was set to 9us).

Tested with RTL8188EU / RTL8188CUS in STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4535
2016-01-20 23:01:33 +00:00
Zbigniew Bodek
5c8fae4064 Improve attachment of the ehci_mv driver
Driver was modified to ensure it attaches properly to "marvell,orion-ehci"
node, which doesn't have error interrupt line defined. Neccessary
ofw_compat_data struct was added and probe procedure was altered.

Reviewed by:    andrew, ian
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4369
2016-01-20 13:58:07 +00:00
Ian Lepore
5508dc2afe Make PPS ASSERT/CLEAR events match the RS-232 signal levels as per RFC 2783.
Previously the polarity was for TTL levels, which are the reverse of RS-232.

Also add handling of the UART_PPS_INVERT_PULSE option bit in the sysctl
value, the same as was recently added to uart(4), so that people using TTL
level connections can request a logical inverting of the signal.

Use the named constants from the new dev/uart/uart_ppstypes.h for the pps
capture modes and option bits.
2016-01-17 21:19:45 +00:00
Andriy Voskoboinyk
8a1d6d278d urtwn: add ROM structure for RTL8188EU
- Add the structure with already known fields offsets
  (some of them were taken from this driver,
  some (channel_plan, rf_* fields) - from TP-LINK official driver)
- Fix a typo / dehardcode a constant in RTL8192C ROM structure.

Tested with RTL8188EU, STA mode

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4274
2016-01-17 00:52:21 +00:00
Warner Losh
64535e84f6 Move ohci files to their proper place in the tree for atmel.
Fix when it is included (we don't have a at91rm9200 device).
From a similar patch in the PR, with tweaked names.

PR: 206229
2016-01-16 04:47:32 +00:00
Hans Petter Selasky
ac3490fdef Use the recently added "make_dev_s()" function to solve old race setting the
si_drv1 field in "struct cdev" when creating new character devices.
2016-01-15 12:09:15 +00:00
Andriy Voskoboinyk
0046e1868f net80211 drivers: fix ieee80211_init_channels() usage
Fix out-of-bounds read (all) / write (11n capable) for drivers
that are using ieee80211_init_channels() to initialize channel list.

Tested with:
 * RTL8188EU, STA mode.
 * RTL8188CUS, STA mode.
 * WUSB54GC, HOSTAP mode.

Approved by:	adrian (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4818
2016-01-07 18:41:03 +00:00
Hans Petter Selasky
076daeda4f Fix for directly connected FULL or LOW speed USB devices.
Found by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	1 week
2016-01-05 09:18:43 +00:00
Andriy Voskoboinyk
60e9dd4e56 urtwn: add bits for R92C_HWSEQ_CTRL and R92C_TXPAUSE registers
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4770
2016-01-04 21:16:49 +00:00
Kristof Provost
dd876af4de Add suppoort for the Sitecom LN-031
This is an AX88178 chip, which we already support so all we have to do is add
the USB product and vendor ID.
2015-12-31 18:12:35 +00:00
Hans Petter Selasky
f9e8f40d28 Update metadata for "tools/tools/bus_autoconf" after r292080. Use
BYTE_ORDER instead of _BYTE_ORDER due to 3rd party USB software for
now.
2015-12-29 11:53:13 +00:00
Andrew Turner
2245b38f73 Ads support to the xhci pci attachment to use MSI-X interrupts when
available. As with MSI interrupts these can be disabled by setting
hw.usb.xhci.msix to 0 in the loader.

MSI-X interrupts are needed on some hardware, for example the Cavium
ThunderX only supports them, and with this we don't fall back to polling.

PR:		204378
Reviewed by:	hselasky, jhb
MFC after:	1 week (after r292669)
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D4698
2015-12-24 09:40:29 +00:00
Ian Lepore
bd6c93e8bd Flag the first port on a Sheevaplug ftdi serial device as jtag. 2015-12-16 20:54:28 +00:00
Andriy Voskoboinyk
64febdf2e2 urtwn: fix off-by-one error.
Reported by:	adrian
2015-12-15 17:59:13 +00:00
Andriy Voskoboinyk
31b80e9a5e urtwn: add raw Tx path.
Tested with RTL8188EU and RTL8188CUS in STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4523
2015-12-14 20:39:38 +00:00
Andriy Voskoboinyk
e77cd6fd9e urtwn: fix frame processing in the Rx path.
Currently, in case when npkts >= 2, RSSI and Rx radiotap fields
will be overridden by the next packet. As a result, every packet
from this chain will use the same RSSI / radiotap data.

After this change, RSSI and radiotap structure will be filled
for every frame right before ieee80211_input() call.

Tested with RTL8188EU / RTL8188CUS, STA and MONITOR modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4487
2015-12-14 13:05:16 +00:00
Andriy Voskoboinyk
352761d514 urtwn: add TSF field into RX radiotap header.
Tested with RTL8188EU, MONITOR/STA modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D3831
2015-12-14 12:36:10 +00:00
Andriy Voskoboinyk
ce036b5148 wpi, rum and urtwn: update copyright headers
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4489
2015-12-13 22:08:27 +00:00
Andriy Voskoboinyk
2744e0b2ab urtwn: add support for hardware encryption (WEP, TKIP and CCMP)
Tested with:
- RTL8188EU;
- RTL8188CUS;

Modes:
- IBSS mode: TKIP, CCMP (WPA-None);
- STA / HOSTAP modes - WEP (static), TKIP, CCMP;

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Obtained from:	OpenBSD (mostly)
Differential Revision:	https://reviews.freebsd.org/D4448
2015-12-13 22:00:19 +00:00
Andriy Voskoboinyk
b3f5d50360 urtwn: add a command queue for sleepable tasks.
An implementation from rum(4) was used (it looks simpler for me).
Will be used for h/w encryption support.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4447
2015-12-13 21:50:38 +00:00
Andriy Voskoboinyk
be615269bb urtwn(4): setup channel frequency/flags for radiotap in urtwn_set_channel()
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D3832
2015-12-13 21:43:54 +00:00
Andriy Voskoboinyk
371028a3b7 urtwn: add rate control support for RTL8188EU.
Tested with:
- RTL8188EU, STA and HOSTAP modes.
- RTL8188CUS, STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4402
2015-12-13 21:00:21 +00:00
Andriy Voskoboinyk
bdfff33ff6 net80211: remove hardcoded slot time durations from drivers
- Add IEEE80211_GET_SLOTTIME(ic) macro.
- Use predefined macroses to set slot time.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4044
2015-12-13 20:48:24 +00:00
Warner Losh
f809f280e0 Create a USB_PNP_INFO and use it to export the existing PNP
tables. Some drivers needed some slight re-arrangement of declarations
to accommodate this. Change the USB pnp tables slightly to allow
better compatibility with the system by moving linux driver info from
start of each entry to the end. All other PNP tables in the system
have the per-device flags and such at the end of the elements rather
that at the beginning.

Differential Review: https://reviews.freebsd.org/D3458
2015-12-11 05:28:00 +00:00
Kevin Lo
c70294dc3a All 2-endpoints configs have high and normal pariority queues. 2015-12-10 07:45:58 +00:00
Andriy Voskoboinyk
907809bec0 urtwn: add WME support
Tested with:
 - RTL8188CUS, HOSTAP mode.
 - RTL8188EU, STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4020
2015-12-09 09:29:38 +00:00
Hans Petter Selasky
4da9ba7e7f When setting up VLANs on a Raspberry Pi ethernet port, the MTU drops
from 1500 to 1496 bytes. The MTU should remain at 1500, extending the
frame size as per IEEE 802.3. Adding IFCAP_VLAN_MTU to the
if_capabilities field in the smsc driver solves the problem.  The
datasheet for the LAN9512 chip, section 3.2.3 states that the chip
supports the extended frame.

Submitted by:	rpp@ci.com.au
MFC after:	1 week
PR:		205050
2015-12-07 18:55:33 +00:00
Kevin Lo
eab02f464a - Fix Tx queues to USB endpoints mapping
- Merge urtwn_r92c_dma_init() and urtwn_r88e_dma_init() into one

Reviewed by:	adrian, avos
Differential Revision:	https://reviews.freebsd.org/D4381
2015-12-06 14:07:57 +00:00
Andriy Voskoboinyk
2e3c0e969e urtwn: fix some regressions after r290630
- Restore R92C_TXDW4_HWSEQ_EN bit - it is used by non-8188EU chips.
- Fix DRVRATE bit usage.

Tested with:
 - RTL8188EU, STA mode.
 - RTL8188CUS, STA mode.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4352
2015-12-05 15:08:01 +00:00
Andriy Voskoboinyk
a7d4c4c102 urtwn(4): add error handling for urtwn_write_X() functions.
- Call ieee80211_stop() when urtwn_init() fails
(i.e., stop vap explicitly)
- Return an error when urtwn_write_<smth>() fails.
- Handle errors from them in:
 * urtwn_fw_cmd();
 * urtwn_llt_write();
 * urtwn_efuse_*();
 * urtwn_*_power_on();
 * urtwn_*_dma_init();
 * urtwn_mac_init();
 * urtwn_init();

Tested with RTL8188EU, STA mode

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4291
2015-12-03 14:38:55 +00:00
Andriy Voskoboinyk
aacc26e329 urtwn(4): move duplicate code from urtwn_(r92c/r88e)_dma_init()
to urtwn_dma_init() (noop).

Reviewed by:	kevlo
Approved by:	adrian (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D4271
2015-12-03 14:17:28 +00:00
Kevin Lo
e1b74f21f5 Add initial support for RTL8152 USB Fast Ethernet. RTL8152 supports
IPv4/IPv6 checksum offloading and VLAN tag insertion/stripping.

Since uether doesn't provide a way to announce driver specific offload
capabilities to upper stack, checksum offloading support needs more work
and will be done in the future.

Special thanks to Hayes Wang from RealTek who gave input.
2015-12-01 05:12:13 +00:00
Andriy Voskoboinyk
974d2101ba urtwn(4): rework ROM reading.
- Add error handling for urtwn_(r88e_)read_rom() and
urtwn_efuse_*() functions.
- Remove code duplication between urtwn_efuse_read() and
urtwn_r88e_read_rom().
- Merge r88e_rom and (r92c_)rom structures
(only one of them can be used at the same time).
- Other minor fixes / improvements.

Tested with RTL8188EU, STA mode
(URTWN_DEBUG + USB_DEBUG, hw.usb.urtwn.debug=3, no visual differences).

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4253
2015-11-24 19:20:45 +00:00
Hans Petter Selasky
db8409e00a Fix compile warning about shifting signed negative constant.
MFC after:	3 days
2015-11-23 12:55:37 +00:00
Hans Petter Selasky
db00265949 Add support for Kana and Eisu keys to the USB keyboard driver.
PR:		204709
Submitted by:	naito.yuichiro@gmail.com
MFC after:	3 days
2015-11-21 21:18:55 +00:00
Andriy Voskoboinyk
a2ff3c9268 urtwn(4): add IBSS mode support
Tested with RTL8188EU, IBSS and STA modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4038
2015-11-10 12:52:26 +00:00