Commit graph

4326 commits

Author SHA1 Message Date
Hans Petter Selasky
3644b92099 xhci(4): Ensure the so-called data toggle gets properly reset.
Use the drop and enable endpoint context commands to force a reset of
the data toggle for USB 2.0 and USB 3.0 after:
 - clear endpoint halt command (when the driver wishes).
 - set config command (when the kernel or user-space wants).
 - set alternate setting command (only affected endpoints).

Some XHCI HW implementations may not allow the endpoint reset command when
the endpoint context is not in the halted state.

Reported by:		Juniper and Gary Jennejohn
Sponsored by:		NVIDIA Networking

(cherry picked from commit cda31e7349)
2022-04-27 21:07:13 +02:00
Gordon Bergling
c6e8fa2a75 usb: Remove some double words in source code comments
- s/for for/for/

(cherry picked from commit 74c6ca6fbf)
2022-04-14 08:15:51 +02:00
Gordon Bergling
c082302919 usb(4): Fix two typos in source code comments
- s/negotation/negotiation/

(cherry picked from commit c8c1c23a8c)
2022-04-14 08:15:24 +02:00
Gordon Bergling
ecc10e7be9 usb(4): Remove a double word in a source code comment
- s/for for/for/

(cherry picked from commit 2e09a4ac3b)
2022-04-14 08:12:05 +02:00
Greg Lehey
d45fa9f424 Add devices and quirks for some Olympus cameras.
Reviewed by:	hps@
Fixes:	   	Problems attaching Olympus cameras.

(cherry picked from commit 31e076d70b)
2022-04-14 09:40:37 +10:00
Gordon Bergling
80fc35f72c usb(3): Fix a few typos in source code comments
- s/paniced/panicked/

(cherry picked from commit 9094c3a71b)
2022-04-09 08:08:15 +02:00
Alexander V. Chernikov
453b4f8193 u3g: Add support Quectel EM12-G modem.
Submitted by:	<tda.77793 at gmail.com>
PR:		260218
MFC after:	2 weeks

(cherry picked from commit 217481a333)
2022-03-28 08:54:30 +00:00
Hans Petter Selasky
19b779498c xhci(4): Add quirk for "Fresco Logic FL1009 USB3.0 xHCI Controller".
Submitted by:		John F Carr <jfc@mit.edu>
Sponsored by:		NVIDIA Networking

(cherry picked from commit 19837718ab)
2022-03-17 10:55:18 +01:00
Hans Petter Selasky
ea318f1ad1 xhci(4): Add quirk for "TUSB73x0 USB3.0 xHCI Controller".
Tested by:	br@
Sponsored by:	NVIDIA Networking

(cherry picked from commit 33cbbf268f)
2022-03-16 15:55:22 +01:00
Hans Petter Selasky
cea6dbdf1b Make sure the avr32dci_odevd structure is used.
This fixes a compilation error.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 3f5054862a)
2022-03-10 09:29:22 +01:00
Hans Petter Selasky
9997736943 Factor out repeated code in the USB controller drivers to avoid bugs
computing the same isochronous start frame number over and over again.

PR:		257082
Sponsored by:	NVIDIA Networking

(cherry picked from commit 8fc2a3c417)
(cherry picked from commit f52783fcf5)
(cherry picked from commit cf48d1f771)
2022-03-10 09:29:19 +01:00
Hans Petter Selasky
2db063c4ce Make sure the XHCI driver obeys the isochronous scheduling threshold value
as given by the XHCI hardware parameters to avoid scheduling isochronous
transfers too early.

Sponsored by:	NVIDIA Networking

(cherry picked from commit d038463bd2)
2022-03-10 09:27:41 +01:00
Hans Petter Selasky
afeeccfbed Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing
the number of completion event TRBs. This avoids wasting memory.

Sponsored by:	NVIDIA Networking

(cherry picked from commit e036ee6ce2)
2022-03-10 09:18:04 +01:00
Hans Petter Selasky
9157566d7a usb(4): Factor out the usb_check_request() function.
No functional change.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 8ed5bb59e9)
2022-03-10 09:18:00 +01:00
Hans Petter Selasky
081619a507 usb(4): Don't skip calling uhub_explore_sub() even on HUB port errors.
This should fix an issue where the "udev->re_enumerate_wait" field never gets
processed and reset. In this case usbconfig will wait forever and never return.

Sponsored by:	NVIDIA Networking

(cherry picked from commit c7cd6f809d)
2022-03-09 21:05:43 +01:00
Hans Petter Selasky
ba047cec32 u3g(4): Add new USB IDs.
Submitted by:	Matthew Luckie <mjl@luckie.org.nz>
Sponsored by:	NVIDIA Networking

(cherry picked from commit a75444c143)
2022-03-09 21:05:31 +01:00
Mark Johnston
a82cdd3211 axge: Fix a -Wunused-but-set-variable warning
(cherry picked from commit 9218449b98)
2022-03-07 08:18:37 -05:00
Mark Johnston
97c29a1d08 cdce: Fix a -Wunused-but-set-variable warning
(cherry picked from commit ceb246c7b2)
2022-03-07 08:18:16 -05:00
Mark Johnston
a2c1c57639 axe: Fix a -Wunused-but-set-variable warning
(cherry picked from commit f4a5d1f6c4)
2022-03-07 08:18:03 -05:00
Hans Petter Selasky
cf912859d2 usb(4): Automagically apply all quirks for USB mass storage devices.
Currently there are five quirks the USB stack tries to automagically detect:
- UQ_MSC_NO_PREVENT_ALLOW
- UQ_MSC_NO_SYNC_CACHE
- UQ_MSC_NO_TEST_UNIT_READY
- UQ_MSC_NO_GETMAXLUN
- UQ_MSC_NO_START_STOP

If any of the quirks above are set, no further quirks will be probed.

If any of the USB mass storage tests fail, the USB device is
re-enumerated as a last resort to clear any error states from the
device. Then the USB stack will try to probe and attach the umass<N>
device passing the detected quirks.

While at it give more details in dmesg about what is going on.

Tested by:		several
Submitted by:		Idwer Vollering <vidwer_fbsdbugs@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D30919
Sponsored by:		NVIDIA Networking

(cherry picked from commit 7520b88860)
2022-03-03 15:41:12 +01:00
Hans Petter Selasky
15c4f94534 Add more USB host controller PCI ID's.
Submitted by:	Gary Jennejohn <gljennjohn@gmail.com>
Sponsored by:	NVIDIA Networking

(cherry picked from commit e85af89fa7)
2022-02-24 10:58:44 +01:00
Hans Petter Selasky
ce60a1fe6a xhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF
(cherry picked from commit 4b4cce02ac)
2022-02-24 10:58:39 +01:00
Hans Petter Selasky
ed5fb5ccdb usb(4): Belatedly add a PCI device ID for AMD Bolton chipset
(cherry picked from commit 379797d4b4)
2022-02-24 10:58:32 +01:00
Hans Petter Selasky
d9addaa0ba Add new USB host controller PCI ID's.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by:	NVIDIA Networking

(cherry picked from commit 42cf33dd1a)
2022-02-24 10:58:16 +01:00
Andrew Turner
24a205e328 Fix undefined behaviour in the USB controllers
The USB controller drivers assume they can cast a NULL pointer to a
struct and find the address of a member. KUBSan complains about this so
replace with the __offsetof and __containerof macros that use either a
builtin function where available, or the same NULL pointer on older
compilers without the builtin.

Reviewers: hselasky

Subscribers: imp

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33865

(cherry picked from commit a3cea15680)
2022-02-22 16:23:07 +00:00
Hans Petter Selasky
a8727a0b32 rtwn(4): Add new USB ID.
Submitted by:	Wensi <supdrewin@outlook.com>
PR:		261098
Sponsored by:	NVIDIA Networking

(cherry picked from commit 75d20a5e38)
2022-02-10 16:11:07 +01:00
Hans Petter Selasky
3752e6771b uchcom(4): Add new USB ID.
Submitted by:	darius@dons.net.au
PR:		260783
Sponsored by:	NVIDIA Networking

(cherry picked from commit 34bedcee3c)
2022-02-10 16:11:01 +01:00
Hans Petter Selasky
08a56bb43c rtwn(4): Add new USB ID.
Submitted by:	arved@
PR:		260952
Sponsored by:	NVIDIA Networking

(cherry picked from commit 2891a28052)
2022-02-10 16:10:57 +01:00
Hans Petter Selasky
966c36c1b6 usb(4): Ignore port resume failures.
If port resume fails, likely the USB device is detached. Ignore such errors,
because else the USB stack might try forever trying to resume the device,
before it will proceed detaching it.

Sponsored by:	NVIDIA Networking

(cherry picked from commit a88e1a04df)
2022-02-10 16:10:53 +01:00
Ed Maste
559fb03f96 rsu: add KASSERT to document maximum mbuf size in rsu_tx_start
PR:		254479
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 453d8a7ee2)
2022-02-09 12:28:42 -05:00
Bjoern A. Zeeb
8adc24f7c5 USB dwc3 controller: add quirk snps,dis_rxdet_inp3_quirk
Add support for the "snps,dis_rxdet_inp3_quirk" quirk needed
at least on SolidRun's HoneyComb.

Reviewed by:	manu, mw
Differential Revision: https://reviews.freebsd.org/D32921

(cherry picked from commit 3987e50611)
2021-12-29 16:02:51 +00:00
Bjoern A. Zeeb
907c4e7538 USB: add CYUSB330x to usbdevs
Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.

(cherry picked from commit 1910048eb9)
2021-12-29 16:02:38 +00:00
Andreas Wetzel
99e934e6f1 rtwn/usb: add product ID for Asus USB N10 Nano Rev. B1
According to information found on the internet the following products
use exactly the same hardware but probably different USB IDs:
- Edimax EW-7811Un V2 (v2)
- Edimax EW-7811GLN 2.0A (v2)
I am not adding them as I cannot verify.

PR:		254280

(cherry picked from commit cd6f0b4769)
2021-12-13 08:35:49 +02:00
Alexander Motin
1fb199ffa6 xhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.
MFC after:	2 weeks

(cherry picked from commit cfb0e4d76c)
2021-12-12 22:16:28 -05:00
Alexander Motin
155748c1e7 xhci: Add PCI IDs from recent Intel CPUs.
MFC after:	2 weeks

(cherry picked from commit 83d7b2f335)
2021-12-11 00:17:16 -05:00
Mitchell Horne
06dc4eab74 ucom: s/sio/ucom/
Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33278

(cherry picked from commit e43d081f35)
2021-12-10 14:31:20 -04:00
Elyes HAOUAS
27fceea98c Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
(cherry picked from commit 9097ac9af4)
2021-12-06 08:55:55 -07:00
Hans Petter Selasky
9e89269ee7 usb/u3g: Add support for Quectel EM05.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/565
Sponsored by:	NVIDIA Networking

(cherry picked from commit 0229172a65)
2021-12-02 15:51:46 +01:00
Bjoern A. Zeeb
6acb9d5f95 net80211/drivers: improve ieee80211_rx_stats for band
While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9a6695532b)
2021-11-19 00:01:25 +00:00
Alexander Motin
1e5dc6aa18 Add some of Intel Alder Lake device IDs.
MFC after:	1 week

(cherry picked from commit dc238358f9)
2021-11-12 23:02:46 -05:00
Hans Petter Selasky
f8b998c730 usb(4): Fix for use after free in combination with EVDEV_SUPPORT.
When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by:	pho@
Sponsored by:	NVIDIA Networking

(cherry picked from commit aad0c65d6b)
2021-11-02 09:37:25 +01:00
Ian Lepore
b1cca74367 Fix busdma resource leak on usb device detach.
When a usb device is detached, usb_pc_dmamap_destroy() called
bus_dmamap_destroy() while the map was still loaded. That's harmless on x86
architectures, but on all other platforms it causes bus_dmamap_destroy() to
return EBUSY and leak away any memory resources (including bounce buffers)
associated with the mapping, as well as any allocated map structure itself.

This change introduces a new is_loaded flag to the usb_page_cache struct to
track whether a map is loaded or not. If the map is loaded,
bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking
away resources.

Differential Revision:	https://reviews.freebsd.org/D32208

(cherry picked from commit dc91a9715f)
2021-10-06 09:36:02 -06:00
Gordon Bergling
7172006900 smsc(4): Fix a typo in a comment
- s/setings/settings/

(cherry picked from commit 9599d8141f)
2021-10-06 08:21:05 +02:00
Kornel Duleba
28df957acb if_cdce: Add support for setting RX filtering
We can now set promisc and allmulti modes.
Filtering of given multicast addresses is not supported.
Changing the mode is done by sending a command described in:
"USB CDC Subclass Specification for Ethernet Devices v1.2, section 6.2.4".
This means that at least in theory this feature should work with all
modems that are using this driver.

This fixes Huawei E3372h-320 running new firmware in "HiLink" mode.
Previously it would reset a few seconds after its mode was changed
with "usb_modeswitch".
Setting RX filter to default value at the end of attach function
fixed that.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D31766
MFC after:		2 weeks
Reviewed by:		hps

(cherry picked from commit f0c393f781)
2021-09-28 09:03:48 +02:00
John-Mark Gurney
87e560496f ued may be NULL here which will cause a panic... reproducable by
simply doing a usbconfig reset on a device which doesn't reset itself
properly...

(cherry picked from commit 3d5104182c)
2021-09-28 09:03:48 +02:00
John-Mark Gurney
973fb85188 Add support for link status, media and VLAN MTU (if supported) to if_cdce...
This makes it more usable in that dhclient will autolaunch from devd
now when cdce devices are plugged in..  It also sets the baudrate, but
this isn't exported via tools, and CDCE doesn't have a good way to
specify the media type, so there isn't a good way to tell userland
what the speed is currently...

Reviewed by:		hps
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D30625

(cherry picked from commit b43d600c83)
2021-09-28 09:03:48 +02:00
Kornel Duleba
fea962297f umodem: Add Huawei E3372h-320 device id
After switching the dongle to the Huawei alternate mode(modem mode)
with usb_modeswitch the serial interfaces had all of their ids set to
0xFF.
After modifying umodem to work with that it attached successfully and
I've managed to configure device with standard AT commands to get
internet connection.

(cherry picked from commit 28d5498268)
2021-09-28 09:03:48 +02:00
Hans Petter Selasky
e4cbb47700 Cleanup unused USB enums.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-09-22 14:59:31 +02:00
Vladimir Kondratyev
3f03cc9a8e wmt(4): Adapt to recent KPI changes
(cherry picked from commit 527b6d60f8)
2021-09-22 02:36:18 +03:00
Vladimir Kondratyev
139144a7ae wsp(4): Add evdev support.
Reviewed by:	hselasky
Tested by:	Greg V, Constantin Furst<constantin_AT_fuersten_DOT_info>
PR:		252236
Differential revision:	https://reviews.freebsd.org/D31653

(cherry picked from commit 8d73071c47)
2021-09-08 03:01:07 +03:00