Commit graph

4338 commits

Author SHA1 Message Date
Bjoern A. Zeeb
66754c01ff XHCI: clear warm and port reset
It seems we do not clear UPS_C_BH_PORT_RESET and UPS_C_PORT_RESET
conditions after warm or port reset.  Add that code.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35483

(cherry picked from commit 8f892e9bee)
2022-07-01 13:50:19 +00:00
Bjoern A. Zeeb
39cd7aa134 USB: add quirks to XHCI
While XHCI is very generic some revisions of chipsets have problems.
On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
enable it.
For that introduce quirks to xhci so that controllers can steer
certain features.  I would hope that this is and remains the only one.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35482

(cherry picked from commit 447c418da0)
2022-07-01 13:50:10 +00:00
Hans Petter Selasky
20d3224919 uhid(4): Don't read-ahead from the USB IN endpoint.
This avoids an issue where IN endpoint data received from the device right
before the file handle is closed, gets lost.

PR:		263995
Sponsored by:	NVIDIA Networking

(cherry picked from commit b6f615255d)
2022-06-30 11:39:43 +02:00
Warner Losh
db761c6a64 Create wrapper for Giant taken for newbus
Create a wrapper for newbus to take giant and for busses to take it too.
bus_topo_lock() should be called before interacting with newbus routines
and unlocked with bus_topo_unlock(). If you need the topology lock for
some reason, bus_topo_mtx() will provide that.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31831

(cherry picked from commit c6df6f5322)
2022-06-21 17:13:20 +02:00
Hans Petter Selasky
0b5f08439d uchcom(4): Add new USB ID.
PR:		260783
PR:		264634
Sponsored by:	NVIDIA Networking

(cherry picked from commit f25a0a0f21)
2022-06-20 13:08:39 +02:00
Hans Petter Selasky
026e19496c urtw(4): Adjust all pause calls to use milliseconds instead of ticks.
Sponsored by:	NVIDIA Networking

(cherry picked from commit c6c22ebb38)
2022-06-16 04:55:52 +02:00
Hans Petter Selasky
1c5c1e4486 upgt(4): Adjust all pause calls to use milliseconds instead of ticks.
Sponsored by:	NVIDIA Networking

(cherry picked from commit bc2e447338)
2022-06-16 04:55:52 +02:00
Emmanuel Vadot
0c7209c263 usb: Make ext_resources non-optional
EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33827

(cherry picked from commit fb6cebd8bd)
2022-05-16 13:45:36 +02:00
Hans Petter Selasky
75a5bdd453 xhci(4): Tweak USB port speed checks to allow newer super speed generations.
This allows setting the U1 and U2 port timeout values.

Sponsored by:	NVIDIA Networking

(cherry picked from commit a1c0442b41)
2022-05-10 10:05:32 +02:00
Hans Petter Selasky
a11ac66f1c xhci(4): Properly define all basic USB port speeds.
Sponsored by:	NVIDIA Networking

(cherry picked from commit d730333c80)
2022-05-10 10:05:29 +02:00
Hans Petter Selasky
6d8c6b24ee xhci(4): Always add and evaluate the slot context.
Because the maximum number of endpoint contexts is stored there.

Tested by:	ehaupt@
PR:		262882
Approved by:	re (gjb, early MFC)
Sponsored by:	NVIDIA Networking

(cherry picked from commit 09dd1adfa4)
2022-05-03 21:43:13 +02:00
Hans Petter Selasky
610528736f xhci(4): Only drop BULK and INTERRUPT endpoints to reset data toggle.
Only drop BULK and INTERRUPT endpoints, to reset the data toggle,
because for other endpoint types this is not critical.

While at it fix some whitespace.

Tested by:	ehaupt@
PR:		262882
Approved by:	re (gjb, early MFC)
Sponsored by:	NVIDIA Networking

(cherry picked from commit e276d28150)
2022-05-03 21:41:51 +02:00
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