History log of /fuchsia/zircon/system/dev/usb/xhci/xhci.h
Revision Date Author Comments
# c417eca5 07-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][usb-request]Move usb-request.c out of ulib/ddk

The motivation behind this changes is that eventually system/ulib/ddk
should go away and parts of it should move to where they belong.
This changeset moves usb-request.c, usb-request-test.c out of the ulib/ddk
to system/dev/lib/usb-request. This library is internal for system/dev/usb
and all its fucntionality will be exposed via the usb protocol and the
usb-function protocol to the client drivers.

Test: Build. Basic Sanity test on vim2. Ran usb-request-tests using
runtests /boot/test/ddk/driver-tests

Change-Id: Ia62693f51046b9c93e4a4b9abfd25286b0d9b972


# f4f2a396 03-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][usb-request] Move usb request struct to usb protocol header

usb-request.c is being moved out of the ddk folder and its fucntionality
is either moved into the usb protocol or the usb library. As part of
this effort, this changeset moves the usb_request_t and friends to usb
protocol header.

Test: Build. Tested usb mass storage on vim2

Change-Id: I31659e51d5f6e899d5eb747e7baa86602c0329ea


# babe1cf5 25-Jul-2018 Adam Barth <abarth@chromium.org>

[sync] Apply C API rubric to libsync

Test: No behavior change
Change-Id: I30a413f7fb5d3f4e741e5204532b82e73595c086


# aa213037 18-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-xhci] Extract data stage of usb transfer to
xhci-transfer-common.

Also moves print_trb and the xhci_transfer_state struct.

We need almost the same code for the debug cap bulk transfers
so figured it would be nice not to duplicate.

Change-Id: If62b0ec10c2ec84f5a8f75c8f3633b256d7fe091


# af71cbda 06-Apr-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb] Add support for automatic zero length packets

Set send_zlp flag on usb_request_t if you want zero length packets
sent automatically when transfer length is a multiple of max packet size.

ZX-1952 #done

Change-Id: I78e1cf3231179ec77b20b1ca95e5b765e7ed5dac


# 54dc7146 26-Mar-2018 Ruchira Ravoori <ravoorir@rodete-desktop-imager.corp.google.com>

[zircon][xhci][usb-cdc]Add a delay between requests when TRB Error occurs

When downloading files from the target using some of the usb-c ethernet adapters that use
usb-cdc-ecm driver, the scp loses connection intermittently and will not work until a reboot.
The underlying reason is that the device is not able to match the pace of the requests from
client driver. When this happens, the xhc controller converts the NRDY packets on the bus to
TRB Error. There is no way we can further know what the reason for TRB Error and it can be
other things too. So we do the normal reset deque ptr when we see a TRB Error, but we also
introduce a delay between the requests to slow down the I/O. There is a likely chance that
we might need to increase the delays as the situation arises.
NET-97 #done

Change-Id: Id06022e5a7b0129419b2768e37ec61daaa2df368


# 397ed1f0 13-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Switch to io_buffer_init_with_bti()

Change-Id: I8aeaafe864c003689760c4233072db4fb4b82108


# d76f2897 10-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Always use cached buffers on x86

ZX-1816

Change-Id: I239271271230fa6b4c36f62c269e7d9ef942c61e


# 5806fbc8 07-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Use uncached io_buffers and eliminate cache flushing/invalidating

Now we only need a memory barrier before ringing the doorbell
after queueing new requests in the command ring.

Change-Id: Ie7e2a6c8761fc624c2c5e143636ffc71cec25aad


# 80860fb7 01-Mar-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-xhci] Fix bug with passing the number of interrupts to set_irq_mode.

xhci->num_interrupts is not initialized until after interrupts are
configured, so we can't use it in the call to set_irq_mode.

ZX-1789 #done

Change-Id: Ic4b7ca65698332f2d56365ec7730b92d6e821ef0


# ac25dd9e 13-Dec-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Two DMA cache management fixes:

- Invalidate device context buffer after allocating it so the VM system's
zeroing of the buffer does not interfere with the controller writing to it

- Add two missing xhci_cache_flush() in xhci_handle-enumerate_device()

Fixes USB breakage on ARM that was introduced by
https://fuchsia-review.googlesource.com/c/zircon/+/103016

Change-Id: Id50cfe9a4dcd3927b2f7d695662963290206319d


# dabf086c 12-Dec-2017 Ruchira Ravoori <ravoorir@ravoorir.mtv.corp.google.com>

[zircon][usb] Implement workaround for race in interrupt_signal to fix Bug #1449

Change-Id: Ib9a0cc21d6b76494dfce3365af599f82689b150d


# 4384fb84 18-Nov-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Handle stalls in the status phase of a control requests

Some devices (like the Schitt Fulla 2 audio interface) will report success
during the data phase of a control request but then issue a stall during
the status phase. Previously we were completing the request when we receive
the transfer event corresponding to the data phase. Later when we receive
the stall event for the status phase it is too late to report this back to
the client.

To fix this we now set the IOC bit on the status TRB so we now receive
a transfer event for both the setup or data phase and the status phase.
When we receive the first transfer event we record the result in the
USB request, but defer completing that request until we receive the
transfer event for the status phase. At that point we update the
USB request's result status if necessary and then complete the request.

ZX_1375 #comment in progress

Change-Id: Ib7a1c4164f0ecf09b75735293aa1985465cd2a4b


# c92e74a1 16-Nov-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Use zx_cache_flush instead of zx_vmo_op_range for cache management

Change-Id: I261246de12f4c915b485dfb15830d084658e9ffc


# 6eec076e 21-Oct-2017 Mike Voydanoff <voydanoff@google.com>

[dev][xhci] Create a device in bind() and make it visible in xhci_start_thread()

Eliminates the '/boot/driver/xhci.so' did not add device in bind() warning

Change-Id: If8368b3d82f4296bdf4b5f6f29e2730ad9cccc69


# 6c1c3542 20-Oct-2017 Mike Voydanoff <voydanoff@google.com>

[dev][xhci] XHCI interrupt handling fixes

- Don't update event ring dequeue pointer and clear the
event handler busy flag until we have processed all the new events
in the event ring.

- Always clear the interrupt pending flag in the IMAN register

- Don't bother clearing the EINT and PCD bits in the USBSTS register.
According to the XHCI specification, clearing these bits aren't needed
for acknowledging interrupts.

- Use the port status change event instead of the USBSTS_PCD bit
for handling root hub events.

This makes USB more stable on Gauss and might help with ZX-1221

Change-Id: Ie927b6e019930a69c7f0c4f5907153a6c944cdbc


# 7ca7be57 04-Oct-2017 Jocelyn Dang <jocelyndang@google.com>

[dev][usb] Migrate xhci to usb_request.

Change-Id: Ifd0ceb3f033d530e70c88fc80321cf9fc0be8f40


# 24c58b59 20-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Use new zx_interrupt_signal() behavior to terminate interrupt threads

zx_interrupt_wait() now returns ZX_ERR_CANCELED after calling zx_interrupt_signal()

Change-Id: I628e1eeccdd1a973dbabd48f50d7162fea37ac01


# 5df8e9e6 17-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Fix xhci driver unbind path

This is needed for shutting down xhci when switching from host
to peripheral role.

Change-Id: I83b154060374ef9c94fee4c994e5919f382f2679


# a18aea8b 15-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Clean and invalidate caches as necessary on non-x86 platforms

Also made VMOs for event rings and device contexts read-only

Change-Id: I1aee51c7ba4515523219826fc0b013d6771e514b


# cd2905eb 14-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Use io-buffers instead of raw VMOs for DMA memory

Change-Id: Iec8c48ae077dd3f6ff789d861d872446d2f3d28c


# f6b7bc31 14-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Add support for binding to a platform device

We will use this for XHCI support on platforms with dwc3 IP.

Change-Id: I2414ba9d6e7b1ecbf82506b9163480cc3dfe9212


# dacc1d80 12-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev] Rename "mxdev" to "zxdev" in ddktl and various drivers.

Change-Id: I000e42c26d9f8379de40447690694a35f6be93e2


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# 12ba0f22 29-Aug-2017 Jocelyn Dang <jocelyndang@google.com>

[usb-xhci] Fix issue with sending zero length packets to a bulk endpoint.

The spec doesn't allow consecutive event data TRBs on a transfer ring.
Adding an extra zero length transfer TRB seems to make it happy.

MG-1026 #done

Change-Id: I5be9e40fc40d4f2f6243192b71e5d30715774b2d


# 0ab8844d 26-Jul-2017 Jocelyn Dang <jocelyndang@google.com>

[usb][xhci] Use two interrupts / completers, isoch transfers are sent to
HIGH_PRIORITY thread.

MG-937 #comment

Change-Id: Ibaa2eb3c2fea12164d141966ef8f18d48688ccf1


# d07baedb 30-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[usb] add support for canceling and timing out transactions

Added usb_cancel_all() to the USB protocol, which cancels all
pending iotxns on an endpoint.

The "timeout" parameter to usb_control() is now being honored.

Also replaced the "enabled", "halted" and endpoint flags with
a new xhci_ep_state_t enum.

To avoid confusion, the endpoint state in the hardware's endpoint context
has been renamed from EP_STATE_* to EP_CTX_STATE_* and the accessor
has been renamed to xhci_get_ep_ctx_state()

Change-Id: Id4daafc88c4767e8723deeed373b5321440469b9


# 0dd96c32 02-Aug-2017 Jocelyn Dang <jocelyndang@google.com>

[xhci] Fix interruptor typo

Change-Id: I325b8d492ea4b30acd08330173968f979fc8be05


# 0667c964 19-Jul-2017 Jocelyn Dang <jocelyndang@google.com>

[xhci] move bus mastering to after stopping controller.

Reapplies commit 4a8ec2834232150c830a65306fa997fa7640d977 which was reverted
by a164c3bde4d317919192831f8d97c7547ec8b4a9.

The original change was causing a large stall in boot due to bus mastering
being disabled on boot. https://fuchsia-review.googlesource.com/#/c/41110/
resolves that issue.

MG-928 #done

Change-Id: I5efd58eb42c3407e41a5528ae30b8bcffd6c119c


# a164c3bd 19-Jul-2017 Jocelyn Dang <jocelyndang@google.com>

Revert "[xhci] move bus mastering to after stopping controller."

This reverts commit 4a8ec2834232150c830a65306fa997fa7640d977, was causing a slowdown on boot

Change-Id: I28b688285352f2e93dc5b019a91afe99ccf3c162


# 4a8ec283 18-Jul-2017 Jocelyn Dang <jocelyndang@google.com>

[xhci] move bus mastering to after stopping controller.

MG-928 #done

Change-Id: Ifc6bb9d53f65f60a0f7510e36d68f608fea4c106


# 1206bd9b 11-Jul-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb] Add separate interface for notifying bus when devices are added and removed

Change-Id: I500fe5113d3c54016c539f979446f2d7388aeb94


# a5f1bef5 29-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[usb] Revert changes related to canceling USB transactions

These changes introduced a number of bugs and need more work.

Squashed commit of:

Revert "[usb] add support for canceling and timing out transactions"

This reverts commit b986f57f0d5776585086d1eb6a99d65cdcff2486.

Revert "[dev][usb-xhci] Endpoint state cleanup work"

This reverts commit 5d8c3e1594c0f8161c1e2ca8e80533d0e83f5c8e.

Revert "[dev][usb-xhci] Cleanup completing transactions when stopping an endpoint"

This reverts commit cdbc4364957bc9c3067caba54adfb73fae887f03.

Change-Id: I1ab9ba1fbc06ba9e992ec71bb41ecf2465e72e29


# 5d8c3e15 28-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Endpoint state cleanup work

Replace the "enabled", "halted" and "stopped_reason" endpoint flags with
a new xhci_ep_state_t enum.

To avoid confusion, the endpoint state in the hardware's endpoint context
has been renamed from EP_STATE_* to EP_CTX_STATE_* and the accessor
has been renamed to xhci_get_ep_ctx_state()

Change-Id: I195d688948d4ca65db395205e35f52145893d400


# cdbc4364 28-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Cleanup completing transactions when stopping an endpoint

The XHCI "stop endpoint" command will complete all pending transfers
before the command completes. We now take advantage of that by allowing
them to complete normally rather than completing them xhci_stop_endpoint()
and ignoring the transfer events in xhci_handle_transfer_event().

This is prep work for adding support for cancelling transfers.

Change-Id: Ibc5858ec291c65b0cdd580c17a22bcb66424e1c0


# 3c45f232 27-Jun-2017 Roland McGrath <mcgrathr@google.com>

[dev][usb][uapp][hidtouch][ulib[hypervisor] Clean up use of C99 inline

The rules of thumb for C are:
In a header file, use 'static inline'.
In a C source file, just use 'static' and the let compiler optimize.
Using 'inline' without 'static' has subtle semantics that are not what
anyone usually is trying to do, and differ from the C++ semantics.

The bare 'inline' uses in these C headers and source files meant that
things can fail to link if the compiler makes different optimization
decisions than you were guessing it would.

Change-Id: Ie923e785cfda47d32d49cc41d736e2ec34f1d91f


# 82c01fd2 26-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb-xhci] Add support for timing out controller commands

In particular, we now time out and retry "address device" commands
during initial device setup.
This fixes problems enumerating devices that do not respond to the
first SET_ADDRESS control request.

Change-Id: Ic0d7c8804bdeed8e90c7338f9dfc061fbe16940f


# 849dff9c 26-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb-xhci] Improve handling of stalled and errored endpoints

Change-Id: I9c7ff28fa5b60db80cd3145323753037515ebf33


# 245474ee 22-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb-xhci] Recover from stalls during device enumeration

The asix-88179 based Plugable USB ethernet/hub combo has an intermittent problem
where the initial get device descriptor command will fail, resulting in the
USB 2.0 side of the hub not to enumerate.
Catching this and clearing the stall allows us to recover.

Also added accessor for reading endpoint state from the endpoint context.

Change-Id: I33a1f78513c55fd2d16d44d8dfaac979ccfc2b23


# 9c7e9bc1 14-Jun-2017 Brian Swetland <swetland@google.com>

[ddk][pci] new protocol support (10 of n)

Convert MX_PROTOCOL_PCI to new style.

Change-Id: I72a7dcc0552e74b007199bbfea07cac51a7f780c


# 4f5f5b8a 14-Jun-2017 Brian Swetland <swetland@google.com>

[ddk][usb-bus] new protocol support (5 of n)

Migrate MX_PROTOCOL_USB_BUS to new style.

Change-Id: I8f6e4cf4ca7a139c5ddce203e94a3f7d6444b98b


# 9f5cd55f 07-Jun-2017 Brian Swetland <swetland@google.com>

[udev][usb-xhci] rename

Change-Id: I9301fac7ba04cb881cbc84cc4d34f9a3061ed848