brcm2708: rename target to bcm27xx
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-4.19 / 950-0098-mcp2515-Use-DT-supplied-interrupt-flags.patch
1 From 612a3f0adcf98854dcbe8228551b941b76c6af2c Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 14 Nov 2017 11:03:22 +0000
4 Subject: [PATCH] mcp2515: Use DT-supplied interrupt flags
5
6 The MCP2515 datasheet clearly describes a level-triggered interrupt
7 pin. Therefore the receiving interrupt controller must also be
8 configured for level-triggered operation otherwise there is a danger
9 of a missed interrupt condition blocking all subsequent interrupts.
10 The ONESHOT flag ensures that the interrupt is masked until the
11 threaded interrupt handler exits.
12
13 Rather than change the flags globally (they must have worked for at
14 least one user), allow the flags to be overridden from Device Tree
15 in the event that the device has a DT node.
16
17 See: https://github.com/raspberrypi/linux/issues/2175
18 https://github.com/raspberrypi/linux/issues/2263
19
20 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
21 ---
22 drivers/net/can/spi/mcp251x.c | 3 +++
23 1 file changed, 3 insertions(+)
24
25 --- a/drivers/net/can/spi/mcp251x.c
26 +++ b/drivers/net/can/spi/mcp251x.c
27 @@ -948,6 +948,9 @@ static int mcp251x_open(struct net_devic
28 priv->tx_skb = NULL;
29 priv->tx_len = 0;
30
31 + if (spi->dev.of_node)
32 + flags = 0;
33 +
34 ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
35 flags | IRQF_ONESHOT, DEVICE_NAME, priv);
36 if (ret) {