Skip to content

mcp2515: Change interrupt to TRIGGER_LOW #2267

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

Closed
wants to merge 1 commit into from

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Nov 14, 2017

[ If this is effective we should reconsider all usage of edge-triggered interrupts. ]

The MCP2515 datasheet clearly describes a level-triggered interrupt
pin. Therefore the receiving interrupt controller must also be
configured for level-triggered operation otherwise there is a danger
of a missed interrupt condition blocking all subsequent interrupts.

The ONESHOT flag ensures that the interrupt is masked until the
threaded interrupt handler exits.

See: #2175
#2263

Signed-off-by: Phil Elwell [email protected]

Copy link
Contributor

@msperl msperl left a comment

Choose a reason for hiding this comment

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

For all practical purposes do not specify the trigger type in the driver itself - use 0.

Then the settings from the Device-Tree will get used. That means you will be "backwards-compatible" with earlier DTs...

@pelwell
Copy link
Contributor Author

pelwell commented Nov 14, 2017

Thanks. I've reworked it to simply zero the flags if the device has a DT node.

@msperl
Copy link
Contributor

msperl commented Nov 14, 2017

you could also change the DT to:
#include <dt-bindings/interrupt-controller/irq.h>
and then you can use:
IRQ_TYPE_LEVEL_LOW instead of 8.

But I am not sure if this would really work with the overlays the way these are built...

@pelwell
Copy link
Contributor Author

pelwell commented Nov 14, 2017

I considered that, and it does work, but people often build the overlays outside the kernel tree and I didn't want to add an unnecessary external dependency. I will change the comment to IRQ_TYPE_* though.

The MCP2515 datasheet clearly describes a level-triggered interrupt
pin. Therefore the receiving interrupt controller must also be
configured for level-triggered operation otherwise there is a danger
of a missed interrupt condition blocking all subsequent interrupts.
The ONESHOT flag ensures that the interrupt is masked until the
threaded interrupt handler exits.

Rather than change the flags globally (they must have worked for at
least one user), allow the flags to be overridden from Device Tree
in the event that the device has a DT node.

See: raspberrypi#2175
     raspberrypi#2263

Signed-off-by: Phil Elwell <[email protected]>
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