Skip to content

Commit e165cf2

Browse files
Phil Elwellgibsson
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 cc3bfac commit e165cf2

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
@@ -953,7 +953,7 @@ static int mcp251x_open(struct net_device *net)
953953
{
954954
struct mcp251x_priv *priv = netdev_priv(net);
955955
struct spi_device *spi = priv->spi;
956-
unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
956+
unsigned long flags = 0;
957957
int ret;
958958

959959
ret = open_candev(net);
@@ -969,6 +969,9 @@ static int mcp251x_open(struct net_device *net)
969969
priv->tx_skb = NULL;
970970
priv->tx_len = 0;
971971

972+
if (!spi->dev.of_node)
973+
flags = IRQF_TRIGGER_FALLING;
974+
972975
ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
973976
flags | IRQF_ONESHOT, DEVICE_NAME, priv);
974977
if (ret) {

0 commit comments

Comments
 (0)