Commit Graph

3437 Commits

Author SHA1 Message Date
Hans Petter Selasky
5c155f23d1 Add definition of the ISOCHRONOUS endpoint usage bits.
Refer to the USB v2.0 specification for more information.

MFC after:	1 week
2015-03-25 13:32:27 +00:00
Hans Petter Selasky
89c481cfd4 Remove no longer used allocation type.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2015-03-17 11:07:59 +00:00
Hans Petter Selasky
5151af1dcb Use define instead of constant.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2015-03-17 08:42:09 +00:00
Ian Lepore
8ddeeebf4b Use SYSCTL_OUT_STR() to return strings.
PR:		195668
2015-03-14 21:40:33 +00:00
Hans Petter Selasky
996f8471b1 Lock softc before clearing bits.
Found by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2015-03-10 16:06:07 +00:00
Andrew Turner
8f3ad0f84e Add support for enabling the USB on the Raspberry Pi boards when it hasn't
been done by U-Boot. This allows the USB to work when we load the kernel
directly.

No dma sync is performed after these operations as the data we read/write
is not used by the cpu after the calls to the maimbox driver.

Differential Revision:	https://reviews.freebsd.org/D1940
Reviewed by:	imp, Michal Meloun (meloun AT miracle.cz)
MFC after:	1 Week
Sponsored by:	ABT Systems Ltd
2015-03-08 13:52:07 +00:00
Hans Petter Selasky
efccd9f054 Switch polarity of PPS events.
PR:		196897
Submitted by:	ian @
MFC after:	1 week
2015-03-08 08:34:49 +00:00
Hans Petter Selasky
ef826045f8 Use correct mode variable for PPS support.
PR:		196897
Submitted by:	ian @
MFC after:	1 week
2015-03-07 22:46:35 +00:00
Hans Petter Selasky
61948b2577 Allow the UDL screen refresh rate to be runtime configurable through a
sysctl. Increase the default frame rate to 25 FPS. Add a comment about
memory constraints.
2015-03-07 20:49:32 +00:00
Hans Petter Selasky
bb057644cf Add PPS support to USB serial drivers.
Bump kernel version to reflect structure change.

PR:		196897
MFC after:	1 week
2015-03-07 18:25:58 +00:00
Hans Petter Selasky
68492bc279 Add more USB IDs.
PR:		197753
MFC after:	1 week
2015-03-07 17:11:07 +00:00
Luiz Otavio O Souza
10defbbd80 Sort and remove unnecessary headers. 2015-03-03 17:20:19 +00:00
Hans Petter Selasky
0c31a8b000 Add quirk for USB 3.0 controllers which don't support 64-bit DMA.
MFC after:	3 days
Submitted by:	Gary Jennejohn <gljennjohn@gmail.com>
2015-03-03 10:21:54 +00:00
Hans Petter Selasky
2ac11c1199 Add quirk to disable 64-bit XHCI DMA after r276717.
Requested by:	Gary Jennejohn <gljennjohn@gmail.com>
MFC after:	3 days
2015-03-02 20:42:06 +00:00
Hans Petter Selasky
6fc22e8f35 Add ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo.
PR:		198015
PR:		198019
PR:		198026
MFC after:	1 week
2015-02-25 08:35:00 +00:00
Hans Petter Selasky
bcb1c16516 Ensure that the XHCI driver will refresh the control endpoint settings
when re-enumerating a FULL speed device. Else the wrong max packet
setting might be used when trying to re-enumerate a FULL speed device.

MFC after:	3 days
2015-02-24 08:53:47 +00:00
Hans Petter Selasky
f5757453dc Add support for the DWC OTG v2 chipset found in the STM32F4 series of
processors. Make sure we pullup the data lines in device mode when we
power on the port.

MFC after:	1 week
2015-02-23 17:01:38 +00:00
Hans Petter Selasky
fa592170fe Try to resolve infinite interrupts by clearing an undocumented
interrupt status bit. According to the UHCI controller specification
the host controller halted interrupt is non-maskable.

PR:		156596
Tested by:	adrian @
MFC after:	1 week
2015-02-17 07:52:50 +00:00
Hans Petter Selasky
537116c230 Reduce number of memory buffers a bit. 2015-02-16 15:47:55 +00:00
Hans Petter Selasky
b41892e1f8 Avoid recursive locking. 2015-02-16 15:46:16 +00:00
Hans Petter Selasky
4464c5e5e6 Swap screen dimensions back to normal. 2015-02-16 15:39:51 +00:00
Hans Petter Selasky
2d759c8259 Handle VBUS error interrupts.
Submitted by:	SAITOU Toshihide <toshi@ruby.ocn.ne.jp>
PR:		190471
MFC after:	1 week
2015-02-16 15:34:10 +00:00
Hans Petter Selasky
00ad411a77 Allow the display port to be powered off. 2015-02-16 11:54:45 +00:00
Hans Petter Selasky
a63352afc0 Add new device ID. 2015-02-15 22:06:28 +00:00
Hans Petter Selasky
b161d69825 Bugfixes. Check if a framebuffer is present before using it. Dequeue
element from correct head structure. No need to multiply framebuffer
offset by two. It is already given in bytes.
2015-02-15 22:05:30 +00:00
Hans Petter Selasky
0867995ca0 Import USB display link driver from OpenBSD. Support for compression
has been removed and the driver has been greatly simplified and
optimised for FreeBSD. The driver is currently not built by default.

Requested by:	Bruce Simpson <bms@fastmail.net>
2015-02-15 12:02:17 +00:00
Hans Petter Selasky
a2a7864564 Fix DMA address casts. Regression issue after r278279.
MFC after:	3 days
2015-02-09 21:47:12 +00:00
Dmitry Chagin
5fea5a57b6 Add Neoway WM620 module ID.
MFC after:	1 Week
2015-02-08 11:55:29 +00:00
Hans Petter Selasky
c3871e6426 Separate out detection of prevent and allow medium removal quirk.
PR:		185747
MFC after:	1 week
2015-02-02 18:20:10 +00:00
Hans Petter Selasky
8b1ce3297a Optimise allocation of USB DMA structures. By default don't double map
allocations if only one element should be allocated per page
cache. Make one allocation per element compile time configurable. Fix
a comment while at it.

Suggested by:	ian @
MFC after:	1 week
2015-02-02 11:32:15 +00:00
Hans Petter Selasky
add9e3e5d3 Section 3.2.9 in the XHCI specification about control transfers says
that we should use a normal-TRB if there are more TRBs extending the
data-stage TRB. Add a dedicated state bit to the internal USB transfer
flags to handle this case.

Reported by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
MFC after:	1 week
2015-02-02 11:06:41 +00:00
Dimitry Andric
620d4f3c0b Fix a bunch of -Wcast-qual warnings in sys/dev/usb/input/uhid.c, by
using __DECONST.  No functional change.

Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D1743
2015-01-31 14:18:46 +00:00
Ian Lepore
4098ccafa4 Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses.

The bus_space struct contains a private data pointer (poorly named bs_cookie,
now renamed to bs_privdata) which is used only by a few old armv4 xscale
implementations.  The bus_space functions were all defined to take this
value as the first parameter instead of the bus_space_tag_t, requiring all
the inline macro and function expansions to dereference the tag to pass it
to another function, which never uses it.  Now all the functions take the tag
as the first parameter and retrieve the privdata if they need it.

Also fix a couple bus_space_unmap() implementations that were calling
kva_free() instead of pmap_unmapdev().

Discussed with:	   cognet
2015-01-21 01:06:08 +00:00
Ruslan Bukin
d69eefebd2 o Restore 'goto tr_setup;' when operating in host mode mistakenly
removed in r277414.
o Remove extra parentheses around cases.
2015-01-20 16:30:02 +00:00
Ruslan Bukin
7d502f3285 o Do notify USB host each time we receive 'set packet filter' request.
This makes Mac OS X happy when it returns back from suspending.
o Switch notify state after data is transferred, but not before.
o Consider there is also Super Speed mode.
o Do not set stall bit on any pipes in device mode as Mac OS X seems
  don't support it.

In collaboration with:	hselasky@
2015-01-20 15:45:09 +00:00
Hans Petter Selasky
84e3f97e6d Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular
the value returned in the "udp_port_level" field.

Reported by:	Uffe Jakobsen <uffe@uffe.org>
MFC after:	1 week
2015-01-20 11:43:16 +00:00
Ruslan Bukin
b0b74fb366 o Notify USB host about connection when operating in device mode.
Required when communicating to Mac OS X USB host stack.
o Also don't set stall bit to TX pipe in device mode as seems Mac OS X
  don't clears it as it should.

Discussed with:	hselasky@
2015-01-17 12:31:26 +00:00
Hans Petter Selasky
c8563d530c Add more USB device IDs.
Submitted by:	max.n.boyarov@gmail.com
PR:		196362
MFC after:	1 week
2015-01-16 12:16:21 +00:00
Hans Petter Selasky
07dbde6777 Add a kernel function to delist our kernel character devices, so that
the device name can be re-used right away in case we are destroying
the character devices in the background.

MFC after:	4 days
Reported by:	dchagin@
2015-01-14 14:04:29 +00:00
Hans Petter Selasky
b78e84d132 Resolve a special case deadlock: When two or more threads are
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met. The "destroy_dev()"
function waits for all system calls involving the given character
device to return. Character device system calls may lock the USB
enumeration lock, which is also held when "destroy_dev()" is
called. This can sometimes lead to a deadlock not noticed by
WITNESS. The current solution is to ensure the calling thread is the
only one holding the USB enumeration lock and prevent other threads
from getting refs while a USB device detach is ongoing. This turned
out not to be sufficient. To solve this deadlock we could use
"destroy_dev_sched()" to schedule the device destruction in the
background, but then we don't know when it is safe to free() the
private data of the character device. Instead a callback function is
executed by the USB explore process to kill off any leftover USB
character devices synchronously after the USB device explore code is
finished and the USB enumeration lock is no longer locked. This makes
porting easier and also ensures us that character devices must
eventually go away after a USB device detach.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.

MFC after:	5 days
2015-01-13 16:37:43 +00:00
Ruslan Bukin
3e420a3e12 Add usb template SERIALNET allowing us to have both USB CDC Ethernet
and USB CDC Modem same time by single cable.

Reviewed by:	hselasky@
2015-01-13 14:03:56 +00:00
Hans Petter Selasky
9f21f476bf Increase the maximum number of dynamic USB quirks. USB memory stick
devices which don't support the synchronize cache SCSI command are
likely to also not support the prevent-allow medium removal SCSI
command.

PR:		185747
MFC after:	1 week
2015-01-12 06:34:23 +00:00
Hans Petter Selasky
27aae1967d Add support for USB device side mode to the USB modem driver.
MFC after:	1 week
Submitted by:	br@
2015-01-09 18:40:12 +00:00
Hans Petter Selasky
f880872647 Fix misleading comment.
MFC after:	1 week
Reported by:	rpaulo@
2015-01-08 00:12:54 +00:00
Hans Petter Selasky
8086e9f493 Fix handling of an error case when the MUSB driver is operating in USB
device side mode.

MFC after:	1 week
Reported by:	br@
2015-01-08 00:11:11 +00:00
Robert Watson
2a8c860fe3 In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET()
(and m_cljget() that underlies it) to allow the caller to avoid testing
M_EXT itself.  Update all callers to use the return value.

With this change, very few network device drivers remain aware of
M_EXT; the primary exceptions lie in mbuf-chain pretty printers for
debugging, and in a few cases, custom mbuf and cluster allocation
implementations.

NB: This is a difficult-to-test change as it touches many drivers for
which I don't have physical devices.  Instead we've gone for intensive
review, but further post-commit review would definitely be appreciated
to spot errors where changes could not easily be made mechanically,
but were largely mechanical in nature.

Differential Revision:	https://reviews.freebsd.org/D1440
Reviewed by:	adrian, bz, gnn
Sponsored by:	EMC / Isilon Storage Division
2015-01-06 12:59:37 +00:00
Hans Petter Selasky
b217d18412 Add 64-bit DMA support in the XHCI controller driver.
- Fix some comments and whitespace while at it.

MFC after:	1 month
Submitted by:	marius@
2015-01-05 20:22:18 +00:00
Hans Petter Selasky
ece4b0bd43 Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can
be set before the USB device(s) are probed.
2015-01-05 15:04:17 +00:00
Hans Petter Selasky
abfa11d612 Make sure an error case exits unlocked.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2015-01-03 11:04:17 +00:00
Hans Petter Selasky
454035ba1b Allow systems having a page size greater than 4K to use fewer
scatter-gather XHCI TRB entries for its payload data. The XHCI
controller can handle at least 65536 bytes per scatter-gather list
entry.

MFC after:	1 week
Suggested by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
2014-12-30 09:20:29 +00:00