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

[1.13.3 FC_ONLY] USB and I2C fix #233

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Conversation

t-salminen
Copy link
Collaborator

  • cherry-picked usb patch from mainline
  • fixed semaphore race condition in i2c-driver

Currently the irq handler checks many reserved bits, which is
a waste of resources:

1. pending_rx_ep bit 0 is reserved (always 0)
2. pending_rx_ep and pending_tx_ep have only bits 1, 2, 3 and 4
   defined, no need to scan MPFS_USB_NENDPOINTS (9) bits as the
   rest are reserved

Fix this by checking only the relevant bits.

Signed-off-by: Eero Nurkkala <[email protected]>
Copy link

@jlaitine jlaitine left a comment

Choose a reason for hiding this comment

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

Just realized that sem is not initialized for hard-ip i2c in this patch

MPFS_I2C_ST_STOP_SENT interrupt might be received right after semaphore timeout,
which would cause the semaphore to be in the incorrect signaled state when the
next transfer starts.

Signed-off-by: Tero Salminen <[email protected]>
@t-salminen
Copy link
Collaborator Author

Added one more patch for corespi-driver to fix similar semaphore race condition as in i2c-driver.

SPI TX_DONE interrupt can be received after a semaphore timeout,
but before interrupts are disabled. This will leave the semaphore
to the signaled state.

After a timeout the semaphore is always reset to non-signaled state
to fix this race condition.

Signed-off-by: Tero Salminen <[email protected]>
@t-salminen t-salminen merged commit 5e30e33 into v1.13.3_fc_only Apr 2, 2024
7 of 9 checks passed
@t-salminen t-salminen deleted the i2c_semaphore_fix branch April 2, 2024 06:27
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.

3 participants