Commit 6a07c230 authored by Phil Elwell's avatar Phil Elwell Committed by Marc Kleine-Budde

can: mcp251x: Use DT-supplied interrupt flags

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), keep the old behavior for for non DT devices. DT based
devices specify the flags in their corresonding DT node.

See: https://github.com/raspberrypi/linux/issues/2175
     https://github.com/raspberrypi/linux/issues/2263Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.org>
Tested-by: default avatarSean Nyekjaer <sean@geanix.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 39645763
...@@ -913,7 +913,7 @@ static int mcp251x_open(struct net_device *net) ...@@ -913,7 +913,7 @@ static int mcp251x_open(struct net_device *net)
{ {
struct mcp251x_priv *priv = netdev_priv(net); struct mcp251x_priv *priv = netdev_priv(net);
struct spi_device *spi = priv->spi; struct spi_device *spi = priv->spi;
unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING; unsigned long flags = 0;
int ret; int ret;
ret = open_candev(net); ret = open_candev(net);
...@@ -929,6 +929,9 @@ static int mcp251x_open(struct net_device *net) ...@@ -929,6 +929,9 @@ static int mcp251x_open(struct net_device *net)
priv->tx_skb = NULL; priv->tx_skb = NULL;
priv->tx_len = 0; priv->tx_len = 0;
if (!spi->dev.of_node)
flags = IRQF_TRIGGER_FALLING;
ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
flags | IRQF_ONESHOT, dev_name(&spi->dev), flags | IRQF_ONESHOT, dev_name(&spi->dev),
priv); priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment