rh850: Add support to get irq type from device tree

Irq type may vary among targets, add support to get
it from device tree.

Change-Id: I60cb49a4c5fee3dda4ec5abc02966b0b961590da
Signed-off-by: Zhiqiang Tu <ztu@codeaurora.org>
This commit is contained in:
Zhiqiang Tu 2018-05-12 15:21:31 +08:00
parent d5b2406b66
commit 59b0972a90

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -19,6 +19,7 @@
#include <linux/can.h>
#include <linux/can/dev.h>
#include <linux/completion.h>
#include <linux/irq.h>
#define DEBUG_RH850 0
#if DEBUG_RH850 == 1
@ -1103,6 +1104,7 @@ static int rh850_probe(struct spi_device *spi)
int err, i;
struct rh850_can *priv_data;
struct device *dev;
u32 irq_type;
dev = &spi->dev;
dev_info(dev, "rh850_probe");
@ -1134,8 +1136,11 @@ static int rh850_probe(struct spi_device *spi)
}
}
irq_type = irq_get_trigger_type(spi->irq);
if (irq_type == IRQ_TYPE_NONE)
irq_type = IRQ_TYPE_EDGE_FALLING;
err = request_threaded_irq(spi->irq, NULL, rh850_irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
irq_type | IRQF_ONESHOT,
"rh850", priv_data);
if (err) {
dev_err(dev, "Failed to request irq: %d", err);