-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb: stm32: fix FIFO allocation sizes #70795
usb: stm32: fix FIFO allocation sizes #70795
Conversation
drivers/usb/device/usb_dc_stm32.c
Outdated
@@ -132,12 +132,13 @@ static const struct gpio_dt_spec ulpi_reset = | |||
|
|||
/* We need a minimum size for RX FIFO */ | |||
#define USB_FIFO_RX_MIN 160 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original PR (#62530) doesn't explain where this number comes from, and doesn't clarify whether it is supposed to be bytes or words. @Desvauxm-st?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging by #69897, it's probably supposed to be words, updated accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @Desvauxm-st is now enjoying his retirement. @marwaiehm-st will have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RX FIFO size is in words, so needs to be subtracted from the total memory size *after* it's divided by 4. Fixes zephyrproject-rtos#70789. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Magic constants throughout the code made this difficult to reason about, especially with two different units of measurement (bytes and words) at play. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
550fbcc
to
2e15d39
Compare
LGTM |
See commit messages.
Fixes #70789.