aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Elwell <phil@raspberrypi.org>2017-11-14 06:03:22 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-08-20 07:41:26 -0400
commit6a07c2305ab200844f250f4dba47ed60d0640505 (patch)
tree416ba6b634d3fc4d1740eff4417add0851720118
parent3964576307edf408435949633b1f600262d70bb6 (diff)
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/2263 Signed-off-by: Phil Elwell <phil@raspberrypi.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--drivers/net/can/spi/mcp251x.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index 407c02f2eb8e..fde7509f40c7 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -913,7 +913,7 @@ static int mcp251x_open(struct net_device *net)
913{ 913{
914 struct mcp251x_priv *priv = netdev_priv(net); 914 struct mcp251x_priv *priv = netdev_priv(net);
915 struct spi_device *spi = priv->spi; 915 struct spi_device *spi = priv->spi;
916 unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING; 916 unsigned long flags = 0;
917 int ret; 917 int ret;
918 918
919 ret = open_candev(net); 919 ret = open_candev(net);
@@ -929,6 +929,9 @@ static int mcp251x_open(struct net_device *net)
929 priv->tx_skb = NULL; 929 priv->tx_skb = NULL;
930 priv->tx_len = 0; 930 priv->tx_len = 0;
931 931
932 if (!spi->dev.of_node)
933 flags = IRQF_TRIGGER_FALLING;
934
932 ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, 935 ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
933 flags | IRQF_ONESHOT, dev_name(&spi->dev), 936 flags | IRQF_ONESHOT, dev_name(&spi->dev),
934 priv); 937 priv);