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

overwrite grstctl on edpt_disable #1454

Merged
merged 2 commits into from Jun 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/portable/synopsys/dwc2/dcd_dwc2.c
Expand Up @@ -796,7 +796,7 @@ static void dcd_edpt_disable (uint8_t rhport, uint8_t ep_addr, bool stall)
}

// Flush the FIFO, and wait until we have confirmed it cleared.
dwc2->grstctl |= (epnum << GRSTCTL_TXFNUM_Pos);
dwc2->grstctl = (epnum << GRSTCTL_TXFNUM_Pos);
Copy link
Owner

@hathach hathach May 26, 2022

Choose a reason for hiding this comment

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

I think we can actually merge them into 1 line as

dwc2->grstctl = (epnum << GRSTCTL_TXFNUM_Pos) | GRSTCTL_TXFFLSH;

from linux dwc2

https://github.com/torvalds/linux/blob/babf0bb978e3c9fce6c4eba6b744c8754fd43d8e/drivers/usb/dwc2/core.c#L823-L825

dwc2->grstctl |= GRSTCTL_TXFFLSH;
while ( (dwc2->grstctl & GRSTCTL_TXFFLSH_Msk) != 0 ) {}
}
Expand Down