Skip to content
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

da1469x: fix resume #1291

Merged
merged 2 commits into from
Feb 2, 2022
Merged

Conversation

kasjer
Copy link
Collaborator

@kasjer kasjer commented Jan 20, 2022

Describe the PR
Entering suspend mode clears bit USB_RX_EN in USB_RXCx_REG.
Resuming after suspend state did not enable reception on non-0 endpoints.
It resulted in incoming packets being NAK'ed after resume.

Now, on resume event, all OUT endpoints are checked for pending transfers
and when transfer is not completed USB_RX_EN bit is set by start_tx_packet.

Additionally over-run/under-run masks were off by 4 bits so those interrupts
would never be enabled.

Bit mask enabling/disabling over-run/unde-run was shifted
by one nibble, so interrupt was never enabled.
It did not force any issue as this situation could only
happen on ISO endpoints without DMA.
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix, I actually don’t have knowledge to test/verify this, but you are the expert on Dialog chip. I have an minor request for the simple if, not a problem at all if you want to merge it as it is.

for (int epnum = 1; epnum <= 3; ++epnum)
{
xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT);
if (xfer->total_len > xfer->transferred)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you have the simple if in one line or use bracket for it. I know this style is common in Linux, but it is rather error-prone.

Going to suspend states disable reception on non-0 RX endpoints.

Now when USB resume condition is detected, all RX endpoints
with pending transfers are resumed.
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look great, thank you

@hathach hathach merged commit d6fb185 into hathach:master Feb 2, 2022
@kasjer kasjer deleted the kasjer/da1469x-fix-resume branch February 2, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants