Jonathan Bell 73b0047efc rp2040: avoid device-mode state machine hang
Don't mark IN buffers as available during the last 200us of a full-speed
frame. This avoids a situation seen with the USB2.0 hub on a Raspberry
Pi 4 where a late IN token before the next full-speed SOF can cause port
babble and a corrupt ACK packet. The nature of the data corruption has a
chance to cause device lockup.

Use the next SOF to mark delayed buffers as available. This reduces
available Bulk IN bandwidth by approximately 20%, and requires that the
SOF interrupt is enabled while these transfers are ongoing.

Inherit the top-level enable from the corresponding Pico-SDK flag.
Applications that will not use the device in a situation where it could
be plugged into a Pi 4 or Pi 400 (for example, when directly connected
to a commodity hub or other host) can turn off the flag in the SDK.

v2: use a field in hw_endpoint to mark pending.

v3: Partial rewrite following review comments

- Stub functions out if the workaround is not required
- Only force-enable SOF while any vulnerable endpoints are active
- Respect dcd_sof_enable() functionality
- Get rid of all but necessary ifdef hackery
- Fix a bug where the "endpoint lock" was used with an uninitialised pointer.
2023-01-24 11:53:28 +00:00
..
2022-06-29 14:06:44 +07:00
2022-02-18 16:30:21 +07:00
2022-02-18 16:30:21 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2021-10-17 16:36:53 +07:00
2022-06-29 14:06:44 +07:00
2021-04-28 23:44:04 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2021-10-17 17:32:03 +07:00
2021-10-17 16:36:53 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2022-06-29 14:06:44 +07:00
2021-10-17 16:36:53 +07:00
2021-12-21 18:24:05 +01:00
2022-11-08 21:58:51 +01:00
2022-06-29 14:06:44 +07:00
2022-10-13 17:39:42 +08:00
2022-06-29 15:27:24 +07:00
2019-05-14 11:48:05 +07:00
2022-10-13 17:39:42 +08:00
2022-07-12 13:29:47 -05:00