Re: [PATCH 8/9] can: mcp251x: Use DT-supplied interrupt flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 19/08/2019 17.38, Marc Kleine-Budde wrote:
From: Phil Elwell <phil@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Tested-by: Sean Nyekjaer <sean@xxxxxxxxxx>
---
  drivers/net/can/spi/mcp251x.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index 19756fb3921a..0cdb88a9525f 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -923,7 +923,7 @@ static int mcp251x_open(struct net_device *net)
  {
  	struct mcp251x_priv *priv = netdev_priv(net);
  	struct spi_device *spi = priv->spi;
-	unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
+	unsigned long flags = 0;
  	int ret;
ret = open_candev(net);
@@ -939,6 +939,9 @@ static int mcp251x_open(struct net_device *net)
  	priv->tx_skb = NULL;
  	priv->tx_len = 0;
+ if (!spi->dev.of_node)
+		flags = IRQF_TRIGGER_FALLING;
+
  	ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
  				   flags | IRQF_ONESHOT, dev_name(&spi->dev),
  				   priv);




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux