Skip to content

Commit 20152f1

Browse files
Phil Elwelltkisky
Phil Elwell
authored andcommitted
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: raspberrypi/linux#2175 raspberrypi/linux#2263 Signed-off-by: Phil Elwell <[email protected]> Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent c547ca6 commit 20152f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/can/spi/mcp251x.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ static int mcp251x_open(struct net_device *net)
955955
{
956956
struct mcp251x_priv *priv = netdev_priv(net);
957957
struct spi_device *spi = priv->spi;
958-
unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
958+
unsigned long flags = 0;
959959
int ret;
960960

961961
ret = open_candev(net);
@@ -971,6 +971,9 @@ static int mcp251x_open(struct net_device *net)
971971
priv->tx_skb = NULL;
972972
priv->tx_len = 0;
973973

974+
if (!spi->dev.of_node)
975+
flags = IRQF_TRIGGER_FALLING;
976+
974977
ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
975978
flags | IRQF_ONESHOT, DEVICE_NAME, priv);
976979
if (ret) {

0 commit comments

Comments
 (0)