-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19462: cpu/stm32/usbdev_fs: fix ep registration and EP_REG assignments [backport 2023.04] r=dylad a=dylad ### Contribution description This backport PR provides two fixes for the usbdev_fs driver: Fix endpoints registration Fix assignment of toggleable bits in EP_REG(x) registers These bugs were encountered with the USBUS MSC implementation. Regarding the endpoints registration: For the usbdev_fs peripheral, IN and OUT endpoints of the same index must have the same type. For instance, if EP1 OUT is a bulk endpoint, EP1 IN must either be unused or used as bulk too but it cannot be used as interrupt or isochronous. With the previous check, the following registration pattern (EP OUT Bulk -> EP IN Interrupt -> EP IN Bulk) would assign both EP OUT Bulk and EP IN Interrupt to same endpoint index. So the configuration would be broken. Applying the same registration pattern with this patch would now produce EP OUT Bulk -> 1 / EP IN Interrupt -> 2 / EP IN Bulk 1. Which is a working configuration for this IP. and for the second fix: EP_REG(x) registers have a total of 6 toggleable bits. Those bits can only be toggled if we write a one to it, otherwise writing a zero has no effect This commit fixes all the access to these registers to prevent from modifying these bits when not needed. Without this patch, the endpoint status (VALID / NACK / STALL) can be erroneously modify because bits are not cleared when assigning the new content to the register and thus make the bits toggle and change values. ### Testing procedure See #19460 ### Issues/PRs references #19460 Co-authored-by: Dylan Laduranty <[email protected]>
- Loading branch information
Showing
1 changed file
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters