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

risc-v/mpfs: usb: don't try nonexistent ep int flags #189

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions arch/risc-v/src/mpfs/mpfs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3482,7 +3482,7 @@ static int mpfs_usb_interrupt(int irq, void *context, void *arg)

if (pending_tx_ep != 0)
{
for (i = 1; i < MPFS_USB_NENDPOINTS; i++)
for (i = 1; i < (MPFS_USB_NENDPOINTS / 2 + 1); i++)
{
if ((pending_tx_ep & (1 << i)) != 0)
{
Expand All @@ -3493,20 +3493,27 @@ static int mpfs_usb_interrupt(int irq, void *context, void *arg)

if (pending_rx_ep != 0)
{
for (i = 0; i < MPFS_USB_NENDPOINTS; i++)
for (i = 1; i < (MPFS_USB_NENDPOINTS / 2 + 1); i++)
{
/* Check if dead connections are back in business */

if (g_linkdead)
{
/* This releases all, which is a problem if only some
* endpoints are closed on the remote; whereas some
* are functioning; for example ACM and mass storage;
* now the functioning one likely marks the closed ones
* as no longer dead.
/* This releases all tx counterparts with linkdead flag
* set, which is a problem if only some endpoints are
* closed on the remote; whereas some are functioning;
* for example ACM and mass storage; now the functioning
* one likely marks the closed ones as no longer dead.
* Please note that tx counterparts have MPFS_EPIN_START
* offset on top of the rx eps.
*
* For clarity, the eplist[] is as follows:
* eplist: 0: ep0,
* 1-4: ep1rx, ep2rx, ep3rx, ep4rx,
* 5-8: ep1tx, ep2tx, ep3tx, ep4tx
*/

struct mpfs_ep_s *privep = &priv->eplist[i];
struct mpfs_ep_s *privep = &priv->eplist[i + MPFS_EPIN_START];
privep->linkdead = 0;
}

Expand Down
Loading