diff options
author | Enric Balletbo i Serra <eballetbo@iseebcn.com> | 2011-04-05 03:08:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 15:24:26 -0400 |
commit | 34206f267120c839a479d0237db907fa062e7b0f (patch) | |
tree | 9c0ba35cefe44b0913c6cbbc7165869d839abee7 | |
parent | 35a67edf3570e9b44c34965dd52a6b7f845fb40f (diff) |
can: mcp251x: Allow pass IRQ flags through platform data.
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>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/can/mcp251x.c | 3 | ||||
-rw-r--r-- | include/linux/can/platform/mcp251x.h | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 7513c4523ac4..330140ee266d 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) | |||
931 | priv->tx_len = 0; | 931 | priv->tx_len = 0; |
932 | 932 | ||
933 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, | 933 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, |
934 | IRQF_TRIGGER_FALLING, DEVICE_NAME, priv); | 934 | pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, |
935 | DEVICE_NAME, priv); | ||
935 | if (ret) { | 936 | if (ret) { |
936 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); | 937 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
937 | if (pdata->transceiver_enable) | 938 | if (pdata->transceiver_enable) |
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h index 8e20540043f5..089fe43211a4 100644 --- a/include/linux/can/platform/mcp251x.h +++ b/include/linux/can/platform/mcp251x.h | |||
@@ -12,6 +12,7 @@ | |||
12 | /** | 12 | /** |
13 | * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data | 13 | * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data |
14 | * @oscillator_frequency: - oscillator frequency in Hz | 14 | * @oscillator_frequency: - oscillator frequency in Hz |
15 | * @irq_flags: - IRQF configuration flags | ||
15 | * @board_specific_setup: - called before probing the chip (power,reset) | 16 | * @board_specific_setup: - called before probing the chip (power,reset) |
16 | * @transceiver_enable: - called to power on/off the transceiver | 17 | * @transceiver_enable: - called to power on/off the transceiver |
17 | * @power_enable: - called to power on/off the mcp *and* the | 18 | * @power_enable: - called to power on/off the mcp *and* the |
@@ -24,6 +25,7 @@ | |||
24 | 25 | ||
25 | struct mcp251x_platform_data { | 26 | struct mcp251x_platform_data { |
26 | unsigned long oscillator_frequency; | 27 | unsigned long oscillator_frequency; |
28 | unsigned long irq_flags; | ||
27 | int (*board_specific_setup)(struct spi_device *spi); | 29 | int (*board_specific_setup)(struct spi_device *spi); |
28 | int (*transceiver_enable)(int enable); | 30 | int (*transceiver_enable)(int enable); |
29 | int (*power_enable) (int enable); | 31 | int (*power_enable) (int enable); |