diff mbox

[PATCH/RFC] can: mcp251x: Allow pass IRQ flags through platform data.

Message ID 1302023321-25182-1-git-send-email-eballetbo@iseebcn.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Enric Balletbo i Serra April 5, 2011, 5:08 p.m. UTC
When an interrupt occurs, the INT pin is driven low by the
MCP251x controller (falling edge) but in some cases the INT
pin can be connected to the MPU through a transistor or level
translator which inverts this signal. In this case interrupt
should be configured in rising edge.

This patch adds support to pass the IRQ flags via
mcp251x_platform_data.

Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
 drivers/net/can/mcp251x.c            |    3 ++-
 include/linux/can/platform/mcp251x.h |    2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)

Comments

Wolfgang Grandegger April 6, 2011, 6:47 a.m. UTC | #1
On 04/05/2011 07:08 PM, Enric Balletbo i Serra wrote:
> When an interrupt occurs, the INT pin is driven low by the
> MCP251x controller (falling edge) but in some cases the INT
> pin can be connected to the MPU through a transistor or level
> translator which inverts this signal. In this case interrupt
> should be configured in rising edge.
> 
> This patch adds support to pass the IRQ flags via
> mcp251x_platform_data.
> 
> Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>

Acked-by: Wolfgang Grandegger <wg@grandegger.com>

Thanks,

Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Kleine-Budde April 6, 2011, 6:57 a.m. UTC | #2
On 04/05/2011 07:08 PM, Enric Balletbo i Serra wrote:
> When an interrupt occurs, the INT pin is driven low by the
> MCP251x controller (falling edge) but in some cases the INT
> pin can be connected to the MPU through a transistor or level
> translator which inverts this signal. In this case interrupt
> should be configured in rising edge.
> 
> This patch adds support to pass the IRQ flags via
> mcp251x_platform_data.
> 
> Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>

looks good

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Kurt Van Dijck April 6, 2011, 7:14 a.m. UTC | #3
On Tue, Apr 05, 2011 at 07:08:41PM +0200, Enric Balletbo i Serra wrote:
>  	ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
> -			  IRQF_TRIGGER_FALLING, DEVICE_NAME, priv);
> +		  pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING,
> +		  DEVICE_NAME, priv);

IMHO, doing like this looks just a tiny bit cleaner
> +		  pdata->irq_flags ?: IRQF_TRIGGER_FALLING,
> +		  DEVICE_NAME, priv);

That's really the only remark :-)

Regards,
Kurt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller April 6, 2011, 7:24 p.m. UTC | #4
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Date: Tue,  5 Apr 2011 19:08:41 +0200

> When an interrupt occurs, the INT pin is driven low by the
> MCP251x controller (falling edge) but in some cases the INT
> pin can be connected to the MPU through a transistor or level
> translator which inverts this signal. In this case interrupt
> should be configured in rising edge.
> 
> This patch adds support to pass the IRQ flags via
> mcp251x_platform_data.
> 
> Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 7513c45..330140e 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -931,7 +931,8 @@  static int mcp251x_open(struct net_device *net)
 	priv->tx_len = 0;
 
 	ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
-			  IRQF_TRIGGER_FALLING, DEVICE_NAME, priv);
+		  pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING,
+		  DEVICE_NAME, priv);
 	if (ret) {
 		dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq);
 		if (pdata->transceiver_enable)
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 8e20540..089fe43 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -12,6 +12,7 @@ 
 /**
  * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
  * @oscillator_frequency:       - oscillator frequency in Hz
+ * @irq_flags:                  - IRQF configuration flags
  * @board_specific_setup:       - called before probing the chip (power,reset)
  * @transceiver_enable:         - called to power on/off the transceiver
  * @power_enable:               - called to power on/off the mcp *and* the
@@ -24,6 +25,7 @@ 
 
 struct mcp251x_platform_data {
 	unsigned long oscillator_frequency;
+	unsigned long irq_flags;
 	int (*board_specific_setup)(struct spi_device *spi);
 	int (*transceiver_enable)(int enable);
 	int (*power_enable) (int enable);