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

mcp25xxfd: invalid IVMIF condition makes the driver stop #8

Open
irrwisch1 opened this issue Jul 3, 2019 · 4 comments
Open

mcp25xxfd: invalid IVMIF condition makes the driver stop #8

irrwisch1 opened this issue Jul 3, 2019 · 4 comments

Comments

@irrwisch1
Copy link

I'm constantly getting a situation where the driver stops processing interrupts because it detected an invalid IVMIF situation.

i.e this dmesg message:
found IVMIF situation not supported by driver - bdiag = [0x%08x, 0x%08x]

Looking at the registeres I can see that the IMVIF interrupt flag is set even though IMVIE flag is not set and thus the Invalid Message Interrupt is not enabled at all.
Also no error flags are set in BDIAG so mcp25xxfd_can_int_handle_ivmif returns an error, making the whole driver stop processing interrupts.

As a workaround I added a check at the beginning of mcp25xxfd_can_int_handle_ivmif to make sure that IMVIE is enabled before proceeding.
See the attached diff

This resolves the issue for me however I'm still not sure why I see IVMIF interrupts even though IMVIE is disabled.
Any ideas?
ivmif.txt

@petmos
Copy link

petmos commented Sep 19, 2019

@jlanger : You check it a second time? Because in line 399 there is already this check and you check now again by doubling lines 399/400.

@DanielOgorchock
Copy link

DanielOgorchock commented Sep 19, 2019

@petmos No the first check is checking for the flag being set, and the new check checks for the interrupt enable bit.

@petmos
Copy link

petmos commented Sep 20, 2019

@DanielOgorchock : Oops, I didn't recognized the different last letter. Sorry.

@jrm06c
Copy link

jrm06c commented Sep 23, 2019

The problem is in the last few lines of mcp25xxfd_can_int_handle_ivmif(). The invalid message interrupt flag (IVMIF) needs to be cleared but the interrupt enable bit (IVMIE) is being used instead.

The problem:

  1. IVMIF gets set for a valid reason (a valid failure).
  2. The reason in BDIAG1 is correctly processed by mcp25xxfd_can_int_handle_ivmif_tx() and mcp25xxfd_can_int_handle_ivmif_rx() then cleared for the next IVMIF.
  3. Not clearing IVMIF means the next iteration of the for loop in mcp25xxfd_can_int() finds another IVMIF condition.
  4. This causes another processing of BDIAG1 which is all clear and triggers the unsupported IVMIF situation.

Changing the last few lines to this made the problem go away:

/* and clear the interrupt flag until we have received or transmited */
cpriv->status.intf &= ~(MCP25XXFD_CAN_INT_IVMIF);
return mcp25xxfd_cmd_write_mask(spi, MCP25XXFD_CAN_INT, cpriv->status.intf, MCP25XXFD_CAN_INT_IVMIF);

heikoschmidttki added a commit to heikoschmidttki/linux-rpi that referenced this issue Dec 7, 2020
…g register set fixed

Added check if IMVIF interrupts are enabled in mcp25xxfd_can_int_handle_ivmif() in
order to avoid unhandled IMVIF conditions. Also the root cause, the reset of the
IVMIE instead of IVMIF at the end of the same function is corrected, so that the
previously mentioned fix only hardens the ISR. This solution was proposed in Github
issue msperl#8
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

No branches or pull requests

4 participants