Skip to content

Commit 413e48c

Browse files
author
Phil Elwell
committed
mcp2515: 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), allow the flags to be overridden from Device Tree in the event that the device has a DT node. See: #2175 #2263 Signed-off-by: Phil Elwell <[email protected]>
1 parent 46cd72d commit 413e48c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
pinctrl-0 = <&can0_pins>;
6161
spi-max-frequency = <10000000>;
6262
interrupt-parent = <&gpio>;
63-
interrupts = <25 0x2>;
63+
interrupts = <25 8>; /* IRQ_TYPE_LEVEL_LOW */
6464
clocks = <&can0_osc>;
6565
};
6666
};

arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
pinctrl-0 = <&can1_pins>;
6161
spi-max-frequency = <10000000>;
6262
interrupt-parent = <&gpio>;
63-
interrupts = <25 0x2>;
63+
interrupts = <25 8>; /* IRQ_TYPE_LEVEL_LOW */
6464
clocks = <&can1_osc>;
6565
};
6666
};

drivers/net/can/spi/mcp251x.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,9 @@ static int mcp251x_open(struct net_device *net)
952952
priv->tx_skb = NULL;
953953
priv->tx_len = 0;
954954

955+
if (spi->dev.of_node)
956+
flags = 0;
957+
955958
ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
956959
flags | IRQF_ONESHOT, DEVICE_NAME, priv);
957960
if (ret) {

0 commit comments

Comments
 (0)