-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
drivers: udc_rpi_pico: replace message queue with k_events and minor fixes #87506
base: main
Are you sure you want to change the base?
drivers: udc_rpi_pico: replace message queue with k_events and minor fixes #87506
Conversation
Set suspended state on suspend/resume ISR. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Using k_events eliminates the drawback of the queue potentially dropping messages and provides a reliable event notification mechanism. It is similar to commit c2f2d8c ("drivers: usb: udc_dwc2: Replace queue with events") Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Support VBUS state change detection and enable/disable DP pull-up according to VBUS state when pinctrl property is provided. It brings the similar functionality introduced in commit 4c0317f ("drivers: usb_dc_rpi_pico: Implemented vbus detection handling") for the legacy device controller driver. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Mark endpoint as not busy after transfer is canceled. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
For the IN endpoint, we only need to set/reset the STALL bit in the endpoint control register. To set halt on the OUT endpoint, the AVAILABLE bit must also be set, which is similar to starting a new transfer, but first any transfer in progress must be canceled. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Do not check if the tailroom is greater than or equal to MPS because the controller does not write directly to the buffer and therefore cannot write outside the buffer. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
At high throughput, the controller sometimes fails to start a new transaction. Clearing the corresponding endpoint bit in the BUFF_STATUS completion register before initiating a new transaction solves this problem. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Fix USB controller base address. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
ecbca9d
to
1f02e60
Compare
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.
I'm not at USB expert, so I'm reviewing this as a general "if I had to fix it, would I be able to grok it?".
On that note, I think this is well-written, and the changes are clear. One small clarification question/comment from me.
|
||
k_msgq_get(&drv_msgq, &evt, K_FOREVER); | ||
ep_cfg = udc_get_ep_cfg(dev, evt.ep); | ||
evt = k_event_wait(&priv->events, UINT32_MAX, false, K_FOREVER); |
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.
Should this be either:
- The bitmask of all the defined events (e.g.
(RPI_PICO_EVT_XFER_FINISHED << 1) - 1)
or similar. Or: - Should there be some checking (maybe an assert) that at the bottom of this function all events bits have been handled?
Inspection of the code says "yes, everything defined in the enum is covered below", but it feels like it'd be possible to get out of sync here.
Replace message queue with k_events, support VBUS state change detection, fix clear/set endpoint halt.